VirtualBox

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

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

SUP: SUPR0PageProtect & SUPR0PageProtect - for creating guard (hyper) heap/stack pages.

  • Property svn:eol-style set to native
File size: 16.0 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/ntwrap.mac"
35
36BEGINCODE
37%ifdef RT_ARCH_AMD64
38%define _DbgPrint DbgPrint
39%endif
40extern _DbgPrint
41
42%if 1 ; see alternative in SUPDrv-win.cpp
43;;
44; Kind of alias for DbgPrint
45BEGINPROC SUPR0Printf
46 jmp _DbgPrint
47ENDPROC SUPR0Printf
48%endif
49
50
51%ifdef RT_WITH_W64_UNWIND_HACK
52 %ifdef RT_ARCH_AMD64
53
54;
55; This has the same order as the list in SUPDrv.c
56;
57NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0ComponentRegisterFactory
58NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0ComponentDeregisterFactory
59NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0ComponentQueryFactory
60NtWrapDyn2DrvFunctionWith5Params supdrvNtWrap, SUPR0ObjRegister
61NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0ObjAddRef
62NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0ObjAddRefEx
63NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0ObjRelease
64NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0ObjVerifyAccess
65NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0LockMem
66NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0UnlockMem
67NtWrapDyn2DrvFunctionWith5Params supdrvNtWrap, SUPR0ContAlloc
68NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0ContFree
69NtWrapDyn2DrvFunctionWith5Params supdrvNtWrap, SUPR0LowAlloc
70NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0LowFree
71NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0MemAlloc
72NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0MemGetPhys
73NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0MemFree
74NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0PageAlloc
75NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0PageFree
76;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0Printf - cannot wrap this buster.
77NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventCreate
78NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventClose
79NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventSignal
80NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventWait
81NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventWaitNoResume
82NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventMultiCreate
83NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventMultiClose
84NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventMultiSignal
85NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventMultiReset
86NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventMultiWait
87NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPSemEventMultiWaitNoResume
88NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0GetPagingMode
89NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMemAlloc
90NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMemAllocZ
91NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMemFree
92NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMemDup
93NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMemDupEx
94NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMemRealloc
95NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjAllocLow
96NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjAllocPage
97NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjAllocPhys
98NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjAllocPhysNC
99NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjAllocCont
100NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjEnterPhys
101NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjLockUser
102NtWrapDyn2DrvFunctionWith5Params supdrvNtWrap, RTR0MemObjMapKernel
103NtWrapDyn2DrvFunctionWith7Params supdrvNtWrap, RTR0MemObjMapKernelEx
104NtWrapDyn2DrvFunctionWith6Params supdrvNtWrap, RTR0MemObjMapUser
105NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjProtect
106;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjAddress - not necessary
107;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjAddressR3 - not necessary
108;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjSize - not necessary
109;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjIsMapping - not necessary
110;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjGetPagePhysAddr - not necessary
111NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0MemObjFree
112;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTProcSelf - not necessary
113;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTR0ProcHandleSelf - not necessary
114NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemFastMutexCreate
115NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemFastMutexDestroy
116NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemFastMutexRequest
117NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemFastMutexRelease
118NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventCreate
119NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventSignal
120NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventWait
121NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventWaitNoResume
122NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventDestroy
123NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventMultiCreate
124NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventMultiSignal
125NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventMultiReset
126NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventMultiWait
127NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventMultiWaitNoResume
128NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSemEventMultiDestroy
129NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSpinlockCreate
130NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSpinlockDestroy
131NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSpinlockAcquire
132NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSpinlockRelease
133NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSpinlockAcquireNoInts
134NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTSpinlockReleaseNoInts
135;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTTimeNanoTS - not necessary
136;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTTimeMilliTS - not necessary
137;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTTimeSystemNanoTS - not necessary
138;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTTimeSystemMilliTS - not necessary
139;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadNativeSelf - not necessary
140NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadSleep
141NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadYield
142%if 0 ; Thread APIs, Part 2
143;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadSelf
144NtWrapDyn2DrvFunctionWith7Params supdrvNtWrap, RTThreadCreate
145NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadGetNative
146NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadWait
147NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadWaitNoResume
148NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadGetName
149NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadSelfName
150NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadGetType
151NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadUserSignal
152NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadUserReset
153NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadUserWait
154NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadUserWaitNoResume
155%endif
156;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadPreemptIsEnabled - not necessary
157;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadPreemptIsPending - not necessary
158;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadPreemptIsPendingTrusty - not necessary
159;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadPreemptDisable - not necessary
160NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTThreadPreemptRestore
161;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTLogDefaultInstance - a bit of a gamble, but we do not want the overhead!
162;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpCpuId - not necessary
163;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpCpuIdFromSetIndex - not necessary
164;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpCpuIdToSetIndex - not necessary
165;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpIsCpuPossible - not necessary
166;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpGetCount - not necessary
167;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpGetMaxCpuId - not necessary
168;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpGetOnlineCount - not necessary
169;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpGetOnlineSet - not necessary
170;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpGetSet - not necessary
171;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpIsCpuOnline - not necessary
172NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpIsCpuWorkPending
173NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpOnAll
174NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpOnOthers
175NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpOnSpecific
176NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTMpPokeCpu
177;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTLogRelDefaultInstance - not necessary.
178NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTLogSetDefaultInstanceThread
179;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTLogLogger - can't wrap this buster.
180;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTLogLoggerEx - can't wrap this buster.
181NtWrapDyn2DrvFunctionWith5Params supdrvNtWrap, RTLogLoggerExV
182;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTLogPrintf - can't wrap this buster. ;; @todo provide va_list log wrappers in RuntimeR0.
183NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, RTLogPrintfV
184NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, AssertMsg1
185;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, AssertMsg2 - can't wrap this buster.
186NtWrapDrv2DynFunctionWithAllRegParams supdrvNtWrap, RTPowerSignalEvent
187
188
189;;
190; @cproto DECLASM(int) supdrvNtWrapVMMR0EntryEx(PFNRT pfnVMMR0EntryEx, PVM pVM, unsigned idCpu, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession);
191;
192; @param pfnVMMR0EntryEx rcx
193; @param pVM rdx
194; @param idCpu r8
195; @param uOperation r9
196; @param pReq [rsp + 28h] / [rbp + 30h]
197; @param u64Arg [rsp + 30h] / [rbp + 38h]
198; @param pSession [rsp + 38h] / [rbp + 40h]
199;
200BEGINPROC supdrvNtWrapVMMR0EntryEx
201 NtWrapProlog supdrvNtWrapVMMR0EntryEx
202 NtWrapCreateMarker
203
204 mov rax, rcx
205 mov rcx, rdx
206 mov rdx, r8
207 mov r8, r9
208 mov r9, [rbp + 30h]
209 mov r11, [rbp + 38h]
210 mov [rsp + 20h], r11
211 mov r11, [rbp + 40h]
212 mov [rsp + 28h], r11
213 call rax
214
215 NtWrapDestroyMarker
216 NtWrapEpilog supdrvNtWrapVMMR0EntryEx
217ENDPROC supdrvNtWrapVMMR0EntryEx
218
219
220;;
221; @cproto DECLASM(int) supdrvNtWrapVMMR0EntryFast(PFNRT pfnVMMR0EntryFast, PVM pVM, unsigned idCPU, unsigned uOperation);
222;
223; @param pfnVMMR0EntryFast rcx
224; @param pVM rdx
225; @param idCPU r8
226; @param uOperation r9
227;
228BEGINPROC supdrvNtWrapVMMR0EntryFast
229 NtWrapProlog supdrvNtWrapVMMR0EntryFast
230 NtWrapCreateMarker
231
232 mov rax, rcx
233 mov rcx, rdx
234 mov rdx, r8
235 mov r8, r9
236 call rax
237
238 NtWrapDestroyMarker
239 NtWrapEpilog supdrvNtWrapVMMR0EntryFast
240ENDPROC supdrvNtWrapVMMR0EntryFast
241
242
243;;
244; @cproto DECLASM(void) supdrvNtWrapObjDestructor(PFNRT pfnDestruction, void *pvObj, void *pvUser1, void *pvUser2);
245;
246; @param pfnDestruction rcx
247; @param pvObj rdx
248; @param pvUser1 r8
249; @param pvUser2 r9
250;
251BEGINPROC supdrvNtWrapObjDestructor
252 NtWrapProlog supdrvNtWrapObjDestructor
253 NtWrapCreateMarker
254
255 mov rax, rcx
256 mov rcx, rdx
257 mov rdx, r8
258 mov r8, r9
259 call rax
260
261 NtWrapDestroyMarker
262 NtWrapEpilog supdrvNtWrapObjDestructor
263ENDPROC supdrvNtWrapObjDestructor
264
265
266;;
267; @cproto DECLASM(void *) supdrvNtWrapQueryFactoryInterface(PFNRT pfnQueryFactoryInterface, struct SUPDRVFACTORY const *pSupDrvFactory,
268; PSUPDRVSESSION pSession, const char *pszInterfaceUuid);
269;
270; @param pfnQueryFactoryInterface rcx
271; @param pSupDrvFactory rdx
272; @param pSession r8
273; @param pszInterfaceUuid r9
274;
275BEGINPROC supdrvNtWrapQueryFactoryInterface
276 NtWrapProlog supdrvNtWrapQueryFactoryInterface
277 NtWrapCreateMarker
278
279 mov rax, rcx
280 mov rcx, rdx
281 mov rdx, r8
282 mov r8, r9
283 call rax
284
285 NtWrapDestroyMarker
286 NtWrapEpilog supdrvNtWrapQueryFactoryInterface
287ENDPROC supdrvNtWrapQueryFactoryInterface
288
289
290;;
291; @cproto DECLASM(int) supdrvNtWrapModuleInit(PFNRT pfnModuleInit);
292;
293; @param pfnModuleInit rcx
294;
295BEGINPROC supdrvNtWrapModuleInit
296 NtWrapProlog supdrvNtWrapModuleInit
297 NtWrapCreateMarker
298
299 call rcx
300
301 NtWrapDestroyMarker
302 NtWrapEpilog supdrvNtWrapModuleInit
303ENDPROC supdrvNtWrapModuleInit
304
305
306;;
307; @cproto DECLASM(void) supdrvNtWrapModuleTerm(PFNRT pfnModuleTerm);
308;
309; @param pfnModuleInit rcx
310;
311BEGINPROC supdrvNtWrapModuleTerm
312 NtWrapProlog supdrvNtWrapModuleTerm
313 NtWrapCreateMarker
314
315 call rcx
316
317 NtWrapDestroyMarker
318 NtWrapEpilog supdrvNtWrapModuleTerm
319ENDPROC supdrvNtWrapModuleTerm
320
321
322;;
323; @cproto DECLASM(int) supdrvNtWrapServiceReqHandler(PFNRT pfnServiceReqHandler, PSUPDRVSESSION pSession, uint32_t uOperation, uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr);
324;
325; @param pfnSerivceReqHandler rcx
326; @param pSession rdx
327; @param uOperation r8
328; @param u64Arg r9
329; @param pReq [rsp + 28h] / [rbp + 30h]
330;
331BEGINPROC supdrvNtWrapServiceReqHandler
332 NtWrapProlog supdrvNtWrapServiceReqHandler
333 NtWrapCreateMarker
334
335 mov rax, rcx
336 mov rcx, rdx
337 mov rdx, r8
338 mov r8, r9
339 mov r9, [rbp + 30h]
340 call rax
341
342 NtWrapDestroyMarker
343 NtWrapEpilog supdrvNtWrapServiceReqHandler
344ENDPROC supdrvNtWrapServiceReqHandler
345
346
347 %endif ; RT_ARCH_AMD64
348%endif ; RT_WITH_W64_UNWIND_HACK
349
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