source: sbliveos2/trunk/drv32/devhlp.asm@ 145

Last change on this file since 145 was 142, checked in by ktk, 25 years ago

Import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1; $Id: devhlp.asm 142 2000-04-23 14:55:46Z ktk $
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 extrn DevHlp : near
66
67 ALIGN 4
68
69GetTKSSBase 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 xor eax, eax
113GetTKSSBase_Err:
114 pop edx
115 pop ecx
116 pop ebx
117 pop es
118 leave
119 ret
120GetTKSSBase endp
121
122CODE32 ends
123
124 end
Note: See TracBrowser for help on using the repository browser.