1 | ; $Id: RTR0Os2DHVMGlobalToProcess.asm 96407 2022-08-22 17:43:14Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - DevHelp_VMGlobalToProcess, Ring-0 Driver, OS/2.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Contributed by knut st. osmundsen.
|
---|
8 | ;
|
---|
9 | ; Copyright (C) 2007-2022 Oracle and/or its affiliates.
|
---|
10 | ;
|
---|
11 | ; This file is part of VirtualBox base platform packages, as
|
---|
12 | ; available from https://www.virtualbox.org.
|
---|
13 | ;
|
---|
14 | ; This program is free software; you can redistribute it and/or
|
---|
15 | ; modify it under the terms of the GNU General Public License
|
---|
16 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
17 | ; License.
|
---|
18 | ;
|
---|
19 | ; This program is distributed in the hope that it will be useful, but
|
---|
20 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
22 | ; General Public License for more details.
|
---|
23 | ;
|
---|
24 | ; You should have received a copy of the GNU General Public License
|
---|
25 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
26 | ;
|
---|
27 | ; The contents of this file may alternatively be used under the terms
|
---|
28 | ; of the Common Development and Distribution License Version 1.0
|
---|
29 | ; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
30 | ; in the VirtualBox distribution, in which case the provisions of the
|
---|
31 | ; CDDL are applicable instead of those of the GPL.
|
---|
32 | ;
|
---|
33 | ; You may elect to license modified versions of this file under the
|
---|
34 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
35 | ;
|
---|
36 | ; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
37 | ; --------------------------------------------------------------------
|
---|
38 | ;
|
---|
39 | ; This code is based on:
|
---|
40 | ;
|
---|
41 | ; Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net>
|
---|
42 | ;
|
---|
43 | ; Permission is hereby granted, free of charge, to any person
|
---|
44 | ; obtaining a copy of this software and associated documentation
|
---|
45 | ; files (the "Software"), to deal in the Software without
|
---|
46 | ; restriction, including without limitation the rights to use,
|
---|
47 | ; copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
48 | ; copies of the Software, and to permit persons to whom the
|
---|
49 | ; Software is furnished to do so, subject to the following
|
---|
50 | ; conditions:
|
---|
51 | ;
|
---|
52 | ; The above copyright notice and this permission notice shall be
|
---|
53 | ; included in all copies or substantial portions of the Software.
|
---|
54 | ;
|
---|
55 | ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
56 | ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
57 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
58 | ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
59 | ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
60 | ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
61 | ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
62 | ; OTHER DEALINGS IN THE SOFTWARE.
|
---|
63 | ;
|
---|
64 |
|
---|
65 |
|
---|
66 | ;*******************************************************************************
|
---|
67 | ;* Header Files *
|
---|
68 | ;*******************************************************************************
|
---|
69 | %define RT_INCL_16BIT_SEGMENTS
|
---|
70 | %include "iprt/asmdefs.mac"
|
---|
71 | %include "iprt/err.mac"
|
---|
72 |
|
---|
73 |
|
---|
74 | ;*******************************************************************************
|
---|
75 | ;* External Symbols *
|
---|
76 | ;*******************************************************************************
|
---|
77 | extern KernThunkStackTo32
|
---|
78 | extern KernThunkStackTo16
|
---|
79 | extern NAME(g_fpfnDevHlp)
|
---|
80 |
|
---|
81 |
|
---|
82 | ;*******************************************************************************
|
---|
83 | ;* Defined Constants And Macros *
|
---|
84 | ;*******************************************************************************
|
---|
85 | %define DevHlp_VMGlobalToProcess 05ah
|
---|
86 |
|
---|
87 |
|
---|
88 | BEGINCODE
|
---|
89 |
|
---|
90 | ;;
|
---|
91 | ; VMGlobalToProcess wrapper.
|
---|
92 | ;
|
---|
93 | ; @param fFlags [ebp + 08h] Flags
|
---|
94 | ; @param pvR0 [ebp + 0ch] Ring-0 memory.
|
---|
95 | ; @param cb [ebp + 10h] Size of memory object to map.
|
---|
96 | ; @param ppR3 [ebp + 14h] Where to store the address of the ring-3 mapping.
|
---|
97 | ;
|
---|
98 | BEGINPROC_EXPORTED RTR0Os2DHVMGlobalToProcess
|
---|
99 | ; switch stack first.
|
---|
100 | call KernThunkStackTo16
|
---|
101 |
|
---|
102 | ; normal prolog.
|
---|
103 | push ebp
|
---|
104 | mov ebp, esp
|
---|
105 | push dword [NAME(g_fpfnDevHlp)] ; ebp - 4
|
---|
106 | push ebx ; save ebx
|
---|
107 |
|
---|
108 | ; setup the devhelp call
|
---|
109 | mov eax, [ebp + 08h] ; fFlags
|
---|
110 | mov ebx, [ebp + 0ch] ; pvR0
|
---|
111 | mov ecx, [ebp + 10h] ; cb
|
---|
112 | mov dl, DevHlp_VMGlobalToProcess
|
---|
113 |
|
---|
114 | ; jump to the 16-bit code.
|
---|
115 | ;jmp far dword NAME(RTR0Os2DHQueryDOSVar_16) wrt CODE16
|
---|
116 | db 066h
|
---|
117 | db 0eah
|
---|
118 | dw NAME(RTR0Os2DHVMGlobalToProcess_16) wrt CODE16
|
---|
119 | dw CODE16
|
---|
120 | BEGINCODE16
|
---|
121 | GLOBALNAME RTR0Os2DHVMGlobalToProcess_16
|
---|
122 | call far [ss:ebp - 4]
|
---|
123 |
|
---|
124 | ;jmp far dword NAME(RTR0Os2DHVMGlobalToProcess_32) wrt FLAT
|
---|
125 | db 066h
|
---|
126 | db 0eah
|
---|
127 | dd NAME(RTR0Os2DHVMGlobalToProcess_32) ;wrt FLAT
|
---|
128 | dw TEXT32 wrt FLAT
|
---|
129 | BEGINCODE
|
---|
130 | GLOBALNAME RTR0Os2DHVMGlobalToProcess_32
|
---|
131 | jc .done
|
---|
132 |
|
---|
133 | ; save the result.
|
---|
134 | mov edx, [ebp + 14h] ; ppvR3
|
---|
135 | mov [edx], eax
|
---|
136 | xor eax, eax
|
---|
137 |
|
---|
138 | .done:
|
---|
139 | pop ebx
|
---|
140 | leave
|
---|
141 |
|
---|
142 | ; switch stack back and return.
|
---|
143 | push eax
|
---|
144 | call KernThunkStackTo32
|
---|
145 | pop eax
|
---|
146 | ret
|
---|
147 | ENDPROC RTR0Os2DHVMGlobalToProcess
|
---|
148 |
|
---|