1 | ; $Id: RTR0Os2DHVMGlobalToProcess.asm 77120 2019-02-01 15:08:46Z 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-2019 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 | ;
|
---|
30 | ; This code is based on:
|
---|
31 | ;
|
---|
32 | ; Copyright (c) 2007 knut st. osmundsen <[email protected]>
|
---|
33 | ;
|
---|
34 | ; Permission is hereby granted, free of charge, to any person
|
---|
35 | ; obtaining a copy of this software and associated documentation
|
---|
36 | ; files (the "Software"), to deal in the Software without
|
---|
37 | ; restriction, including without limitation the rights to use,
|
---|
38 | ; copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
39 | ; copies of the Software, and to permit persons to whom the
|
---|
40 | ; Software is furnished to do so, subject to the following
|
---|
41 | ; conditions:
|
---|
42 | ;
|
---|
43 | ; The above copyright notice and this permission notice shall be
|
---|
44 | ; included in all copies or substantial portions of the Software.
|
---|
45 | ;
|
---|
46 | ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
47 | ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
48 | ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
49 | ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
50 | ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
51 | ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
52 | ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
53 | ; OTHER DEALINGS IN THE SOFTWARE.
|
---|
54 | ;
|
---|
55 |
|
---|
56 |
|
---|
57 | ;*******************************************************************************
|
---|
58 | ;* Header Files *
|
---|
59 | ;*******************************************************************************
|
---|
60 | %define RT_INCL_16BIT_SEGMENTS
|
---|
61 | %include "iprt/asmdefs.mac"
|
---|
62 | %include "iprt/err.mac"
|
---|
63 |
|
---|
64 |
|
---|
65 | ;*******************************************************************************
|
---|
66 | ;* External Symbols *
|
---|
67 | ;*******************************************************************************
|
---|
68 | extern KernThunkStackTo32
|
---|
69 | extern KernThunkStackTo16
|
---|
70 | extern NAME(g_fpfnDevHlp)
|
---|
71 |
|
---|
72 |
|
---|
73 | ;*******************************************************************************
|
---|
74 | ;* Defined Constants And Macros *
|
---|
75 | ;*******************************************************************************
|
---|
76 | %define DevHlp_VMGlobalToProcess 05ah
|
---|
77 |
|
---|
78 |
|
---|
79 | BEGINCODE
|
---|
80 |
|
---|
81 | ;;
|
---|
82 | ; VMGlobalToProcess wrapper.
|
---|
83 | ;
|
---|
84 | ; @param fFlags [ebp + 08h] Flags
|
---|
85 | ; @param pvR0 [ebp + 0ch] Ring-0 memory.
|
---|
86 | ; @param cb [ebp + 10h] Size of memory object to map.
|
---|
87 | ; @param ppR3 [ebp + 14h] Where to store the address of the ring-3 mapping.
|
---|
88 | ;
|
---|
89 | BEGINPROC_EXPORTED RTR0Os2DHVMGlobalToProcess
|
---|
90 | ; switch stack first.
|
---|
91 | call KernThunkStackTo16
|
---|
92 |
|
---|
93 | ; normal prolog.
|
---|
94 | push ebp
|
---|
95 | mov ebp, esp
|
---|
96 | push dword [NAME(g_fpfnDevHlp)] ; ebp - 4
|
---|
97 | push ebx ; save ebx
|
---|
98 |
|
---|
99 | ; setup the devhelp call
|
---|
100 | mov eax, [ebp + 08h] ; fFlags
|
---|
101 | mov ebx, [ebp + 0ch] ; pvR0
|
---|
102 | mov ecx, [ebp + 10h] ; cb
|
---|
103 | mov dl, DevHlp_VMGlobalToProcess
|
---|
104 |
|
---|
105 | ; jump to the 16-bit code.
|
---|
106 | ;jmp far dword NAME(RTR0Os2DHQueryDOSVar_16) wrt CODE16
|
---|
107 | db 066h
|
---|
108 | db 0eah
|
---|
109 | dw NAME(RTR0Os2DHVMGlobalToProcess_16) wrt CODE16
|
---|
110 | dw CODE16
|
---|
111 | BEGINCODE16
|
---|
112 | GLOBALNAME RTR0Os2DHVMGlobalToProcess_16
|
---|
113 | call far [ss:ebp - 4]
|
---|
114 |
|
---|
115 | ;jmp far dword NAME(RTR0Os2DHVMGlobalToProcess_32) wrt FLAT
|
---|
116 | db 066h
|
---|
117 | db 0eah
|
---|
118 | dd NAME(RTR0Os2DHVMGlobalToProcess_32) ;wrt FLAT
|
---|
119 | dw TEXT32 wrt FLAT
|
---|
120 | BEGINCODE
|
---|
121 | GLOBALNAME RTR0Os2DHVMGlobalToProcess_32
|
---|
122 | jc .done
|
---|
123 |
|
---|
124 | ; save the result.
|
---|
125 | mov edx, [ebp + 14h] ; ppvR3
|
---|
126 | mov [edx], eax
|
---|
127 | xor eax, eax
|
---|
128 |
|
---|
129 | .done:
|
---|
130 | pop ebx
|
---|
131 | leave
|
---|
132 |
|
---|
133 | ; switch stack back and return.
|
---|
134 | push eax
|
---|
135 | call KernThunkStackTo32
|
---|
136 | pop eax
|
---|
137 | ret
|
---|
138 | ENDPROC RTR0Os2DHVMGlobalToProcess
|
---|
139 |
|
---|