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