source: trunk/src/idctest/init.asm@ 133

Last change on this file since 133 was 133, checked in by Markus Thielen, 13 years ago
  • (#13) added IDC entry point to allow switching back to BIOS mode
  • added IDCTEST driver and program for testing the IDC entry point
  • fixed bug in IOCTL handling (missing 'break')
File size: 3.5 KB
Line 
1; ----------------------------------------------------------------------------
2; Initialization routines and segment mappings for idctest driver.
3;
4; This is a stripped down version of os2ahci's init.asm.
5
6include devhdr.inc
7
8; -----------------------------------------------------------------------------
9; Public symbols
10
11 PUBLIC _asm_strat ; low-level strategy routine
12 PUBLIC _end_of_data ; end of all data (label)
13 PUBLIC _end_of_code ; end of all code (label)
14
15; ----------------------------------------------------------------------------
16; Device Driver Header
17
18DEVHDR SEGMENT WORD PUBLIC 'DATA'
19_dev_hdr dd -1 ; next device header
20 dw DEVLEV_3 + DEV_CHAR_DEV ; flags for ADD drivers
21 dw OFFSET _asm_strat ; strategy routine
22 dw 0 ; IDC entry point
23 db "IDCTEST$" ; name of character device
24 dq 0 ; 8 reserved bytes
25 dd 0 ; ADD flags
26 dw 0
27DEVHDR ENDS
28
29; ----------------------------------------------------------------------------
30; Segment Definitions. We need to reference all segments here, even if they
31; are not used, to allow proper grouping of all segments into one group for
32; data and one group for code as well as proper ordering of the segments
33; within each group to make sure the end of segment markers are at the end
34; of each group.
35
36; On top of that, we need to make sure that the end of segment marker is in
37; a data segment of class 'BSS' because BSS segments are always put towards
38; the end of the executable when linking with high-level language objects
39; such as C.
40
41_DATA SEGMENT WORD PUBLIC 'DATA'
42_DATA ENDS
43
44CONST SEGMENT WORD PUBLIC 'CONST'
45CONST ENDS
46
47_BSS SEGMENT WORD PUBLIC 'BSS'
48_BSS ENDS
49
50c_common SEGMENT WORD PUBLIC 'BSS'
51c_common ENDS
52
53_z_data SEGMENT WORD PUBLIC 'BSS'
54_end_of_data db 0
55_z_data ENDS
56
57_TEXT SEGMENT WORD PUBLIC 'CODE'
58 EXTRN _c_strat_idc : NEAR ; C strategy routine
59_TEXT ENDS
60
61CODE SEGMENT WORD PUBLIC 'CODE'
62CODE ENDS
63
64RMCode SEGMENT WORD PUBLIC 'CODE'
65RMCode ENDS
66
67LIBCODE SEGMENT WORD PUBLIC 'CODE'
68LIBCODE ENDS
69
70_z_text SEGMENT WORD PUBLIC 'CODE'
71_end_of_code LABEL NEAR
72_z_text ENDS
73
74DGROUP GROUP DEVHDR, _DATA, CONST, _BSS, c_common, _z_data
75TGROUP GROUP _TEXT, CODE, _z_text
76
77; ----------------------------------------------------------------------------
78; Start of code
79
80_TEXT SEGMENT WORD PUBLIC 'CODE'
81 ASSUME DS:DGROUP
82 ASSUME ES:NOTHING
83 ASSUME SS:NOTHING
84
85
86; Device driver main entry point (strategy routine)
87_asm_strat PROC FAR
88
89 ; push request packet address
90 PUSH ES
91 PUSH BX
92 CLD
93
94 ; call C strategy routine
95 CALL _c_strat_idc
96
97 POP BX
98 POP ES
99 MOV WORD PTR ES:[BX+3], AX
100 RET
101_asm_strat ENDP
102
103
104_TEXT ENDS
105
106 END
107
Note: See TracBrowser for help on using the repository browser.