VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm@ 2988

Last change on this file since 2988 was 2988, checked in by vboxsync, 18 years ago

InnoTek -> innotek part 4: more miscellaneous files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.6 KB
Line 
1; $Id: RTR0Os2DHQueryDOSVar.asm 2988 2007-06-01 17:36:09Z vboxsync $
2;; @file
3; innotek Portable Runtime - DevHelp_GetDOSVar, Ring-0 Driver, OS/2.
4;
5
6;
7; Copyright (c) 1999-2007 knut st. osmundsen <[email protected]>
8;
9; Permission is hereby granted, free of charge, to any person
10; obtaining a copy of this software and associated documentation
11; files (the "Software"), to deal in the Software without
12; restriction, including without limitation the rights to use,
13; copy, modify, merge, publish, distribute, sublicense, and/or sell
14; copies of the Software, and to permit persons to whom the
15; Software is furnished to do so, subject to the following
16; conditions:
17;
18; The above copyright notice and this permission notice shall be
19; included in all copies or substantial portions of the Software.
20;
21; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28; OTHER DEALINGS IN THE SOFTWARE.
29;
30
31
32;*******************************************************************************
33;* Header Files *
34;*******************************************************************************
35%define RT_INCL_16BIT_SEGMENTS
36%include "iprt/asmdefs.mac"
37%include "iprt/err.mac"
38
39
40;*******************************************************************************
41;* External Symbols *
42;*******************************************************************************
43extern KernThunkStackTo32
44extern KernThunkStackTo16
45extern NAME(g_fpfnDevHlp)
46
47
48;*******************************************************************************
49;* Defined Constants And Macros *
50;*******************************************************************************
51%define DevHlp_GetDOSVar 24h
52
53
54BEGINCODE
55
56;
57; Jump table used by RTR0Os2DHQueryDOSVar
58;
59DosVarJumpTab:
60 dd 0 ; 0 - Reserved
61 dd Load1600 ; 1 - GIS
62 dd Load1616 ; 2 - LIS
63 dd 0 ; 3 - Reserved
64 dd Load1616 ; 4 - VectorSDF
65 dd Load1616 ; 5 - VectorReboot
66 dd Load1616 ; 6 - VectorMSATS
67 dd AsIs ; 7 - YieldFlag (Resched)
68 dd AsIs ; 8 - TCYieldFlag (TCResched)
69 dd AsIs ; 9 - DOSTable
70 dd Load1616 ; a - VectorDEKKO
71 dd AsIs ; b - CodePgBuff
72 dd Load1616 ; c - VectorRIPL
73 dd AsIs ; d - InterruptLevel
74 dd AsIs ; e - DevClassTables
75 dd AsIs ; f - DMQS_Sel
76 dd AsIs ;10 - APMInfo
77 dd LoadWord ;11 - APM_Length (length of above structure)
78DosVarJumpTabEnd:
79%define DosVarJumpTabSize (DosVarJumpTabEnd - DosVarJumpTab) / 4
80
81;;
82; Unified DevHelp_GetDOSVar -> Far 16:16 pointer wrapper.
83;
84; @param iVar [ebp + 08h] Variable.
85; @param iMember [ebp + 0ch] Member.
86; @param pfp [ebp + 10h] Where to store the variable address (pointer to 16:16).
87;
88BEGINPROC_EXPORTED RTR0Os2DHQueryDOSVar
89 ; switch stack first.
90 call KernThunkStackTo16
91
92 ; normal prolog.
93 push ebp
94 mov ebp, esp
95 push dword [NAME(g_fpfnDevHlp)] ; ebp - 4
96 push ebx ; save ebx
97 push es ; save es
98
99 ; setup the devhelp call and switch to
100 mov eax, [ebp + 08h] ; iVar (8-bit)
101 mov ecx, [ebp + 0ch] ; iMember (16-bit)
102 mov dl, DevHlp_GetDOSVar
103
104 ; jump to the 16-bit code.
105 ;jmp far dword NAME(RTR0Os2DHQueryDOSVar_16) wrt CODE16
106 db 066h
107 db 0eah
108 dw NAME(RTR0Os2DHQueryDOSVar_16) wrt CODE16
109 dw CODE16
110BEGINCODE16
111GLOBALNAME RTR0Os2DHQueryDOSVar_16
112 call far [ss:ebp - 4]
113
114 ;jmp far dword NAME(RTR0Os2DHQueryDOSVar) wrt FLAT
115 db 066h
116 db 0eah
117 dd NAME(RTR0Os2DHQueryDOSVar_32) ;wrt FLAT
118 dw TEXT32 wrt FLAT
119BEGINCODE
120GLOBALNAME RTR0Os2DHQueryDOSVar_32
121 jc Error1
122
123 ;
124 ; Make ax:ebx contain the pointer and take action according
125 ; to the variable jump table.
126 ;
127 and ebx, 0000ffffh ; clean high part of ebx
128 movzx ecx, byte [ebp + 08] ; iVar
129 cmp ecx, DosVarJumpTabSize
130 jg Error2
131 jmp [DosVarJumpTab + ecx * 4]
132
133 ; Load Word at ax:ebx.
134LoadWord:
135 mov es, ax
136 movzx edx, word [es:ebx]
137 jmp StoreIt
138
139 ; Load selector at ax:ebx.
140Load1600:
141 mov es, ax
142 movzx edx, word [es:ebx]
143 shl edx, 16
144 jmp StoreIt
145
146 ; Load 16:16 ptr at ax:ebx.
147Load1616:
148 mov es, ax
149 mov edx, dword [es:ebx]
150 jmp StoreIt
151
152 ; Move ax:bx into edx.
153AsIs:
154 mov dx, ax
155 shl edx, 16
156 mov dx, bx
157 jmp StoreIt
158
159Error2:
160 mov eax, VERR_INVALID_PARAMETER
161 jmp Done
162
163Error1:
164 mov eax, VERR_GENERAL_FAILURE
165 jmp Done
166
167StoreIt:
168 mov ecx, [ebp + 10h]
169 mov [ecx], edx
170 xor eax, eax ; return success (VINF_SUCCESS == 0)
171
172Done:
173 pop es
174 pop ebx
175 leave
176
177 ; switch stack back and return.
178 push eax
179 call KernThunkStackTo32
180 pop eax
181 ret
182ENDPROC RTR0Os2DHQueryDOSVar
183
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette