1 | ; $Id: devhlp.asm 148 2000-04-26 18:01:02Z sandervl $
|
---|
2 |
|
---|
3 |
|
---|
4 | ; 32 bits OS/2 device driver and IFS support driver. Provides 32 bits kernel
|
---|
5 | ; services (DevHelp) and utility functions to 32 bits OS/2 ring 0 code
|
---|
6 | ; (device drivers and installable file system drivers).
|
---|
7 | ; Copyright (C) 1995, 1996 Matthieu WILLM
|
---|
8 | ;
|
---|
9 | ; This program is free software; you can redistribute it and/or modify
|
---|
10 | ; it under the terms of the GNU General Public License as published by
|
---|
11 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
12 | ; (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 License
|
---|
20 | ; along with this program; if not, write to the Free Software
|
---|
21 | ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
22 |
|
---|
23 | .386p
|
---|
24 |
|
---|
25 | include bseerr.inc
|
---|
26 | include devhlp.inc
|
---|
27 | include sbseg.inc
|
---|
28 |
|
---|
29 | DosTable2 struc
|
---|
30 | d2_ErrMap24 dd ?
|
---|
31 | d2_MsgMap24 dd ?
|
---|
32 | d2_Err_Table_24 dd ?
|
---|
33 | d2_CDSAddr dd ?
|
---|
34 | d2_GDT_RDR1 dd ?
|
---|
35 | d2_InterruptLevel dd ?
|
---|
36 | d2__cInDos dd ?
|
---|
37 | d2_zero_1 dd ?
|
---|
38 | d2_zero_2 dd ?
|
---|
39 | d2_FlatCS dd ?
|
---|
40 | d2_FlatDS dd ?
|
---|
41 | d2__TKSSBase dd ?
|
---|
42 | d2_intSwitchStack dd ?
|
---|
43 | d2_privateStack dd ?
|
---|
44 | d2_PhysDiskTablePtr dd ?
|
---|
45 | d2_forceEMHandler dd ?
|
---|
46 | d2_ReserveVM dd ?
|
---|
47 | d2_pgpPageDir dd ?
|
---|
48 | d2_unknown dd ?
|
---|
49 | DosTable2 ends
|
---|
50 |
|
---|
51 | DATA32 segment
|
---|
52 | public DevHelp32
|
---|
53 | public TKSSBase
|
---|
54 |
|
---|
55 | DevHelp32 dd 0
|
---|
56 | TKSSBase dd 0
|
---|
57 |
|
---|
58 | DATA32 ends
|
---|
59 |
|
---|
60 |
|
---|
61 | CODE32 segment
|
---|
62 | ASSUME CS:FLAT, DS:FLAT, ES:FLAT
|
---|
63 |
|
---|
64 | public GetTKSSBase
|
---|
65 | public iodelay32_
|
---|
66 | extrn DevHlp : near
|
---|
67 | extrn DOSIODELAYCNT : ABS
|
---|
68 |
|
---|
69 | ALIGN 4
|
---|
70 |
|
---|
71 | GetTKSSBase proc near
|
---|
72 | push ebp
|
---|
73 | mov ebp, esp
|
---|
74 | push es
|
---|
75 | push ebx
|
---|
76 | push ecx
|
---|
77 | push edx
|
---|
78 |
|
---|
79 | ;
|
---|
80 | ; Gets the TKSSBase pointer from DosTable. TKSSBase is used by
|
---|
81 | ; __StackToFlat() to convert a stack based address to a FLAT address
|
---|
82 | ; without the overhead of DevHlp_VirtToLin
|
---|
83 | ;
|
---|
84 | ; DosTable is obtained through GetDOSVar with undocumented index 9
|
---|
85 | ; The layout is :
|
---|
86 | ; byte count of following dword (n)
|
---|
87 | ; dword 1 -+
|
---|
88 | ; . |
|
---|
89 | ; . | this is DosTable1
|
---|
90 | ; . |
|
---|
91 | ; dword n -+
|
---|
92 | ; byte count of following dword (p)
|
---|
93 | ; dword 1 -+
|
---|
94 | ; . |
|
---|
95 | ; . | this is DosTable2
|
---|
96 | ; . |
|
---|
97 | ; dword p -+
|
---|
98 | ;
|
---|
99 | ; Flat CS is dword number 10 in DosTable2
|
---|
100 | ; Flat DS is dword number 11 in DosTable2
|
---|
101 | ; TKSSBase is dword number 12 in DosTable2
|
---|
102 | ;
|
---|
103 | mov eax, 9 ; undocumented DosVar : DosTable pointer
|
---|
104 | xor ecx, ecx
|
---|
105 | mov edx, DevHlp_GetDOSVar
|
---|
106 | call DevHlp
|
---|
107 | jc short GetTKSSBase_Err
|
---|
108 | mov es, ax ; es:bx points to DosTable
|
---|
109 | movzx ebx, bx
|
---|
110 | movzx ecx, byte ptr es:[ebx] ; count of dword in DosTable1
|
---|
111 | mov eax, es:[ebx + 4 * ecx + 2].d2__TKSSBase
|
---|
112 | mov TKSSBase, eax
|
---|
113 |
|
---|
114 | xor eax, eax
|
---|
115 | GetTKSSBase_Err:
|
---|
116 | pop edx
|
---|
117 | pop ecx
|
---|
118 | pop ebx
|
---|
119 | pop es
|
---|
120 | leave
|
---|
121 | ret
|
---|
122 | GetTKSSBase endp
|
---|
123 |
|
---|
124 | iodelay32_ proc near
|
---|
125 | mov eax, DOSIODELAYCNT
|
---|
126 | align 4
|
---|
127 | @@: dec eax
|
---|
128 | jnz @b
|
---|
129 | loop iodelay32_
|
---|
130 | ret
|
---|
131 | iodelay32_ endp
|
---|
132 |
|
---|
133 | CODE32 ends
|
---|
134 |
|
---|
135 | end
|
---|