1 | ; $Id: SUPDrvA-win.asm 51958 2014-07-09 14:44:39Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; VirtualBox Support Driver - Windows NT specific assembly parts.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2014 Oracle Corporation
|
---|
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 |
|
---|
27 | ;*******************************************************************************
|
---|
28 | ;* Header Files *
|
---|
29 | ;*******************************************************************************
|
---|
30 | %include "iprt/asmdefs.mac"
|
---|
31 |
|
---|
32 | BEGINCODE
|
---|
33 | %ifdef RT_ARCH_AMD64
|
---|
34 | %define _DbgPrint DbgPrint
|
---|
35 | %endif
|
---|
36 | extern _DbgPrint
|
---|
37 |
|
---|
38 | %if 1 ; see alternative in SUPDrv-win.cpp
|
---|
39 | ;;
|
---|
40 | ; Kind of alias for DbgPrint
|
---|
41 | export NAME(SUPR0Printf)
|
---|
42 | BEGINPROC SUPR0Printf
|
---|
43 | jmp _DbgPrint
|
---|
44 | ENDPROC SUPR0Printf
|
---|
45 | %endif
|
---|
46 |
|
---|
47 |
|
---|
48 | %ifdef VBOX_WITH_HARDENING
|
---|
49 |
|
---|
50 | %ifdef RT_ARCH_X86
|
---|
51 | ;
|
---|
52 | ; Faking up ZwQueryVirtualMemory on XP and W2K3 where it's not exported.
|
---|
53 | ; Using ZwOpenFile as a helper as it has the name number of parameters.
|
---|
54 | ;
|
---|
55 | extern IMPNAME(ZwOpenFile@24)
|
---|
56 |
|
---|
57 | BEGINPROC supdrvNtQueryVirtualMemory_Xxx
|
---|
58 | %macro NtQueryVirtualMemorySyscall 1
|
---|
59 | GLOBALNAME supdrvNtQueryVirtualMemory_ %+ %1
|
---|
60 | mov eax, %1
|
---|
61 | jmp supdrvNtQueryVirtualMemory_Jump
|
---|
62 | %endm
|
---|
63 | NtQueryVirtualMemorySyscall 0xAF
|
---|
64 | NtQueryVirtualMemorySyscall 0xB0
|
---|
65 | NtQueryVirtualMemorySyscall 0xB1
|
---|
66 | NtQueryVirtualMemorySyscall 0xB2
|
---|
67 | NtQueryVirtualMemorySyscall 0xB3
|
---|
68 | NtQueryVirtualMemorySyscall 0xB4
|
---|
69 | NtQueryVirtualMemorySyscall 0xB5
|
---|
70 | NtQueryVirtualMemorySyscall 0xB6
|
---|
71 | NtQueryVirtualMemorySyscall 0xB7
|
---|
72 | NtQueryVirtualMemorySyscall 0xB8
|
---|
73 | NtQueryVirtualMemorySyscall 0xB9
|
---|
74 | NtQueryVirtualMemorySyscall 0xBA
|
---|
75 | NtQueryVirtualMemorySyscall 0xBB
|
---|
76 | NtQueryVirtualMemorySyscall 0xBC
|
---|
77 | NtQueryVirtualMemorySyscall 0xBD
|
---|
78 | NtQueryVirtualMemorySyscall 0xBE
|
---|
79 |
|
---|
80 | supdrvNtQueryVirtualMemory_Jump:
|
---|
81 | mov edx, IMP2(ZwOpenFile@24)
|
---|
82 | lea edx, [edx + 5]
|
---|
83 | jmp edx
|
---|
84 | ENDPROC supdrvNtQueryVirtualMemory_Xxx
|
---|
85 |
|
---|
86 | %endif
|
---|
87 |
|
---|
88 | %ifdef RT_ARCH_AMD64
|
---|
89 | ;
|
---|
90 | ; Faking up ZwQueryVirtualMemory on XP64 and W2K3-64 where it's not exported.
|
---|
91 | ; The C code locates and verifies the essentials in ZwRequestWaitReplyPort.
|
---|
92 | ;
|
---|
93 | extern NAME(g_pfnKiServiceLinkage)
|
---|
94 | extern NAME(g_pfnKiServiceInternal)
|
---|
95 | BEGINPROC supdrvNtQueryVirtualMemory_Xxx
|
---|
96 | %macro NtQueryVirtualMemorySyscall 1
|
---|
97 | GLOBALNAME supdrvNtQueryVirtualMemory_ %+ %1
|
---|
98 | mov eax, %1
|
---|
99 | jmp supdrvNtQueryVirtualMemory_Jump
|
---|
100 | %endm
|
---|
101 |
|
---|
102 | NtQueryVirtualMemorySyscall 0x1F
|
---|
103 | NtQueryVirtualMemorySyscall 0x20
|
---|
104 | NtQueryVirtualMemorySyscall 0x21
|
---|
105 | NtQueryVirtualMemorySyscall 0x22
|
---|
106 | NtQueryVirtualMemorySyscall 0x23
|
---|
107 |
|
---|
108 | supdrvNtQueryVirtualMemory_Jump:
|
---|
109 | cli
|
---|
110 | mov r10, rsp ; save call frame pointer.
|
---|
111 | mov r11, [NAME(g_pfnKiServiceLinkage) wrt rip]
|
---|
112 | push 0
|
---|
113 | push 0
|
---|
114 | push r10 ; call frame pointer (incoming rsp).
|
---|
115 | pushfq
|
---|
116 | push 10h
|
---|
117 | push r11 ; r11 = KiServiceLinkage (ret w/ unwind info)
|
---|
118 | jmp qword [NAME(g_pfnKiServiceInternal) wrt rip]
|
---|
119 | ENDPROC supdrvNtQueryVirtualMemory_Xxx
|
---|
120 | %endif
|
---|
121 |
|
---|
122 | %endif ; VBOX_WITH_HARDENING
|
---|
123 |
|
---|