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