source: trunk/src/win32k/dev32/devfirst.asm@ 2799

Last change on this file since 2799 was 2799, checked in by bird, 26 years ago

IOCtl exported services.
k32AllocMemEx.

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