source: cmedia/trunk/Drv32/devhlp.asm@ 354

Last change on this file since 354 was 354, checked in by stevenhl, 17 years ago

Import untested baseline cmedia sources, work products and binaries
Binaries and work products should be deleted from repository.
once new builds are verified to work.

File size: 4.0 KB
Line 
1; $Id: devhlp.asm,v 1.2 2000/04/26 18:00:58 sandervl Exp $
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
29DosTable2 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 ?
49DosTable2 ends
50
51DATA32 segment
52 public DevHelp32
53 public TKSSBase
54
55DevHelp32 dd 0
56TKSSBase dd 0
57
58DATA32 ends
59
60
61CODE32 segment
62ASSUME 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
71GetTKSSBase 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
115GetTKSSBase_Err:
116 pop edx
117 pop ecx
118 pop ebx
119 pop es
120 leave
121 ret
122GetTKSSBase endp
123
124iodelay32_ proc near
125 mov eax, DOSIODELAYCNT
126 align 4
127@@: dec eax
128 jnz @b
129 loop iodelay32_
130 ret
131iodelay32_ endp
132
133CODE32 ends
134
135 end
Note: See TracBrowser for help on using the repository browser.