1 | ; $Id: devhlp.asm,v 1.1.1.1 2003/07/02 13:56:56 eleph Exp $
|
---|
2 | ;*
|
---|
3 | ;* 32bit DevHelp implementations. Usually thunk down to the well known
|
---|
4 | ;* 16bit OS/2 DevHelp calls
|
---|
5 | ;*
|
---|
6 | ;* (C) 2000-2002 InnoTek Systemberatung GmbH
|
---|
7 | ;* (C) 2000-2001 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
8 | ;*
|
---|
9 | ;* This program is free software; you can redistribute it and/or
|
---|
10 | ;* modify it under the terms of the GNU General Public License as
|
---|
11 | ;* published by the Free Software Foundation; either version 2 of
|
---|
12 | ;* the License, or (at your option) any later version.
|
---|
13 | ;*
|
---|
14 | ;* This program is distributed in the hope that it will be useful,
|
---|
15 | ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
17 | ;* GNU General Public License for more details.
|
---|
18 | ;*
|
---|
19 | ;* You should have received a copy of the GNU General Public
|
---|
20 | ;* License along with this program; if not, write to the Free
|
---|
21 | ;* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
|
---|
22 | ;* USA.
|
---|
23 | ;*
|
---|
24 |
|
---|
25 | .386p
|
---|
26 |
|
---|
27 | include segments.inc
|
---|
28 |
|
---|
29 | IFNDEF KEE
|
---|
30 | include devhlp.inc
|
---|
31 | DosTable2 struc
|
---|
32 | d2_ErrMap24 dd ?
|
---|
33 | d2_MsgMap24 dd ?
|
---|
34 | d2_Err_Table_24 dd ?
|
---|
35 | d2_CDSAddr dd ?
|
---|
36 | d2_GDT_RDR1 dd ?
|
---|
37 | d2_InterruptLevel dd ?
|
---|
38 | d2__cInDos dd ?
|
---|
39 | d2_zero_1 dd ?
|
---|
40 | d2_zero_2 dd ?
|
---|
41 | d2_FlatCS dd ?
|
---|
42 | d2_FlatDS dd ?
|
---|
43 | d2__TKSSBase dd ?
|
---|
44 | d2_intSwitchStack dd ?
|
---|
45 | d2_privateStack dd ?
|
---|
46 | d2_PhysDiskTablePtr dd ?
|
---|
47 | d2_forceEMHandler dd ?
|
---|
48 | d2_ReserveVM dd ?
|
---|
49 | d2_pgpPageDir dd ?
|
---|
50 | d2_unknown dd ?
|
---|
51 | DosTable2 ends
|
---|
52 |
|
---|
53 | DATA32 segment
|
---|
54 | public intSwitchStack
|
---|
55 | public _TKSSBase
|
---|
56 | intSwitchStack dd 0
|
---|
57 | _TKSSBase dd 0
|
---|
58 |
|
---|
59 | DATA32 ends
|
---|
60 | ENDIF
|
---|
61 |
|
---|
62 | CODE32 segment
|
---|
63 | ASSUME CS:FLAT, DS:FLAT, ES:FLAT
|
---|
64 |
|
---|
65 | IFNDEF KEE
|
---|
66 | extrn DevHlp : near
|
---|
67 | ALIGN 4
|
---|
68 | public GetTKSSBase
|
---|
69 | GetTKSSBase proc near
|
---|
70 | push ebp
|
---|
71 | mov ebp, esp
|
---|
72 | push es
|
---|
73 | push ebx
|
---|
74 | push ecx
|
---|
75 | push edx
|
---|
76 |
|
---|
77 | ;
|
---|
78 | ; Gets the TKSSBase pointer from DosTable. TKSSBase is used by
|
---|
79 | ; __StackToFlat() to convert a stack based address to a FLAT address
|
---|
80 | ; without the overhead of DevHlp_VirtToLin
|
---|
81 | ;
|
---|
82 | ; DosTable is obtained through GetDOSVar with undocumented index 9
|
---|
83 | ; The layout is :
|
---|
84 | ; byte count of following dword (n)
|
---|
85 | ; dword 1 -+
|
---|
86 | ; . |
|
---|
87 | ; . | this is DosTable1
|
---|
88 | ; . |
|
---|
89 | ; dword n -+
|
---|
90 | ; byte count of following dword (p)
|
---|
91 | ; dword 1 -+
|
---|
92 | ; . |
|
---|
93 | ; . | this is DosTable2
|
---|
94 | ; . |
|
---|
95 | ; dword p -+
|
---|
96 | ;
|
---|
97 | ; Flat CS is dword number 10 in DosTable2
|
---|
98 | ; Flat DS is dword number 11 in DosTable2
|
---|
99 | ; TKSSBase is dword number 12 in DosTable2
|
---|
100 | ;
|
---|
101 | mov eax, 9 ; undocumented DosVar : DosTable pointer
|
---|
102 | xor ecx, ecx
|
---|
103 | mov edx, DevHlp_GetDOSVar
|
---|
104 | call DevHlp
|
---|
105 | jc short GetTKSSBase_Err
|
---|
106 | mov es, ax ; es:bx points to DosTable
|
---|
107 | movzx ebx, bx
|
---|
108 | movzx ecx, byte ptr es:[ebx] ; count of dword in DosTable1
|
---|
109 | mov eax, es:[ebx + 4 * ecx + 2].d2__TKSSBase
|
---|
110 | mov _TKSSBase, eax
|
---|
111 |
|
---|
112 | mov eax, es:[ebx + 4 * ecx + 2].d2_intSwitchStack
|
---|
113 | mov intSwitchStack, eax
|
---|
114 |
|
---|
115 | xor eax, eax
|
---|
116 | GetTKSSBase_Err:
|
---|
117 | pop edx
|
---|
118 | pop ecx
|
---|
119 | pop ebx
|
---|
120 | pop es
|
---|
121 | leave
|
---|
122 | ret
|
---|
123 | GetTKSSBase endp
|
---|
124 | ENDIF
|
---|
125 |
|
---|
126 | public iodelay32_
|
---|
127 | extrn DOSIODELAYCNT : ABS
|
---|
128 |
|
---|
129 | ALIGN 4
|
---|
130 |
|
---|
131 | iodelay32_ proc near
|
---|
132 | mov eax, DOSIODELAYCNT
|
---|
133 | align 4
|
---|
134 | @@: dec eax
|
---|
135 | jnz @b
|
---|
136 | loop iodelay32_
|
---|
137 | ret
|
---|
138 | iodelay32_ endp
|
---|
139 |
|
---|
140 | CODE32 ends
|
---|
141 |
|
---|
142 | end
|
---|