1 | ; $Id: RTR0Os2DHVMGlobalToProcess.asm 8256 2008-04-21 20:53:28Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - DevHelp_VMGlobalToProcess, Ring-0 Driver, OS/2.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net>
|
---|
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 | ;*******************************************************************************
|
---|
43 | extern KernThunkStackTo32
|
---|
44 | extern KernThunkStackTo16
|
---|
45 | extern NAME(g_fpfnDevHlp)
|
---|
46 |
|
---|
47 |
|
---|
48 | ;*******************************************************************************
|
---|
49 | ;* Defined Constants And Macros *
|
---|
50 | ;*******************************************************************************
|
---|
51 | %define DevHlp_VMGlobalToProcess 05ah
|
---|
52 |
|
---|
53 |
|
---|
54 | BEGINCODE
|
---|
55 |
|
---|
56 | ;;
|
---|
57 | ; VMGlobalToProcess wrapper.
|
---|
58 | ;
|
---|
59 | ; @param fFlags [ebp + 08h] Flags
|
---|
60 | ; @param pvR0 [ebp + 0ch] Ring-0 memory.
|
---|
61 | ; @param cb [ebp + 10h] Size of memory object to map.
|
---|
62 | ; @param ppR3 [ebp + 14h] Where to store the address of the ring-3 mapping.
|
---|
63 | ;
|
---|
64 | BEGINPROC_EXPORTED RTR0Os2DHVMGlobalToProcess
|
---|
65 | ; switch stack first.
|
---|
66 | call KernThunkStackTo16
|
---|
67 |
|
---|
68 | ; normal prolog.
|
---|
69 | push ebp
|
---|
70 | mov ebp, esp
|
---|
71 | push dword [NAME(g_fpfnDevHlp)] ; ebp - 4
|
---|
72 | push ebx ; save ebx
|
---|
73 |
|
---|
74 | ; setup the devhelp call
|
---|
75 | mov eax, [ebp + 08h] ; fFlags
|
---|
76 | mov ebx, [ebp + 0ch] ; pvR0
|
---|
77 | mov ecx, [ebp + 10h] ; cb
|
---|
78 | mov dl, DevHlp_VMGlobalToProcess
|
---|
79 |
|
---|
80 | ; jump to the 16-bit code.
|
---|
81 | ;jmp far dword NAME(RTR0Os2DHQueryDOSVar_16) wrt CODE16
|
---|
82 | db 066h
|
---|
83 | db 0eah
|
---|
84 | dw NAME(RTR0Os2DHVMGlobalToProcess_16) wrt CODE16
|
---|
85 | dw CODE16
|
---|
86 | BEGINCODE16
|
---|
87 | GLOBALNAME RTR0Os2DHVMGlobalToProcess_16
|
---|
88 | call far [ss:ebp - 4]
|
---|
89 |
|
---|
90 | ;jmp far dword NAME(RTR0Os2DHVMGlobalToProcess_32) wrt FLAT
|
---|
91 | db 066h
|
---|
92 | db 0eah
|
---|
93 | dd NAME(RTR0Os2DHVMGlobalToProcess_32) ;wrt FLAT
|
---|
94 | dw TEXT32 wrt FLAT
|
---|
95 | BEGINCODE
|
---|
96 | GLOBALNAME RTR0Os2DHVMGlobalToProcess_32
|
---|
97 | jc .done
|
---|
98 |
|
---|
99 | ; save the result.
|
---|
100 | mov edx, [ebp + 14h] ; ppvR3
|
---|
101 | mov [edx], eax
|
---|
102 | xor eax, eax
|
---|
103 |
|
---|
104 | .done:
|
---|
105 | pop ebx
|
---|
106 | leave
|
---|
107 |
|
---|
108 | ; switch stack back and return.
|
---|
109 | push eax
|
---|
110 | call KernThunkStackTo32
|
---|
111 | pop eax
|
---|
112 | ret
|
---|
113 | ENDPROC RTR0Os2DHVMGlobalToProcess
|
---|
114 |
|
---|