[1] | 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 bseerr.inc
|
---|
| 28 | include devhlp.inc
|
---|
| 29 | include segments.inc
|
---|
| 30 |
|
---|
| 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 DevHelp32
|
---|
| 55 | public intSwitchStack
|
---|
| 56 |
|
---|
| 57 | DevHelp32 dd 0
|
---|
| 58 | intSwitchStack dd 0
|
---|
| 59 |
|
---|
| 60 | public _TKSSBase
|
---|
| 61 | _TKSSBase dd 0
|
---|
| 62 |
|
---|
| 63 | DATA32 ends
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 | CODE32 segment
|
---|
| 67 | ASSUME CS:FLAT, DS:FLAT, ES:FLAT
|
---|
| 68 |
|
---|
| 69 | public iodelay32_
|
---|
| 70 |
|
---|
| 71 | extrn DevHlp : near
|
---|
| 72 | extrn DOSIODELAYCNT : ABS
|
---|
| 73 |
|
---|
| 74 | ALIGN 4
|
---|
| 75 |
|
---|
| 76 | public GetTKSSBase
|
---|
| 77 |
|
---|
| 78 | GetTKSSBase proc near
|
---|
| 79 | push ebp
|
---|
| 80 | mov ebp, esp
|
---|
| 81 | push es
|
---|
| 82 | push ebx
|
---|
| 83 | push ecx
|
---|
| 84 | push edx
|
---|
| 85 |
|
---|
| 86 | ;
|
---|
| 87 | ; Gets the TKSSBase pointer from DosTable. TKSSBase is used by
|
---|
| 88 | ; __StackToFlat() to convert a stack based address to a FLAT address
|
---|
| 89 | ; without the overhead of DevHlp_VirtToLin
|
---|
| 90 | ;
|
---|
| 91 | ; DosTable is obtained through GetDOSVar with undocumented index 9
|
---|
| 92 | ; The layout is :
|
---|
| 93 | ; byte count of following dword (n)
|
---|
| 94 | ; dword 1 -+
|
---|
| 95 | ; . |
|
---|
| 96 | ; . | this is DosTable1
|
---|
| 97 | ; . |
|
---|
| 98 | ; dword n -+
|
---|
| 99 | ; byte count of following dword (p)
|
---|
| 100 | ; dword 1 -+
|
---|
| 101 | ; . |
|
---|
| 102 | ; . | this is DosTable2
|
---|
| 103 | ; . |
|
---|
| 104 | ; dword p -+
|
---|
| 105 | ;
|
---|
| 106 | ; Flat CS is dword number 10 in DosTable2
|
---|
| 107 | ; Flat DS is dword number 11 in DosTable2
|
---|
| 108 | ; TKSSBase is dword number 12 in DosTable2
|
---|
| 109 | ;
|
---|
| 110 | mov eax, 9 ; undocumented DosVar : DosTable pointer
|
---|
| 111 | xor ecx, ecx
|
---|
| 112 | mov edx, DevHlp_GetDOSVar
|
---|
| 113 | call DevHlp
|
---|
| 114 | jc short GetTKSSBase_Err
|
---|
| 115 | mov es, ax ; es:bx points to DosTable
|
---|
| 116 | movzx ebx, bx
|
---|
| 117 | movzx ecx, byte ptr es:[ebx] ; count of dword in DosTable1
|
---|
| 118 | mov eax, es:[ebx + 4 * ecx + 2].d2__TKSSBase
|
---|
| 119 | mov _TKSSBase, eax
|
---|
| 120 |
|
---|
| 121 | mov eax, es:[ebx + 4 * ecx + 2].d2_intSwitchStack
|
---|
| 122 | mov intSwitchStack, eax
|
---|
| 123 |
|
---|
| 124 | xor eax, eax
|
---|
| 125 | GetTKSSBase_Err:
|
---|
| 126 | pop edx
|
---|
| 127 | pop ecx
|
---|
| 128 | pop ebx
|
---|
| 129 | pop es
|
---|
| 130 | leave
|
---|
| 131 | ret
|
---|
| 132 | GetTKSSBase endp
|
---|
| 133 |
|
---|
| 134 | ALIGN 4
|
---|
| 135 |
|
---|
| 136 | iodelay32_ proc near
|
---|
| 137 | mov eax, DOSIODELAYCNT
|
---|
| 138 | align 4
|
---|
| 139 | @@: dec eax
|
---|
| 140 | jnz @b
|
---|
| 141 | loop iodelay32_
|
---|
| 142 | ret
|
---|
| 143 | iodelay32_ endp
|
---|
| 144 |
|
---|
| 145 | CODE32 ends
|
---|
| 146 |
|
---|
| 147 | end
|
---|