VirtualBox

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

Last change on this file since 85505 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

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