1 | /** @file
|
---|
2 | * HM - SVM (AMD-V) Structures and Definitions. (VMM)
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2015 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vmm_svm_h
|
---|
27 | #define ___VBox_vmm_svm_h
|
---|
28 |
|
---|
29 | #include <VBox/types.h>
|
---|
30 | #include <VBox/err.h>
|
---|
31 | #include <iprt/assert.h>
|
---|
32 | #include <iprt/asm.h>
|
---|
33 |
|
---|
34 |
|
---|
35 | /** @defgroup grp_hm_svm SVM (AMD-V) Types and Definitions
|
---|
36 | * @ingroup grp_hm
|
---|
37 | * @{
|
---|
38 | */
|
---|
39 |
|
---|
40 | /** @name SVM features for cpuid 0x8000000a
|
---|
41 | * @{
|
---|
42 | */
|
---|
43 | /** Bit 0 - NP - Nested Paging supported. */
|
---|
44 | #define AMD_CPUID_SVM_FEATURE_EDX_NESTED_PAGING RT_BIT(0)
|
---|
45 | /** Bit 1 - LbrVirt - Support for saving five debug MSRs. */
|
---|
46 | #define AMD_CPUID_SVM_FEATURE_EDX_LBR_VIRT RT_BIT(1)
|
---|
47 | /** Bit 2 - SVML - SVM locking bit supported. */
|
---|
48 | #define AMD_CPUID_SVM_FEATURE_EDX_SVM_LOCK RT_BIT(2)
|
---|
49 | /** Bit 3 - NRIPS - Saving the next instruction pointer is supported. */
|
---|
50 | #define AMD_CPUID_SVM_FEATURE_EDX_NRIP_SAVE RT_BIT(3)
|
---|
51 | /** Bit 4 - TscRateMsr - Support for MSR TSC ratio. */
|
---|
52 | #define AMD_CPUID_SVM_FEATURE_EDX_TSC_RATE_MSR RT_BIT(4)
|
---|
53 | /** Bit 5 - VmcbClean - Support VMCB clean bits. */
|
---|
54 | #define AMD_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN RT_BIT(5)
|
---|
55 | /** Bit 6 - FlushByAsid - Indicate TLB flushing for current ASID only, and that
|
---|
56 | * VMCB.TLB_Control is supported. */
|
---|
57 | #define AMD_CPUID_SVM_FEATURE_EDX_FLUSH_BY_ASID RT_BIT(6)
|
---|
58 | /** Bit 7 - DecodeAssist - Indicate decode assist is supported. */
|
---|
59 | #define AMD_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST RT_BIT(7)
|
---|
60 | /** Bit 10 - PauseFilter - Indicates support for the PAUSE intercept filter. */
|
---|
61 | #define AMD_CPUID_SVM_FEATURE_EDX_PAUSE_FILTER RT_BIT(10)
|
---|
62 | /** Bit 12 - PauseFilterThreshold - Indicates support for the PAUSE
|
---|
63 | * intercept filter cycle count threshold. */
|
---|
64 | #define AMD_CPUID_SVM_FEATURE_EDX_PAUSE_FILTER_THRESHOLD RT_BIT(12)
|
---|
65 | /** Bit 13 - AVIC - Advanced Virtual Interrupt Controller. */
|
---|
66 | #define AMD_CPUID_SVM_FEATURE_EDX_AVIC RT_BIT(13)
|
---|
67 | /** @} */
|
---|
68 |
|
---|
69 |
|
---|
70 | /** @name SVM Basic Exit Reasons.
|
---|
71 | * @{
|
---|
72 | */
|
---|
73 | /** Invalid guest state in VMCB. */
|
---|
74 | #define SVM_EXIT_INVALID (-1)
|
---|
75 | /** Read from CR0-CR15. */
|
---|
76 | #define SVM_EXIT_READ_CR0 0x0
|
---|
77 | #define SVM_EXIT_READ_CR1 0x1
|
---|
78 | #define SVM_EXIT_READ_CR2 0x2
|
---|
79 | #define SVM_EXIT_READ_CR3 0x3
|
---|
80 | #define SVM_EXIT_READ_CR4 0x4
|
---|
81 | #define SVM_EXIT_READ_CR5 0x5
|
---|
82 | #define SVM_EXIT_READ_CR6 0x6
|
---|
83 | #define SVM_EXIT_READ_CR7 0x7
|
---|
84 | #define SVM_EXIT_READ_CR8 0x8
|
---|
85 | #define SVM_EXIT_READ_CR9 0x9
|
---|
86 | #define SVM_EXIT_READ_CR10 0xA
|
---|
87 | #define SVM_EXIT_READ_CR11 0xB
|
---|
88 | #define SVM_EXIT_READ_CR12 0xC
|
---|
89 | #define SVM_EXIT_READ_CR13 0xD
|
---|
90 | #define SVM_EXIT_READ_CR14 0xE
|
---|
91 | #define SVM_EXIT_READ_CR15 0xF
|
---|
92 | /** Writes to CR0-CR15. */
|
---|
93 | #define SVM_EXIT_WRITE_CR0 0x10
|
---|
94 | #define SVM_EXIT_WRITE_CR1 0x11
|
---|
95 | #define SVM_EXIT_WRITE_CR2 0x12
|
---|
96 | #define SVM_EXIT_WRITE_CR3 0x13
|
---|
97 | #define SVM_EXIT_WRITE_CR4 0x14
|
---|
98 | #define SVM_EXIT_WRITE_CR5 0x15
|
---|
99 | #define SVM_EXIT_WRITE_CR6 0x16
|
---|
100 | #define SVM_EXIT_WRITE_CR7 0x17
|
---|
101 | #define SVM_EXIT_WRITE_CR8 0x18
|
---|
102 | #define SVM_EXIT_WRITE_CR9 0x19
|
---|
103 | #define SVM_EXIT_WRITE_CR10 0x1A
|
---|
104 | #define SVM_EXIT_WRITE_CR11 0x1B
|
---|
105 | #define SVM_EXIT_WRITE_CR12 0x1C
|
---|
106 | #define SVM_EXIT_WRITE_CR13 0x1D
|
---|
107 | #define SVM_EXIT_WRITE_CR14 0x1E
|
---|
108 | #define SVM_EXIT_WRITE_CR15 0x1F
|
---|
109 | /** Read from DR0-DR15. */
|
---|
110 | #define SVM_EXIT_READ_DR0 0x20
|
---|
111 | #define SVM_EXIT_READ_DR1 0x21
|
---|
112 | #define SVM_EXIT_READ_DR2 0x22
|
---|
113 | #define SVM_EXIT_READ_DR3 0x23
|
---|
114 | #define SVM_EXIT_READ_DR4 0x24
|
---|
115 | #define SVM_EXIT_READ_DR5 0x25
|
---|
116 | #define SVM_EXIT_READ_DR6 0x26
|
---|
117 | #define SVM_EXIT_READ_DR7 0x27
|
---|
118 | #define SVM_EXIT_READ_DR8 0x28
|
---|
119 | #define SVM_EXIT_READ_DR9 0x29
|
---|
120 | #define SVM_EXIT_READ_DR10 0x2A
|
---|
121 | #define SVM_EXIT_READ_DR11 0x2B
|
---|
122 | #define SVM_EXIT_READ_DR12 0x2C
|
---|
123 | #define SVM_EXIT_READ_DR13 0x2D
|
---|
124 | #define SVM_EXIT_READ_DR14 0x2E
|
---|
125 | #define SVM_EXIT_READ_DR15 0x2F
|
---|
126 | /** Writes to DR0-DR15. */
|
---|
127 | #define SVM_EXIT_WRITE_DR0 0x30
|
---|
128 | #define SVM_EXIT_WRITE_DR1 0x31
|
---|
129 | #define SVM_EXIT_WRITE_DR2 0x32
|
---|
130 | #define SVM_EXIT_WRITE_DR3 0x33
|
---|
131 | #define SVM_EXIT_WRITE_DR4 0x34
|
---|
132 | #define SVM_EXIT_WRITE_DR5 0x35
|
---|
133 | #define SVM_EXIT_WRITE_DR6 0x36
|
---|
134 | #define SVM_EXIT_WRITE_DR7 0x37
|
---|
135 | #define SVM_EXIT_WRITE_DR8 0x38
|
---|
136 | #define SVM_EXIT_WRITE_DR9 0x39
|
---|
137 | #define SVM_EXIT_WRITE_DR10 0x3A
|
---|
138 | #define SVM_EXIT_WRITE_DR11 0x3B
|
---|
139 | #define SVM_EXIT_WRITE_DR12 0x3C
|
---|
140 | #define SVM_EXIT_WRITE_DR13 0x3D
|
---|
141 | #define SVM_EXIT_WRITE_DR14 0x3E
|
---|
142 | #define SVM_EXIT_WRITE_DR15 0x3F
|
---|
143 | /* Exception 0-31. */
|
---|
144 | #define SVM_EXIT_EXCEPTION_0 0x40
|
---|
145 | #define SVM_EXIT_EXCEPTION_1 0x41
|
---|
146 | #define SVM_EXIT_EXCEPTION_2 0x42
|
---|
147 | #define SVM_EXIT_EXCEPTION_3 0x43
|
---|
148 | #define SVM_EXIT_EXCEPTION_4 0x44
|
---|
149 | #define SVM_EXIT_EXCEPTION_5 0x45
|
---|
150 | #define SVM_EXIT_EXCEPTION_6 0x46
|
---|
151 | #define SVM_EXIT_EXCEPTION_7 0x47
|
---|
152 | #define SVM_EXIT_EXCEPTION_8 0x48
|
---|
153 | #define SVM_EXIT_EXCEPTION_9 0x49
|
---|
154 | #define SVM_EXIT_EXCEPTION_A 0x4A
|
---|
155 | #define SVM_EXIT_EXCEPTION_B 0x4B
|
---|
156 | #define SVM_EXIT_EXCEPTION_C 0x4C
|
---|
157 | #define SVM_EXIT_EXCEPTION_D 0x4D
|
---|
158 | #define SVM_EXIT_EXCEPTION_E 0x4E
|
---|
159 | #define SVM_EXIT_EXCEPTION_F 0x4F
|
---|
160 | #define SVM_EXIT_EXCEPTION_10 0x50
|
---|
161 | #define SVM_EXIT_EXCEPTION_11 0x51
|
---|
162 | #define SVM_EXIT_EXCEPTION_12 0x52
|
---|
163 | #define SVM_EXIT_EXCEPTION_13 0x53
|
---|
164 | #define SVM_EXIT_EXCEPTION_14 0x54
|
---|
165 | #define SVM_EXIT_EXCEPTION_15 0x55
|
---|
166 | #define SVM_EXIT_EXCEPTION_16 0x56
|
---|
167 | #define SVM_EXIT_EXCEPTION_17 0x57
|
---|
168 | #define SVM_EXIT_EXCEPTION_18 0x58
|
---|
169 | #define SVM_EXIT_EXCEPTION_19 0x59
|
---|
170 | #define SVM_EXIT_EXCEPTION_1A 0x5A
|
---|
171 | #define SVM_EXIT_EXCEPTION_1B 0x5B
|
---|
172 | #define SVM_EXIT_EXCEPTION_1C 0x5C
|
---|
173 | #define SVM_EXIT_EXCEPTION_1D 0x5D
|
---|
174 | #define SVM_EXIT_EXCEPTION_1E 0x5E
|
---|
175 | #define SVM_EXIT_EXCEPTION_1F 0x5F
|
---|
176 | /** Physical maskable interrupt. */
|
---|
177 | #define SVM_EXIT_INTR 0x60
|
---|
178 | /** Non-maskable interrupt. */
|
---|
179 | #define SVM_EXIT_NMI 0x61
|
---|
180 | /** System Management interrupt. */
|
---|
181 | #define SVM_EXIT_SMI 0x62
|
---|
182 | /** Physical INIT signal. */
|
---|
183 | #define SVM_EXIT_INIT 0x63
|
---|
184 | /** Virtual interrupt. */
|
---|
185 | #define SVM_EXIT_VINTR 0x64
|
---|
186 | /** Write to CR0 that changed any bits other than CR0.TS or CR0.MP. */
|
---|
187 | #define SVM_EXIT_CR0_SEL_WRITE 0x65
|
---|
188 | /** IDTR read. */
|
---|
189 | #define SVM_EXIT_IDTR_READ 0x66
|
---|
190 | /** GDTR read. */
|
---|
191 | #define SVM_EXIT_GDTR_READ 0x67
|
---|
192 | /** LDTR read. */
|
---|
193 | #define SVM_EXIT_LDTR_READ 0x68
|
---|
194 | /** TR read. */
|
---|
195 | #define SVM_EXIT_TR_READ 0x69
|
---|
196 | /** IDTR write. */
|
---|
197 | #define SVM_EXIT_IDTR_WRITE 0x6A
|
---|
198 | /** GDTR write. */
|
---|
199 | #define SVM_EXIT_GDTR_WRITE 0x6B
|
---|
200 | /** LDTR write. */
|
---|
201 | #define SVM_EXIT_LDTR_WRITE 0x6C
|
---|
202 | /** TR write. */
|
---|
203 | #define SVM_EXIT_TR_WRITE 0x6D
|
---|
204 | /** RDTSC instruction. */
|
---|
205 | #define SVM_EXIT_RDTSC 0x6E
|
---|
206 | /** RDPMC instruction. */
|
---|
207 | #define SVM_EXIT_RDPMC 0x6F
|
---|
208 | /** PUSHF instruction. */
|
---|
209 | #define SVM_EXIT_PUSHF 0x70
|
---|
210 | /** POPF instruction. */
|
---|
211 | #define SVM_EXIT_POPF 0x71
|
---|
212 | /** CPUID instruction. */
|
---|
213 | #define SVM_EXIT_CPUID 0x72
|
---|
214 | /** RSM instruction. */
|
---|
215 | #define SVM_EXIT_RSM 0x73
|
---|
216 | /** IRET instruction. */
|
---|
217 | #define SVM_EXIT_IRET 0x74
|
---|
218 | /** software interrupt (INTn instructions). */
|
---|
219 | #define SVM_EXIT_SWINT 0x75
|
---|
220 | /** INVD instruction. */
|
---|
221 | #define SVM_EXIT_INVD 0x76
|
---|
222 | /** PAUSE instruction. */
|
---|
223 | #define SVM_EXIT_PAUSE 0x77
|
---|
224 | /** HLT instruction. */
|
---|
225 | #define SVM_EXIT_HLT 0x78
|
---|
226 | /** INVLPG instructions. */
|
---|
227 | #define SVM_EXIT_INVLPG 0x79
|
---|
228 | /** INVLPGA instruction. */
|
---|
229 | #define SVM_EXIT_INVLPGA 0x7A
|
---|
230 | /** IN or OUT accessing protected port (the EXITINFO1 field provides more information). */
|
---|
231 | #define SVM_EXIT_IOIO 0x7B
|
---|
232 | /** RDMSR or WRMSR access to protected MSR. */
|
---|
233 | #define SVM_EXIT_MSR 0x7C
|
---|
234 | /** task switch. */
|
---|
235 | #define SVM_EXIT_TASK_SWITCH 0x7D
|
---|
236 | /** FP legacy handling enabled, and processor is frozen in an x87/mmx instruction waiting for an interrupt. */
|
---|
237 | #define SVM_EXIT_FERR_FREEZE 0x7E
|
---|
238 | /** Shutdown. */
|
---|
239 | #define SVM_EXIT_SHUTDOWN 0x7F
|
---|
240 | /** VMRUN instruction. */
|
---|
241 | #define SVM_EXIT_VMRUN 0x80
|
---|
242 | /** VMMCALL instruction. */
|
---|
243 | #define SVM_EXIT_VMMCALL 0x81
|
---|
244 | /** VMLOAD instruction. */
|
---|
245 | #define SVM_EXIT_VMLOAD 0x82
|
---|
246 | /** VMSAVE instruction. */
|
---|
247 | #define SVM_EXIT_VMSAVE 0x83
|
---|
248 | /** STGI instruction. */
|
---|
249 | #define SVM_EXIT_STGI 0x84
|
---|
250 | /** CLGI instruction. */
|
---|
251 | #define SVM_EXIT_CLGI 0x85
|
---|
252 | /** SKINIT instruction. */
|
---|
253 | #define SVM_EXIT_SKINIT 0x86
|
---|
254 | /** RDTSCP instruction. */
|
---|
255 | #define SVM_EXIT_RDTSCP 0x87
|
---|
256 | /** ICEBP instruction. */
|
---|
257 | #define SVM_EXIT_ICEBP 0x88
|
---|
258 | /** WBINVD instruction. */
|
---|
259 | #define SVM_EXIT_WBINVD 0x89
|
---|
260 | /** MONITOR instruction. */
|
---|
261 | #define SVM_EXIT_MONITOR 0x8A
|
---|
262 | /** MWAIT instruction. */
|
---|
263 | #define SVM_EXIT_MWAIT 0x8B
|
---|
264 | /** MWAIT instruction, when armed. */
|
---|
265 | #define SVM_EXIT_MWAIT_ARMED 0x8C
|
---|
266 | /** XSETBV instruction. */
|
---|
267 | #define SVM_EXIT_XSETBV 0x8D
|
---|
268 | /** Nested paging: host-level page fault occurred (EXITINFO1 contains fault errorcode; EXITINFO2 contains the guest physical address causing the fault). */
|
---|
269 | #define SVM_EXIT_NPF 0x400
|
---|
270 | /** AVIC: Virtual IPI delivery not completed. */
|
---|
271 | #define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401
|
---|
272 | /** AVIC: Attempted access by guest to a vAPIC register not handled by AVIC
|
---|
273 | * hardware. */
|
---|
274 | #define SVM_EXIT_AVIC_NOACCEL 0x402
|
---|
275 |
|
---|
276 | /** The maximum possible exit value. */
|
---|
277 | #define SVM_EXIT_MAX (SVM_EXIT_AVIC_NOACCEL)
|
---|
278 | /** @} */
|
---|
279 |
|
---|
280 |
|
---|
281 | /** @name SVMVMCB.u64ExitInfo2 for task switches
|
---|
282 | * @{
|
---|
283 | */
|
---|
284 | /** Set to 1 if the task switch was caused by an IRET; else cleared to 0. */
|
---|
285 | #define SVM_EXIT2_TASK_SWITCH_IRET RT_BIT_64(36)
|
---|
286 | /** Set to 1 if the task switch was caused by a far jump; else cleared to 0. */
|
---|
287 | #define SVM_EXIT2_TASK_SWITCH_JMP RT_BIT_64(38)
|
---|
288 | /** Set to 1 if the task switch has an error code; else cleared to 0. */
|
---|
289 | #define SVM_EXIT2_TASK_SWITCH_HAS_ERROR_CODE RT_BIT_64(44)
|
---|
290 | /** The value of EFLAGS.RF that would be saved in the outgoing TSS if the task switch were not intercepted. */
|
---|
291 | #define SVM_EXIT2_TASK_SWITCH_EFLAGS_RF RT_BIT_64(48)
|
---|
292 | /** @} */
|
---|
293 |
|
---|
294 | /** @name SVMVMCB.u64ExitInfo1 for MSR accesses
|
---|
295 | * @{
|
---|
296 | */
|
---|
297 | /** The access was a read MSR. */
|
---|
298 | #define SVM_EXIT1_MSR_READ 0x0
|
---|
299 | /** The access was a write MSR. */
|
---|
300 | #define SVM_EXIT1_MSR_WRITE 0x1
|
---|
301 | /** @} */
|
---|
302 |
|
---|
303 | /** @name SVMVMCB.ctrl.u32InterceptCtrl1
|
---|
304 | * @{
|
---|
305 | */
|
---|
306 | /** 0 Intercept INTR (physical maskable interrupt). */
|
---|
307 | #define SVM_CTRL1_INTERCEPT_INTR RT_BIT(0)
|
---|
308 | /** 1 Intercept NMI. */
|
---|
309 | #define SVM_CTRL1_INTERCEPT_NMI RT_BIT(1)
|
---|
310 | /** 2 Intercept SMI. */
|
---|
311 | #define SVM_CTRL1_INTERCEPT_SMI RT_BIT(2)
|
---|
312 | /** 3 Intercept INIT. */
|
---|
313 | #define SVM_CTRL1_INTERCEPT_INIT RT_BIT(3)
|
---|
314 | /** 4 Intercept VINTR (virtual maskable interrupt). */
|
---|
315 | #define SVM_CTRL1_INTERCEPT_VINTR RT_BIT(4)
|
---|
316 | /** 5 Intercept CR0 writes that change bits other than CR0.TS or CR0.MP */
|
---|
317 | #define SVM_CTRL1_INTERCEPT_CR0 RT_BIT(5)
|
---|
318 | /** 6 Intercept reads of IDTR. */
|
---|
319 | #define SVM_CTRL1_INTERCEPT_IDTR_READS RT_BIT(6)
|
---|
320 | /** 7 Intercept reads of GDTR. */
|
---|
321 | #define SVM_CTRL1_INTERCEPT_GDTR_READS RT_BIT(7)
|
---|
322 | /** 8 Intercept reads of LDTR. */
|
---|
323 | #define SVM_CTRL1_INTERCEPT_LDTR_READS RT_BIT(8)
|
---|
324 | /** 9 Intercept reads of TR. */
|
---|
325 | #define SVM_CTRL1_INTERCEPT_TR_READS RT_BIT(9)
|
---|
326 | /** 10 Intercept writes of IDTR. */
|
---|
327 | #define SVM_CTRL1_INTERCEPT_IDTR_WRITES RT_BIT(10)
|
---|
328 | /** 11 Intercept writes of GDTR. */
|
---|
329 | #define SVM_CTRL1_INTERCEPT_GDTR_WRITES RT_BIT(11)
|
---|
330 | /** 12 Intercept writes of LDTR. */
|
---|
331 | #define SVM_CTRL1_INTERCEPT_LDTR_WRITES RT_BIT(12)
|
---|
332 | /** 13 Intercept writes of TR. */
|
---|
333 | #define SVM_CTRL1_INTERCEPT_TR_WRITES RT_BIT(13)
|
---|
334 | /** 14 Intercept RDTSC instruction. */
|
---|
335 | #define SVM_CTRL1_INTERCEPT_RDTSC RT_BIT(14)
|
---|
336 | /** 15 Intercept RDPMC instruction. */
|
---|
337 | #define SVM_CTRL1_INTERCEPT_RDPMC RT_BIT(15)
|
---|
338 | /** 16 Intercept PUSHF instruction. */
|
---|
339 | #define SVM_CTRL1_INTERCEPT_PUSHF RT_BIT(16)
|
---|
340 | /** 17 Intercept POPF instruction. */
|
---|
341 | #define SVM_CTRL1_INTERCEPT_POPF RT_BIT(17)
|
---|
342 | /** 18 Intercept CPUID instruction. */
|
---|
343 | #define SVM_CTRL1_INTERCEPT_CPUID RT_BIT(18)
|
---|
344 | /** 19 Intercept RSM instruction. */
|
---|
345 | #define SVM_CTRL1_INTERCEPT_RSM RT_BIT(19)
|
---|
346 | /** 20 Intercept IRET instruction. */
|
---|
347 | #define SVM_CTRL1_INTERCEPT_IRET RT_BIT(20)
|
---|
348 | /** 21 Intercept INTn instruction. */
|
---|
349 | #define SVM_CTRL1_INTERCEPT_INTN RT_BIT(21)
|
---|
350 | /** 22 Intercept INVD instruction. */
|
---|
351 | #define SVM_CTRL1_INTERCEPT_INVD RT_BIT(22)
|
---|
352 | /** 23 Intercept PAUSE instruction. */
|
---|
353 | #define SVM_CTRL1_INTERCEPT_PAUSE RT_BIT(23)
|
---|
354 | /** 24 Intercept HLT instruction. */
|
---|
355 | #define SVM_CTRL1_INTERCEPT_HLT RT_BIT(24)
|
---|
356 | /** 25 Intercept INVLPG instruction. */
|
---|
357 | #define SVM_CTRL1_INTERCEPT_INVLPG RT_BIT(25)
|
---|
358 | /** 26 Intercept INVLPGA instruction. */
|
---|
359 | #define SVM_CTRL1_INTERCEPT_INVLPGA RT_BIT(26)
|
---|
360 | /** 27 IOIO_PROT Intercept IN/OUT accesses to selected ports. */
|
---|
361 | #define SVM_CTRL1_INTERCEPT_INOUT_BITMAP RT_BIT(27)
|
---|
362 | /** 28 MSR_PROT Intercept RDMSR or WRMSR accesses to selected MSRs. */
|
---|
363 | #define SVM_CTRL1_INTERCEPT_MSR_SHADOW RT_BIT(28)
|
---|
364 | /** 29 Intercept task switches. */
|
---|
365 | #define SVM_CTRL1_INTERCEPT_TASK_SWITCH RT_BIT(29)
|
---|
366 | /** 30 FERR_FREEZE: intercept processor "freezing" during legacy FERR handling. */
|
---|
367 | #define SVM_CTRL1_INTERCEPT_FERR_FREEZE RT_BIT(30)
|
---|
368 | /** 31 Intercept shutdown events. */
|
---|
369 | #define SVM_CTRL1_INTERCEPT_SHUTDOWN RT_BIT(31)
|
---|
370 | /** @} */
|
---|
371 |
|
---|
372 |
|
---|
373 | /** @name SVMVMCB.ctrl.u32InterceptCtrl2
|
---|
374 | * @{
|
---|
375 | */
|
---|
376 | /** 0 Intercept VMRUN instruction. */
|
---|
377 | #define SVM_CTRL2_INTERCEPT_VMRUN RT_BIT(0)
|
---|
378 | /** 1 Intercept VMMCALL instruction. */
|
---|
379 | #define SVM_CTRL2_INTERCEPT_VMMCALL RT_BIT(1)
|
---|
380 | /** 2 Intercept VMLOAD instruction. */
|
---|
381 | #define SVM_CTRL2_INTERCEPT_VMLOAD RT_BIT(2)
|
---|
382 | /** 3 Intercept VMSAVE instruction. */
|
---|
383 | #define SVM_CTRL2_INTERCEPT_VMSAVE RT_BIT(3)
|
---|
384 | /** 4 Intercept STGI instruction. */
|
---|
385 | #define SVM_CTRL2_INTERCEPT_STGI RT_BIT(4)
|
---|
386 | /** 5 Intercept CLGI instruction. */
|
---|
387 | #define SVM_CTRL2_INTERCEPT_CLGI RT_BIT(5)
|
---|
388 | /** 6 Intercept SKINIT instruction. */
|
---|
389 | #define SVM_CTRL2_INTERCEPT_SKINIT RT_BIT(6)
|
---|
390 | /** 7 Intercept RDTSCP instruction. */
|
---|
391 | #define SVM_CTRL2_INTERCEPT_RDTSCP RT_BIT(7)
|
---|
392 | /** 8 Intercept ICEBP instruction. */
|
---|
393 | #define SVM_CTRL2_INTERCEPT_ICEBP RT_BIT(8)
|
---|
394 | /** 9 Intercept WBINVD instruction. */
|
---|
395 | #define SVM_CTRL2_INTERCEPT_WBINVD RT_BIT(9)
|
---|
396 | /** 10 Intercept MONITOR instruction. */
|
---|
397 | #define SVM_CTRL2_INTERCEPT_MONITOR RT_BIT(10)
|
---|
398 | /** 11 Intercept MWAIT instruction unconditionally. */
|
---|
399 | #define SVM_CTRL2_INTERCEPT_MWAIT RT_BIT(11)
|
---|
400 | /** 12 Intercept MWAIT instruction when armed. */
|
---|
401 | #define SVM_CTRL2_INTERCEPT_MWAIT_ARMED RT_BIT(12)
|
---|
402 | /** 13 Intercept XSETBV instruction. */
|
---|
403 | #define SVM_CTRL2_INTERCEPT_XSETBV RT_BIT(13)
|
---|
404 | /** @} */
|
---|
405 |
|
---|
406 | /** @name SVMVMCB.ctrl.u64NestedPaging
|
---|
407 | * @{
|
---|
408 | */
|
---|
409 | #define SVM_NESTED_PAGING_ENABLE RT_BIT(0)
|
---|
410 | /** @} */
|
---|
411 |
|
---|
412 | /** @name SVMVMCB.ctrl.u64IntShadow
|
---|
413 | * @{
|
---|
414 | */
|
---|
415 | #define SVM_INTERRUPT_SHADOW_ACTIVE RT_BIT(0)
|
---|
416 | /** @} */
|
---|
417 |
|
---|
418 |
|
---|
419 | /** @name SVMINTCTRL.u3Type
|
---|
420 | * @{
|
---|
421 | */
|
---|
422 | /** External or virtual interrupt. */
|
---|
423 | #define SVM_EVENT_EXTERNAL_IRQ 0
|
---|
424 | /** Non-maskable interrupt. */
|
---|
425 | #define SVM_EVENT_NMI 2
|
---|
426 | /** Exception; fault or trap. */
|
---|
427 | #define SVM_EVENT_EXCEPTION 3
|
---|
428 | /** Software interrupt. */
|
---|
429 | #define SVM_EVENT_SOFTWARE_INT 4
|
---|
430 | /** @} */
|
---|
431 |
|
---|
432 |
|
---|
433 | /** @name SVMVMCB.ctrl.TLBCtrl.n.u8TLBFlush
|
---|
434 | * @{
|
---|
435 | */
|
---|
436 | /** Flush nothing. */
|
---|
437 | #define SVM_TLB_FLUSH_NOTHING 0
|
---|
438 | /** Flush entire TLB (host+guest entries) */
|
---|
439 | #define SVM_TLB_FLUSH_ENTIRE 1
|
---|
440 | /** Flush this guest's TLB entries (by ASID) */
|
---|
441 | #define SVM_TLB_FLUSH_SINGLE_CONTEXT 3
|
---|
442 | /** Flush this guest's non-global TLB entries (by ASID) */
|
---|
443 | #define SVM_TLB_FLUSH_SINGLE_CONTEXT_RETAIN_GLOBALS 7
|
---|
444 | /** @} */
|
---|
445 |
|
---|
446 |
|
---|
447 | /**
|
---|
448 | * SVM Selector type; includes hidden parts.
|
---|
449 | */
|
---|
450 | typedef struct
|
---|
451 | {
|
---|
452 | uint16_t u16Sel;
|
---|
453 | uint16_t u16Attr;
|
---|
454 | uint32_t u32Limit;
|
---|
455 | uint64_t u64Base; /**< Only lower 32 bits are implemented for CS, DS, ES & SS. */
|
---|
456 | } SVMSEL;
|
---|
457 | AssertCompileSize(SVMSEL, 16);
|
---|
458 |
|
---|
459 | /**
|
---|
460 | * SVM GDTR/IDTR type.
|
---|
461 | */
|
---|
462 | typedef struct
|
---|
463 | {
|
---|
464 | uint16_t u16Reserved1;
|
---|
465 | uint16_t u16Reserved2;
|
---|
466 | uint32_t u32Limit; /**< Only lower 16 bits are implemented. */
|
---|
467 | uint64_t u64Base;
|
---|
468 | } SVMGDTR;
|
---|
469 | AssertCompileSize(SVMGDTR, 16);
|
---|
470 | typedef SVMGDTR SVMIDTR;
|
---|
471 |
|
---|
472 | /**
|
---|
473 | * SVM Event injection structure (EVENTINJ and EXITINTINFO).
|
---|
474 | */
|
---|
475 | typedef union
|
---|
476 | {
|
---|
477 | struct
|
---|
478 | {
|
---|
479 | uint32_t u8Vector : 8;
|
---|
480 | uint32_t u3Type : 3;
|
---|
481 | uint32_t u1ErrorCodeValid : 1;
|
---|
482 | uint32_t u19Reserved : 19;
|
---|
483 | uint32_t u1Valid : 1;
|
---|
484 | uint32_t u32ErrorCode : 32;
|
---|
485 | } n;
|
---|
486 | uint64_t u;
|
---|
487 | } SVMEVENT;
|
---|
488 | /** Pointer to the SVMEVENT union. */
|
---|
489 | typedef SVMEVENT *PSVMEVENT;
|
---|
490 |
|
---|
491 | /**
|
---|
492 | * SVM Interrupt control structure (Virtual Interrupt Control).
|
---|
493 | */
|
---|
494 | typedef union
|
---|
495 | {
|
---|
496 | struct
|
---|
497 | {
|
---|
498 | uint32_t u8VTPR : 8; /* V_TPR */
|
---|
499 | uint32_t u1VIrqValid : 1; /* V_IRQ */
|
---|
500 | uint32_t u7Reserved : 7;
|
---|
501 | uint32_t u4VIrqPriority : 4; /* V_INTR_PRIO */
|
---|
502 | uint32_t u1IgnoreTPR : 1; /* V_IGN_TPR */
|
---|
503 | uint32_t u3Reserved : 3;
|
---|
504 | uint32_t u1VIrqMasking : 1; /* V_INTR_MASKING */
|
---|
505 | uint32_t u6Reserved : 6;
|
---|
506 | uint32_t u1AvicEnable : 1;
|
---|
507 | uint32_t u8VIrqVector : 8; /* V_INTR_VECTOR */
|
---|
508 | uint32_t u24Reserved : 24;
|
---|
509 | } n;
|
---|
510 | uint64_t u;
|
---|
511 | } SVMINTCTRL;
|
---|
512 |
|
---|
513 | /**
|
---|
514 | * SVM TLB control structure.
|
---|
515 | */
|
---|
516 | typedef union
|
---|
517 | {
|
---|
518 | struct
|
---|
519 | {
|
---|
520 | uint32_t u32ASID : 32;
|
---|
521 | uint32_t u8TLBFlush : 8;
|
---|
522 | uint32_t u24Reserved : 24;
|
---|
523 | } n;
|
---|
524 | uint64_t u;
|
---|
525 | } SVMTLBCTRL;
|
---|
526 |
|
---|
527 | /**
|
---|
528 | * SVM IOIO exit structure (EXITINFO1 for IOIO intercepts).
|
---|
529 | */
|
---|
530 | typedef union
|
---|
531 | {
|
---|
532 | struct
|
---|
533 | {
|
---|
534 | uint32_t u1Type : 1; /**< Bit 0: 0 = out, 1 = in */
|
---|
535 | uint32_t u1Reserved : 1; /**< Bit 1: Reserved */
|
---|
536 | uint32_t u1STR : 1; /**< Bit 2: String I/O (1) or not (0). */
|
---|
537 | uint32_t u1REP : 1; /**< Bit 3: Repeat prefixed string I/O. */
|
---|
538 | uint32_t u1OP8 : 1; /**< Bit 4: 8-bit operand. */
|
---|
539 | uint32_t u1OP16 : 1; /**< Bit 5: 16-bit operand. */
|
---|
540 | uint32_t u1OP32 : 1; /**< Bit 6: 32-bit operand. */
|
---|
541 | uint32_t u1ADDR16 : 1; /**< Bit 7: 16-bit operand. */
|
---|
542 | uint32_t u1ADDR32 : 1; /**< Bit 8: 32-bit operand. */
|
---|
543 | uint32_t u1ADDR64 : 1; /**< Bit 9: 64-bit operand. */
|
---|
544 | uint32_t u3SEG : 3; /**< BITS 12:10: Effective segment number. Added with decode assist in APM v3.17. */
|
---|
545 | uint32_t u3Reserved : 3;
|
---|
546 | uint32_t u16Port : 16; /**< Bits 31:16: Port number. */
|
---|
547 | } n;
|
---|
548 | uint32_t u;
|
---|
549 | } SVMIOIOEXIT;
|
---|
550 |
|
---|
551 | /** @name SVMIOIOEXIT.u1Type
|
---|
552 | * @{ */
|
---|
553 | /** IO write. */
|
---|
554 | #define SVM_IOIO_WRITE 0
|
---|
555 | /** IO read. */
|
---|
556 | #define SVM_IOIO_READ 1
|
---|
557 | /** @}*/
|
---|
558 |
|
---|
559 | /**
|
---|
560 | * SVM nested paging structure.
|
---|
561 | */
|
---|
562 | typedef union
|
---|
563 | {
|
---|
564 | struct
|
---|
565 | {
|
---|
566 | uint32_t u1NestedPaging : 1; /**< enabled/disabled */
|
---|
567 | } n;
|
---|
568 | uint64_t u;
|
---|
569 | } SVMNPCTRL;
|
---|
570 |
|
---|
571 | /**
|
---|
572 | * SVM AVIC.
|
---|
573 | */
|
---|
574 | typedef union
|
---|
575 | {
|
---|
576 | struct
|
---|
577 | {
|
---|
578 | uint64_t u12Reserved1 : 12;
|
---|
579 | uint64_t u40Addr : 40;
|
---|
580 | uint64_t u12Reserved2 : 12;
|
---|
581 | } n;
|
---|
582 | uint64_t u;
|
---|
583 | } SVMAVIC;
|
---|
584 | AssertCompileSize(SVMAVIC, 8);
|
---|
585 |
|
---|
586 | /**
|
---|
587 | * SVM AVIC PHYSICAL_TABLE pointer.
|
---|
588 | */
|
---|
589 | typedef union
|
---|
590 | {
|
---|
591 | struct
|
---|
592 | {
|
---|
593 | uint64_t u8LastGuestCoreId : 8;
|
---|
594 | uint64_t u4Reserved : 4;
|
---|
595 | uint64_t u40Addr : 40;
|
---|
596 | uint64_t u12Reserved : 12;
|
---|
597 | } n;
|
---|
598 | uint64_t u;
|
---|
599 | } SVMAVICPHYS;
|
---|
600 | AssertCompileSize(SVMAVICPHYS, 8);
|
---|
601 |
|
---|
602 | /**
|
---|
603 | * SVM VM Control Block. (VMCB)
|
---|
604 | */
|
---|
605 | typedef struct SVMVMCB
|
---|
606 | {
|
---|
607 | /** Control Area. */
|
---|
608 | struct
|
---|
609 | {
|
---|
610 | /** Offset 0x00 - Intercept reads of CR0-15. */
|
---|
611 | uint16_t u16InterceptRdCRx;
|
---|
612 | /** Offset 0x02 - Intercept writes to CR0-15. */
|
---|
613 | uint16_t u16InterceptWrCRx;
|
---|
614 | /** Offset 0x04 - Intercept reads of DR0-15. */
|
---|
615 | uint16_t u16InterceptRdDRx;
|
---|
616 | /** Offset 0x06 - Intercept writes to DR0-15. */
|
---|
617 | uint16_t u16InterceptWrDRx;
|
---|
618 | /** Offset 0x08 - Intercept exception vectors 0-31. */
|
---|
619 | uint32_t u32InterceptException;
|
---|
620 | /** Offset 0x0C - Intercept control field 1. */
|
---|
621 | uint32_t u32InterceptCtrl1;
|
---|
622 | /** Offset 0x10 - Intercept control field 2. */
|
---|
623 | uint32_t u32InterceptCtrl2;
|
---|
624 | /** Offset 0x14-0x3F - Reserved. */
|
---|
625 | uint8_t u8Reserved[0x3c - 0x14];
|
---|
626 | /** Offset 0x3c - PAUSE filter threshold. */
|
---|
627 | uint16_t u16PauseFilterThreshold;
|
---|
628 | /** Offset 0x3e - PAUSE intercept filter count. */
|
---|
629 | uint16_t u16PauseFilterCount;
|
---|
630 | /** Offset 0x40 - Physical address of IOPM. */
|
---|
631 | uint64_t u64IOPMPhysAddr;
|
---|
632 | /** Offset 0x48 - Physical address of MSRPM. */
|
---|
633 | uint64_t u64MSRPMPhysAddr;
|
---|
634 | /** Offset 0x50 - TSC Offset. */
|
---|
635 | uint64_t u64TSCOffset;
|
---|
636 | /** Offset 0x58 - TLB control field. */
|
---|
637 | SVMTLBCTRL TLBCtrl;
|
---|
638 | /** Offset 0x60 - Interrupt control field. */
|
---|
639 | SVMINTCTRL IntCtrl;
|
---|
640 | /** Offset 0x68 - Interrupt shadow. */
|
---|
641 | uint64_t u64IntShadow;
|
---|
642 | /** Offset 0x70 - Exit code. */
|
---|
643 | uint64_t u64ExitCode;
|
---|
644 | /** Offset 0x78 - Exit info 1. */
|
---|
645 | uint64_t u64ExitInfo1;
|
---|
646 | /** Offset 0x80 - Exit info 2. */
|
---|
647 | uint64_t u64ExitInfo2;
|
---|
648 | /** Offset 0x88 - Exit Interrupt info. */
|
---|
649 | SVMEVENT ExitIntInfo;
|
---|
650 | /** Offset 0x90 - Nested Paging. */
|
---|
651 | SVMNPCTRL NestedPaging;
|
---|
652 | /** Offset 0x98 - AVIC APIC BAR. */
|
---|
653 | SVMAVIC AvicBar;
|
---|
654 | /** Offset 0xA0-0xA7 - Reserved. */
|
---|
655 | uint8_t u8Reserved2[0xA8-0xA0];
|
---|
656 | /** Offset 0xA8 - Event injection. */
|
---|
657 | SVMEVENT EventInject;
|
---|
658 | /** Offset 0xB0 - Host CR3 for nested paging. */
|
---|
659 | uint64_t u64NestedPagingCR3;
|
---|
660 | /** Offset 0xB8 - LBR Virtualization. */
|
---|
661 | uint64_t u64LBRVirt;
|
---|
662 | /** Offset 0xC0 - VMCB Clean Bits. */
|
---|
663 | uint64_t u64VmcbCleanBits;
|
---|
664 | /** Offset 0xC8 - Next sequential instruction pointer. */
|
---|
665 | uint64_t u64NextRIP;
|
---|
666 | /** Offset 0xD0 - Number of bytes fetched. */
|
---|
667 | uint8_t cbInstrFetched;
|
---|
668 | /** Offset 0xD1 - Fetched bytes. */
|
---|
669 | uint8_t abInstr[15];
|
---|
670 | /** Offset 0xE0 - AVIC APIC_BACKING_PAGE pointer. */
|
---|
671 | SVMAVIC AvicBackingPagePtr;
|
---|
672 | /** Offset 0xE8-0xEF - Reserved. */
|
---|
673 | uint8_t u8Reserved3[0xF0 - 0xE8];
|
---|
674 | /** Offset 0xF0 - AVIC LOGICAL_TABLE pointer. */
|
---|
675 | SVMAVIC AvicLogicalTablePtr;
|
---|
676 | /** Offset 0xF8 - AVIC PHYSICAL_TABLE pointer. */
|
---|
677 | SVMAVICPHYS AvicPhysicalTablePtr;
|
---|
678 | } ctrl;
|
---|
679 |
|
---|
680 | /** Offset 0x100-0x3FF - Reserved. */
|
---|
681 | uint8_t u8Reserved3[0x400-0x100];
|
---|
682 |
|
---|
683 | /** State Save Area. Starts at offset 0x400. */
|
---|
684 | struct
|
---|
685 | {
|
---|
686 | /** Offset 0x400 - Guest ES register + hidden parts. */
|
---|
687 | SVMSEL ES;
|
---|
688 | /** Offset 0x410 - Guest CS register + hidden parts. */
|
---|
689 | SVMSEL CS;
|
---|
690 | /** Offset 0x420 - Guest SS register + hidden parts. */
|
---|
691 | SVMSEL SS;
|
---|
692 | /** Offset 0x430 - Guest DS register + hidden parts. */
|
---|
693 | SVMSEL DS;
|
---|
694 | /** Offset 0x440 - Guest FS register + hidden parts. */
|
---|
695 | SVMSEL FS;
|
---|
696 | /** Offset 0x450 - Guest GS register + hidden parts. */
|
---|
697 | SVMSEL GS;
|
---|
698 | /** Offset 0x460 - Guest GDTR register. */
|
---|
699 | SVMGDTR GDTR;
|
---|
700 | /** Offset 0x470 - Guest LDTR register + hidden parts. */
|
---|
701 | SVMSEL LDTR;
|
---|
702 | /** Offset 0x480 - Guest IDTR register. */
|
---|
703 | SVMIDTR IDTR;
|
---|
704 | /** Offset 0x490 - Guest TR register + hidden parts. */
|
---|
705 | SVMSEL TR;
|
---|
706 | /** Offset 0x4A0-0x4CA - Reserved. */
|
---|
707 | uint8_t u8Reserved4[0x4CB-0x4A0];
|
---|
708 | /** Offset 0x4CB - CPL. */
|
---|
709 | uint8_t u8CPL;
|
---|
710 | /** Offset 0x4CC-0x4CF - Reserved. */
|
---|
711 | uint8_t u8Reserved5[0x4D0-0x4CC];
|
---|
712 | /** Offset 0x4D0 - EFER. */
|
---|
713 | uint64_t u64EFER;
|
---|
714 | /** Offset 0x4D8-0x547 - Reserved. */
|
---|
715 | uint8_t u8Reserved6[0x548-0x4D8];
|
---|
716 | /** Offset 0x548 - CR4. */
|
---|
717 | uint64_t u64CR4;
|
---|
718 | /** Offset 0x550 - CR3. */
|
---|
719 | uint64_t u64CR3;
|
---|
720 | /** Offset 0x558 - CR0. */
|
---|
721 | uint64_t u64CR0;
|
---|
722 | /** Offset 0x560 - DR7. */
|
---|
723 | uint64_t u64DR7;
|
---|
724 | /** Offset 0x568 - DR6. */
|
---|
725 | uint64_t u64DR6;
|
---|
726 | /** Offset 0x570 - RFLAGS. */
|
---|
727 | uint64_t u64RFlags;
|
---|
728 | /** Offset 0x578 - RIP. */
|
---|
729 | uint64_t u64RIP;
|
---|
730 | /** Offset 0x580-0x5D7 - Reserved. */
|
---|
731 | uint8_t u8Reserved7[0x5D8-0x580];
|
---|
732 | /** Offset 0x5D8 - RSP. */
|
---|
733 | uint64_t u64RSP;
|
---|
734 | /** Offset 0x5E0-0x5F7 - Reserved. */
|
---|
735 | uint8_t u8Reserved8[0x5F8-0x5E0];
|
---|
736 | /** Offset 0x5F8 - RAX. */
|
---|
737 | uint64_t u64RAX;
|
---|
738 | /** Offset 0x600 - STAR. */
|
---|
739 | uint64_t u64STAR;
|
---|
740 | /** Offset 0x608 - LSTAR. */
|
---|
741 | uint64_t u64LSTAR;
|
---|
742 | /** Offset 0x610 - CSTAR. */
|
---|
743 | uint64_t u64CSTAR;
|
---|
744 | /** Offset 0x618 - SFMASK. */
|
---|
745 | uint64_t u64SFMASK;
|
---|
746 | /** Offset 0x620 - KernelGSBase. */
|
---|
747 | uint64_t u64KernelGSBase;
|
---|
748 | /** Offset 0x628 - SYSENTER_CS. */
|
---|
749 | uint64_t u64SysEnterCS;
|
---|
750 | /** Offset 0x630 - SYSENTER_ESP. */
|
---|
751 | uint64_t u64SysEnterESP;
|
---|
752 | /** Offset 0x638 - SYSENTER_EIP. */
|
---|
753 | uint64_t u64SysEnterEIP;
|
---|
754 | /** Offset 0x640 - CR2. */
|
---|
755 | uint64_t u64CR2;
|
---|
756 | /** Offset 0x648-0x667 - Reserved. */
|
---|
757 | uint8_t u8Reserved9[0x668-0x648];
|
---|
758 | /** Offset 0x668 - G_PAT. */
|
---|
759 | uint64_t u64GPAT;
|
---|
760 | /** Offset 0x670 - DBGCTL. */
|
---|
761 | uint64_t u64DBGCTL;
|
---|
762 | /** Offset 0x678 - BR_FROM. */
|
---|
763 | uint64_t u64BR_FROM;
|
---|
764 | /** Offset 0x680 - BR_TO. */
|
---|
765 | uint64_t u64BR_TO;
|
---|
766 | /** Offset 0x688 - LASTEXCPFROM. */
|
---|
767 | uint64_t u64LASTEXCPFROM;
|
---|
768 | /** Offset 0x690 - LASTEXCPTO. */
|
---|
769 | uint64_t u64LASTEXCPTO;
|
---|
770 | } guest;
|
---|
771 |
|
---|
772 | /** Offset 0x698-0xFFF- Reserved. */
|
---|
773 | uint8_t u8Reserved10[0x1000-0x698];
|
---|
774 | } SVMVMCB;
|
---|
775 | /** Pointer to the SVMVMCB structure. */
|
---|
776 | typedef SVMVMCB *PSVMVMCB;
|
---|
777 | AssertCompileMemberOffset(SVMVMCB, ctrl, 0x00);
|
---|
778 | AssertCompileMemberOffset(SVMVMCB, ctrl.u16InterceptRdCRx, 0x00);
|
---|
779 | AssertCompileMemberOffset(SVMVMCB, ctrl.u16InterceptWrCRx, 0x02);
|
---|
780 | AssertCompileMemberOffset(SVMVMCB, ctrl.u16InterceptRdDRx, 0x04);
|
---|
781 | AssertCompileMemberOffset(SVMVMCB, ctrl.u16InterceptWrDRx, 0x06);
|
---|
782 | AssertCompileMemberOffset(SVMVMCB, ctrl.u32InterceptException, 0x08);
|
---|
783 | AssertCompileMemberOffset(SVMVMCB, ctrl.u32InterceptCtrl1, 0x0C);
|
---|
784 | AssertCompileMemberOffset(SVMVMCB, ctrl.u32InterceptCtrl2, 0x10);
|
---|
785 | AssertCompileMemberOffset(SVMVMCB, ctrl.u8Reserved, 0x14);
|
---|
786 | AssertCompileMemberOffset(SVMVMCB, ctrl.u16PauseFilterThreshold, 0x3c);
|
---|
787 | AssertCompileMemberOffset(SVMVMCB, ctrl.u16PauseFilterCount, 0x3e);
|
---|
788 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64IOPMPhysAddr, 0x40);
|
---|
789 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64MSRPMPhysAddr, 0x48);
|
---|
790 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64TSCOffset, 0x50);
|
---|
791 | AssertCompileMemberOffset(SVMVMCB, ctrl.TLBCtrl, 0x58);
|
---|
792 | AssertCompileMemberOffset(SVMVMCB, ctrl.IntCtrl, 0x60);
|
---|
793 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64IntShadow, 0x68);
|
---|
794 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64ExitCode, 0x70);
|
---|
795 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64ExitInfo1, 0x78);
|
---|
796 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64ExitInfo2, 0x80);
|
---|
797 | AssertCompileMemberOffset(SVMVMCB, ctrl.ExitIntInfo, 0x88);
|
---|
798 | AssertCompileMemberOffset(SVMVMCB, ctrl.NestedPaging, 0x90);
|
---|
799 | AssertCompileMemberOffset(SVMVMCB, ctrl.AvicBar, 0x98);
|
---|
800 | AssertCompileMemberOffset(SVMVMCB, ctrl.u8Reserved2, 0xA0);
|
---|
801 | AssertCompileMemberOffset(SVMVMCB, ctrl.EventInject, 0xA8);
|
---|
802 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64NestedPagingCR3, 0xB0);
|
---|
803 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64LBRVirt, 0xB8);
|
---|
804 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64VmcbCleanBits, 0xC0);
|
---|
805 | AssertCompileMemberOffset(SVMVMCB, ctrl.u64NextRIP, 0xC8);
|
---|
806 | AssertCompileMemberOffset(SVMVMCB, ctrl.cbInstrFetched, 0xD0);
|
---|
807 | AssertCompileMemberOffset(SVMVMCB, ctrl.abInstr, 0xD1);
|
---|
808 | AssertCompileMemberOffset(SVMVMCB, ctrl.AvicBackingPagePtr, 0xE0);
|
---|
809 | AssertCompileMemberOffset(SVMVMCB, ctrl.u8Reserved3, 0xE8);
|
---|
810 | AssertCompileMemberOffset(SVMVMCB, ctrl.AvicLogicalTablePtr, 0xF0);
|
---|
811 | AssertCompileMemberOffset(SVMVMCB, ctrl.AvicPhysicalTablePtr, 0xF8);
|
---|
812 | AssertCompileMemberOffset(SVMVMCB, u8Reserved3, 0x100);
|
---|
813 | AssertCompileMemberOffset(SVMVMCB, guest, 0x400);
|
---|
814 | AssertCompileMemberOffset(SVMVMCB, guest.ES, 0x400);
|
---|
815 | AssertCompileMemberOffset(SVMVMCB, guest.CS, 0x410);
|
---|
816 | AssertCompileMemberOffset(SVMVMCB, guest.SS, 0x420);
|
---|
817 | AssertCompileMemberOffset(SVMVMCB, guest.DS, 0x430);
|
---|
818 | AssertCompileMemberOffset(SVMVMCB, guest.FS, 0x440);
|
---|
819 | AssertCompileMemberOffset(SVMVMCB, guest.GS, 0x450);
|
---|
820 | AssertCompileMemberOffset(SVMVMCB, guest.GDTR, 0x460);
|
---|
821 | AssertCompileMemberOffset(SVMVMCB, guest.LDTR, 0x470);
|
---|
822 | AssertCompileMemberOffset(SVMVMCB, guest.IDTR, 0x480);
|
---|
823 | AssertCompileMemberOffset(SVMVMCB, guest.TR, 0x490);
|
---|
824 | AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved4, 0x4A0);
|
---|
825 | AssertCompileMemberOffset(SVMVMCB, guest.u8CPL, 0x4CB);
|
---|
826 | AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved5, 0x4CC);
|
---|
827 | AssertCompileMemberOffset(SVMVMCB, guest.u64EFER, 0x4D0);
|
---|
828 | AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved6, 0x4D8);
|
---|
829 | AssertCompileMemberOffset(SVMVMCB, guest.u64CR4, 0x548);
|
---|
830 | AssertCompileMemberOffset(SVMVMCB, guest.u64CR3, 0x550);
|
---|
831 | AssertCompileMemberOffset(SVMVMCB, guest.u64CR0, 0x558);
|
---|
832 | AssertCompileMemberOffset(SVMVMCB, guest.u64DR7, 0x560);
|
---|
833 | AssertCompileMemberOffset(SVMVMCB, guest.u64DR6, 0x568);
|
---|
834 | AssertCompileMemberOffset(SVMVMCB, guest.u64RFlags, 0x570);
|
---|
835 | AssertCompileMemberOffset(SVMVMCB, guest.u64RIP, 0x578);
|
---|
836 | AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved7, 0x580);
|
---|
837 | AssertCompileMemberOffset(SVMVMCB, guest.u64RSP, 0x5D8);
|
---|
838 | AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved8, 0x5E0);
|
---|
839 | AssertCompileMemberOffset(SVMVMCB, guest.u64RAX, 0x5F8);
|
---|
840 | AssertCompileMemberOffset(SVMVMCB, guest.u64STAR, 0x600);
|
---|
841 | AssertCompileMemberOffset(SVMVMCB, guest.u64LSTAR, 0x608);
|
---|
842 | AssertCompileMemberOffset(SVMVMCB, guest.u64CSTAR, 0x610);
|
---|
843 | AssertCompileMemberOffset(SVMVMCB, guest.u64SFMASK, 0x618);
|
---|
844 | AssertCompileMemberOffset(SVMVMCB, guest.u64KernelGSBase, 0x620);
|
---|
845 | AssertCompileMemberOffset(SVMVMCB, guest.u64SysEnterCS, 0x628);
|
---|
846 | AssertCompileMemberOffset(SVMVMCB, guest.u64SysEnterESP, 0x630);
|
---|
847 | AssertCompileMemberOffset(SVMVMCB, guest.u64SysEnterEIP, 0x638);
|
---|
848 | AssertCompileMemberOffset(SVMVMCB, guest.u64CR2, 0x640);
|
---|
849 | AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved9, 0x648);
|
---|
850 | AssertCompileMemberOffset(SVMVMCB, guest.u64GPAT, 0x668);
|
---|
851 | AssertCompileMemberOffset(SVMVMCB, guest.u64DBGCTL, 0x670);
|
---|
852 | AssertCompileMemberOffset(SVMVMCB, guest.u64BR_FROM, 0x678);
|
---|
853 | AssertCompileMemberOffset(SVMVMCB, guest.u64BR_TO, 0x680);
|
---|
854 | AssertCompileMemberOffset(SVMVMCB, guest.u64LASTEXCPFROM, 0x688);
|
---|
855 | AssertCompileMemberOffset(SVMVMCB, guest.u64LASTEXCPTO, 0x690);
|
---|
856 | AssertCompileMemberOffset(SVMVMCB, u8Reserved10, 0x698);
|
---|
857 | AssertCompileSize(SVMVMCB, 0x1000);
|
---|
858 |
|
---|
859 | #ifdef IN_RING0
|
---|
860 | VMMR0DECL(int) SVMR0InvalidatePage(PVM pVM, PVMCPU pVCpu, RTGCPTR GCVirt);
|
---|
861 | #endif /* IN_RING0 */
|
---|
862 |
|
---|
863 | /** @} */
|
---|
864 |
|
---|
865 | #endif
|
---|
866 |
|
---|