VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/win/SUPDrvA-win.asm@ 12000

Last change on this file since 12000 was 12000, checked in by vboxsync, 16 years ago

supdrv: Prototyped the fix for the PspGetSetContextInternal / RtlVirtualUnwind crashes on Vista64. (disabled)

File size: 5.7 KB
Line 
1; $Id$
2;; @file
3; VirtualBox Support Driver - Windows NT specific assembly parts.
4;
5
6;
7; Copyright (C) 2006-2007 Sun Microsystems, Inc.
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27; Clara, CA 95054 USA or visit http://www.sun.com if you need
28; additional information or have any questions.
29;
30
31;*******************************************************************************
32;* Header Files *
33;*******************************************************************************
34%include "iprt/asmdefs.mac"
35
36BEGINCODE
37%ifdef RT_ARCH_AMD64
38%define _DbgPrint DbgPrint
39%endif
40extern _DbgPrint
41
42;;
43; Kind of alias for DbgPrint
44BEGINPROC AssertMsg2
45 jmp _DbgPrint
46ENDPROC AssertMsg2
47
48;;
49; Kind of alias for DbgPrint
50BEGINPROC SUPR0Printf
51 jmp _DbgPrint
52ENDPROC SUPR0Printf
53
54
55%ifdef SUPDRV_WITH_UNWIND_HACK
56 %if 0 ; def RT_ARCH_AMD64
57;;
58; @cproto DECLASM(int) supdrvNtWrapVMMR0EntryEx(PFNRT pfnVMMR0EntryEx, PVM pVM, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession);
59;
60; @param pfnVMMR0EntryEx rcx
61; @param pVM rdx
62; @param uOperation r8
63; @param pReq r9
64; @param u64Arg [rsp + 28h] / [rbp + 30h]
65; @param pSession [rsp + 30h] / [rbp + 38h]
66;
67BEGINPROC supdrvNtWrapVMMR0EntryEx
68[proc_frame supdrvNtWrapVMMR0EntryEx]
69 push rbp
70 [pushreg rbp]
71 mov rbp, rsp
72 [setframe rbp,0]
73 sub rsp, 80h
74 [allocstack 0x80]
75 ;; @todo save more regs?
76[endprolog]
77
78 ;
79 ; Create a stack marker with the rbp. The marker is 32 byte big.
80 ; This is 32-byte aligned and 32 byte in size.
81 ;
82 lea r10, [rbp - 30h]
83 and r10, ~1fh ; 32-byte align it.
84 mov dword [r10 ], 0x20080901
85 mov dword [r10 + 4], 0x20080902
86 mov qword [r10 + 8], rbp
87 mov dword [r10 +16], 0x20080903
88 mov dword [r10 +20], 0x20080904
89 mov qword [r10 +24], rbp
90
91 ;
92 ; Forward the call.
93 ;
94 mov rax, rcx
95 mov rcx, rdx
96 mov rdx, r8
97 mov r8, r9
98 mov r9, [rbp + 30h]
99 mov r11, [rbp + 38h]
100 mov [rsp + 20h], r11
101 call rax
102
103 ;
104 ; Trash the stack marker.
105 ;
106 lea r10, [rbp - 30h]
107 and r10, ~1fh ; 32-byte align it.
108 mov qword [r10 ], rax
109 mov qword [r10 + 8], rax
110 mov qword [r10 +16], rax
111 mov qword [r10 +24], rax
112
113 leave
114 ret
115[endproc_frame supdrvNtWrapVMMR0EntryEx]
116ENDPROC supdrvNtWrapVMMR0EntryEx
117
118
119extern RTSemEventMultiWaitNoResume
120
121;;
122; @cproto DECLASM(int) supdrvNtWrapRTSemEventMultiWaitNoResume(RTSEMEVENTMULTI EventMultiSem, unsigned cMillies);
123;
124; @param EventMultiSem rcx
125; @param cMillies rdx
126;
127BEGINPROC supdrvNtWrapRTSemEventMultiWaitNoResume
128[proc_frame supdrvNtWrapRTSemEventMultiWaitNoResume]
129 push rbp
130 [pushreg rbp]
131 mov rbp, rsp
132 [setframe rbp,0]
133 sub rsp, 40h
134 [allocstack 0x40]
135 mov [rbp - 8h], rdi
136 [savereg rdi, 0x38]
137 ;; @todo save more?
138 ;mov [rbp - 10h], rsi
139 ;[savereg rsi, 0x30]
140[endprolog]
141
142 ;
143 ; Find the stack marker with the rbp of the entry frame.
144 ; Search a maximum of 4096 bytes.
145 ;
146 mov rax, rbp
147 and rax, ~1fh ; 32-byte align it.
148 mov r10, 1000h / 20h
149.again:
150 dec r10
151 jz .not_found
152 add rax, 20h
153
154 cmp dword [rax], 0x20080901
155 jne .again
156 cmp dword [rax + 4], 0x20080902
157 jne .again
158 cmp dword [rax + 16], 0x20080903
159 jne .again
160 cmp dword [rax + 20], 0x20080904
161 jne .again
162 mov r11, [rax + 8]
163 cmp r11, [rax + 24]
164 jne .again
165
166 ; found it, change rbp.
167 mov rdi, rbp
168 mov rbp, r11
169
170 ;
171 ; Forward the call.
172 ;
173.resume:
174 call RTSemEventMultiWaitNoResume
175
176 ;
177 ; Restore rbp and any saved registers before returning.
178 ;
179 mov rbp, rdi
180 ;mov rsi, [rbp - 10h]
181 mov rdi, [rbp - 8h]
182 leave
183 ret
184
185.not_found:
186 int3
187 mov rdi, rbp
188 jmp .resume
189[endproc_frame supdrvNtWrapRTSemEventMultiWaitNoResume]
190ENDPROC supdrvNtWrapRTSemEventMultiWaitNoResume
191
192 %endif ; RT_ARCH_AMD64
193%endif ; SUPDRV_WITH_UNWIND_HACK
194
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