1 | ; $Id: devfirst.asm,v 1.6 2000-09-02 21:07:58 bird Exp $
|
---|
2 | ;
|
---|
3 | ; DevFirst - entrypoint and segment definitions
|
---|
4 | ;
|
---|
5 | ; Copyright (c) 1999 knut st. osmundsen
|
---|
6 | ;
|
---|
7 | ; Project Odin Software License can be found in LICENSE.TXT
|
---|
8 | ;
|
---|
9 | .386p
|
---|
10 |
|
---|
11 | ;
|
---|
12 | ; Include files
|
---|
13 | ;
|
---|
14 | include devsegdf.inc
|
---|
15 | include sas.inc
|
---|
16 |
|
---|
17 | ;
|
---|
18 | ; Exported symbols
|
---|
19 | ;
|
---|
20 | public CODE16START
|
---|
21 | public CODE16_INITSTART
|
---|
22 | public DATA16START
|
---|
23 | public DATA16START
|
---|
24 | public DATA16_BSSSTART
|
---|
25 | public DATA16_CONSTSTART
|
---|
26 | public DATA16_INITSTART
|
---|
27 | public CODE16START
|
---|
28 | public CODE32START
|
---|
29 | public DATA32START
|
---|
30 | public BSS32START
|
---|
31 | public CONST32_ROSTART
|
---|
32 | public _VFTSTART
|
---|
33 | public EH_DATASTART
|
---|
34 |
|
---|
35 |
|
---|
36 | public _strategyAsm0
|
---|
37 | public _strategyAsm1
|
---|
38 | public _CallGetKernelInfo32
|
---|
39 | public _CallElfIOCtl
|
---|
40 | public _CallWin32kIOCtl
|
---|
41 | public _SSToDS_16a
|
---|
42 | public GetOS2KrnlMTE
|
---|
43 |
|
---|
44 |
|
---|
45 | ;
|
---|
46 | ; Externs
|
---|
47 | ;
|
---|
48 | extrn _TKSSBase16:dword
|
---|
49 | extrn GETKERNELINFO32:FAR
|
---|
50 | extrn ELFIOCTL:FAR
|
---|
51 | extrn WIN32KIOCTL:FAR
|
---|
52 | .286p
|
---|
53 | extrn _strategy:near
|
---|
54 |
|
---|
55 |
|
---|
56 | CODE16 segment
|
---|
57 | ASSUME CS:CODE16, DS:DATA16, ES:NOTHING, SS:NOTHING
|
---|
58 |
|
---|
59 | CODE16START label byte
|
---|
60 |
|
---|
61 | .286p
|
---|
62 | ;$win32ki entry point
|
---|
63 | _strategyAsm0:
|
---|
64 | ; int 3
|
---|
65 | push 0
|
---|
66 | jmp _strategyAsm
|
---|
67 |
|
---|
68 | ;$win32k entry point
|
---|
69 | _strategyAsm1:
|
---|
70 | ; int 3
|
---|
71 | push 1
|
---|
72 | jmp _strategyAsm
|
---|
73 |
|
---|
74 | ;;
|
---|
75 | ; Stub which pushes parameters onto the stack and call the 16-bit C strategy routine.
|
---|
76 | ; @returns returns the return value of strategy(...)
|
---|
77 | ; @author knut st. osmundsen
|
---|
78 | _strategyAsm proc far
|
---|
79 | push es
|
---|
80 | push bx
|
---|
81 | push ds
|
---|
82 | pop es
|
---|
83 | call _strategy
|
---|
84 | pop bx
|
---|
85 | pop es
|
---|
86 | mov word ptr es:[bx+3], ax
|
---|
87 | add sp, 2
|
---|
88 | retf
|
---|
89 | _strategyAsm endp
|
---|
90 |
|
---|
91 |
|
---|
92 | .386p
|
---|
93 | ;;
|
---|
94 | ; Thunk procedure for R0Init32.
|
---|
95 | ; @cproto USHORT NEAR CallGetKernelInfo32(ULONG addressKrnlInfoBuf);
|
---|
96 | ; @returns Same as GetKernelInfo32.
|
---|
97 | ; @param addressKrnlInfoBuf 32-bit pointer to request data on stack.
|
---|
98 | ; @status completely implemented.
|
---|
99 | ; @author knut st. osmundsen
|
---|
100 | _CallGetKernelInfo32 PROC NEAR
|
---|
101 | ASSUME CS:CODE16
|
---|
102 | push ds
|
---|
103 | push word ptr [esp+6] ; push high word.
|
---|
104 | push word ptr [esp+6] ; push low word.
|
---|
105 | call far ptr FLAT:GETKERNELINFO32
|
---|
106 | pop ds
|
---|
107 | ret
|
---|
108 | _CallGetKernelInfo32 ENDP
|
---|
109 |
|
---|
110 |
|
---|
111 |
|
---|
112 |
|
---|
113 | ;;
|
---|
114 | ; Thunk procedure for .
|
---|
115 | ; @cproto USHORT NEAR CallElfIOCtl(void);
|
---|
116 | ; @returns Same as ElfIOCtl
|
---|
117 | ; @param address of IOCtl request packet (32-bit pointer).
|
---|
118 | ; @status completely implemented.
|
---|
119 | ; @author knut st. osmundsen
|
---|
120 | _CallElfIOCtl PROC NEAR
|
---|
121 | ASSUME CS:CODE16
|
---|
122 | push ds
|
---|
123 | push word ptr [esp+6] ; push high word.
|
---|
124 | push word ptr [esp+6] ; push low word.
|
---|
125 | call far ptr FLAT:ELFIOCTL
|
---|
126 | pop ds
|
---|
127 | retn
|
---|
128 | _CallElfIOCtl ENDP
|
---|
129 |
|
---|
130 | ;;
|
---|
131 | ; Thunk procedure for .
|
---|
132 | ; @cproto USHORT NEAR CallWin32kIOCtl(void);
|
---|
133 | ; @returns Same as Win32kIOCtl
|
---|
134 | ; @param address of IOCtl request packet (32-bit pointer).
|
---|
135 | ; @status completely implemented.
|
---|
136 | ; @author knut st. osmundsen
|
---|
137 | _CallWin32kIOCtl PROC NEAR
|
---|
138 | ASSUME CS:CODE16
|
---|
139 | push ds
|
---|
140 | push word ptr [esp+6] ; push high word.
|
---|
141 | push word ptr [esp+6] ; push low word.
|
---|
142 | call far ptr FLAT:WIN32KIOCTL
|
---|
143 | pop ds
|
---|
144 | retn
|
---|
145 | _CallWin32kIOCtl ENDP
|
---|
146 |
|
---|
147 |
|
---|
148 |
|
---|
149 | ;;
|
---|
150 | ; SSToDS - stack pointer to Flat pointer.
|
---|
151 | ; @cproto extern LIN SSToDS_16a(void NEAR *pStackVar);
|
---|
152 | ; @returns ax:dx makes up a 32-bit flat pointer to stack.
|
---|
153 | ; @param pStackVar Stack pointer which is to be made a flat pointer.
|
---|
154 | ; @equiv SSToDS in 32-bit code.
|
---|
155 | ; @sketch Get Flat CS
|
---|
156 | ; Get TKSSBase address. (FLAT)
|
---|
157 | ; return *TKSSBase + pStackVar.
|
---|
158 | ; @status completely implemented.
|
---|
159 | ; @author knut st. osmundsen
|
---|
160 | ; @remark es is cs, not ds!
|
---|
161 | _SSToDS_16a proc NEAR
|
---|
162 | assume CS:CODE16, DS:DATA16, ES:NOTHING
|
---|
163 | mov edx, ds:_TKSSBase16 ; get pointer held by _TKSSBase16 (pointer to stack base)
|
---|
164 | call far ptr FLAT:far_getCS ; get flat selector.
|
---|
165 | push es
|
---|
166 | mov es, ax
|
---|
167 | assume es:FLAT
|
---|
168 | mov eax, es:[edx] ; get pointer to stack base
|
---|
169 | pop es
|
---|
170 | movzx edx, word ptr ss:[esp + 2] ; 16-bit stack pointer (parameter)
|
---|
171 | add eax, edx ; 32-bit stack pointer in eax
|
---|
172 | mov edx, eax
|
---|
173 | shr edx, 16 ; dx high 16-bit of 32-bit stack pointer.
|
---|
174 | retn
|
---|
175 | _SSToDS_16a endp
|
---|
176 |
|
---|
177 | CODE16 ends
|
---|
178 |
|
---|
179 |
|
---|
180 | ;
|
---|
181 | ; all segments have a <segmentname>START label at the start of the segment.
|
---|
182 | ;
|
---|
183 |
|
---|
184 | CODE32 segment
|
---|
185 | CODE32START label byte
|
---|
186 |
|
---|
187 | ;;
|
---|
188 | ; Gets the current cs.
|
---|
189 | ; @cproto none.
|
---|
190 | ; @returns CS
|
---|
191 | ; @author knut st. osmundsen
|
---|
192 | ; @remark internal method. called from 16-bit code...
|
---|
193 | far_getCS proc far
|
---|
194 | ASSUME DS:nothing, ES:nothing
|
---|
195 | mov ax, cs
|
---|
196 | retf
|
---|
197 | far_getCS endp
|
---|
198 |
|
---|
199 |
|
---|
200 |
|
---|
201 | ;;
|
---|
202 | ; Gets the a 32-bit flat pointer to the OS/2 Kernel MTE.
|
---|
203 | ; @cproto extern PMTE _System GetOS2KrnlMTE(void);
|
---|
204 | ; @returns Pointer to kernel MTE.
|
---|
205 | ; @status completely implemented.
|
---|
206 | ; @author knut st. osmundsen
|
---|
207 | GetOS2KrnlMTE PROC NEAR
|
---|
208 | push es
|
---|
209 |
|
---|
210 | mov ax, SAS_selector ;70h - Read-only SAS selector.
|
---|
211 | mov es, ax
|
---|
212 | xor ebx, ebx
|
---|
213 | assume ebx: PTR SAS
|
---|
214 | mov bx, es:[ebx].SAS_vm_data ;SAS_vm_data (0ch)
|
---|
215 | assume ebx: PTR SAS_vm_section
|
---|
216 | mov eax, es:[ebx].SAS_vm_krnl_mte ;SAS_vm_krnl_mte (0ch)
|
---|
217 |
|
---|
218 | pop es
|
---|
219 | ret
|
---|
220 | GetOS2KrnlMTE ENDP
|
---|
221 |
|
---|
222 | CODE32 ends
|
---|
223 |
|
---|
224 | CODE16_INIT segment
|
---|
225 | CODE16_INITSTART label byte
|
---|
226 | CODE16_INIT ends
|
---|
227 |
|
---|
228 | DATA16 segment
|
---|
229 | DATA16START label byte
|
---|
230 | DATA16 ends
|
---|
231 |
|
---|
232 | DATA16_BSS segment
|
---|
233 | DATA16_BSSSTART label byte
|
---|
234 | DATA16_BSS ends
|
---|
235 |
|
---|
236 | DATA16_CONST segment
|
---|
237 | DATA16_CONSTSTART label byte
|
---|
238 | DATA16_CONST ends
|
---|
239 |
|
---|
240 | DATA16_INIT segment
|
---|
241 | DATA16_INITSTART label byte
|
---|
242 | DATA16_INIT ends
|
---|
243 |
|
---|
244 | DATA32 segment
|
---|
245 | DATA32START label byte
|
---|
246 | DATA32 ends
|
---|
247 |
|
---|
248 | BSS32 segment
|
---|
249 | BSS32START label byte
|
---|
250 | BSS32 ends
|
---|
251 |
|
---|
252 | CONST32_RO segment
|
---|
253 | CONST32_ROSTART label byte
|
---|
254 | CONST32_RO ends
|
---|
255 |
|
---|
256 | _VFT segment
|
---|
257 | _VFTSTART LABEL BYTE
|
---|
258 | _VFT ends
|
---|
259 |
|
---|
260 | EH_DATA segment
|
---|
261 | EH_DATASTART LABEL BYTE
|
---|
262 | EH_DATA ends
|
---|
263 |
|
---|
264 | END
|
---|
265 |
|
---|