VirtualBox

source: vbox/trunk/include/VBox/hwacc_vmx.h@ 5605

Last change on this file since 5605 was 5605, checked in by vboxsync, 17 years ago

BIT => RT_BIT, BIT64 => RT_BIT_64. BIT() is defined in Linux 2.6.24

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 37.2 KB
Line 
1/** @file
2 * HWACC/VMX - VMX Structures and Definitions.
3 */
4
5/*
6 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16
17#ifndef ___VBox_vmx_h
18#define ___VBox_vmx_h
19
20#include <VBox/types.h>
21#include <VBox/err.h>
22#include <VBox/cpum.h>
23#include <iprt/assert.h>
24#include <iprt/asm.h>
25
26/** @defgroup grp_vmx vmx Types and Definitions
27 * @ingroup grp_hwaccm
28 * @{
29 */
30
31/** VMX Basic Exit Reasons.
32 * @{
33 */
34/* And-mask for setting reserved bits to zero */
35#define VMX_EFLAGS_RESERVED_0 (~0xffc08028)
36/* Or-mask for setting reserved bits to 1 */
37#define VMX_EFLAGS_RESERVED_1 0x00000002
38/** @} */
39
40/** VMX Basic Exit Reasons.
41 * @{
42 */
43/** 0 Exception or non-maskable interrupt (NMI). */
44#define VMX_EXIT_EXCEPTION 0
45/** 1 External interrupt. */
46#define VMX_EXIT_EXTERNAL_IRQ 1
47/** 2 Triple fault. */
48#define VMX_EXIT_TRIPLE_FAULT 2
49/** 3 INIT signal. */
50#define VMX_EXIT_INIT_SIGNAL 3
51/** 4 Start-up IPI (SIPI). */
52#define VMX_EXIT_SIPI 4
53/** 5 I/O system-management interrupt (SMI). */
54#define VMX_EXIT_IO_SMI_IRQ 5
55/** 6 Other SMI. */
56#define VMX_EXIT_SMI_IRQ 6
57/** 7 Interrupt window. */
58#define VMX_EXIT_IRQ_WINDOW 7
59/** 9 Task switch. */
60#define VMX_EXIT_TASK_SWITCH 9
61/** 10 Guest software attempted to execute CPUID. */
62#define VMX_EXIT_CPUID 10
63/** 12 Guest software attempted to execute HLT. */
64#define VMX_EXIT_HLT 12
65/** 13 Guest software attempted to execute INVD. */
66#define VMX_EXIT_INVD 13
67/** 14 Guest software attempted to execute INVPG. */
68#define VMX_EXIT_INVPG 14
69/** 15 Guest software attempted to execute RDPMC. */
70#define VMX_EXIT_RDPMC 15
71/** 16 Guest software attempted to execute RDTSC. */
72#define VMX_EXIT_RDTSC 16
73/** 17 Guest software attempted to execute RSM in SMM. */
74#define VMX_EXIT_RSM 17
75/** 18 Guest software executed VMCALL. */
76#define VMX_EXIT_VMCALL 18
77/** 19 Guest software executed VMCLEAR. */
78#define VMX_EXIT_VMCLEAR 19
79/** 20 Guest software executed VMLAUNCH. */
80#define VMX_EXIT_VMLAUNCH 20
81/** 21 Guest software executed VMPTRLD. */
82#define VMX_EXIT_VMPTRLD 21
83/** 22 Guest software executed VMPTRST. */
84#define VMX_EXIT_VMPTRST 22
85/** 23 Guest software executed VMREAD. */
86#define VMX_EXIT_VMREAD 23
87/** 24 Guest software executed VMRESUME. */
88#define VMX_EXIT_VMRESUME 24
89/** 25 Guest software executed VMWRITE. */
90#define VMX_EXIT_VMWRITE 25
91/** 26 Guest software executed VMXOFF. */
92#define VMX_EXIT_VMXOFF 26
93/** 27 Guest software executed VMXON. */
94#define VMX_EXIT_VMXON 27
95/** 28 Control-register accesses. */
96#define VMX_EXIT_CRX_MOVE 28
97/** 29 Debug-register accesses. */
98#define VMX_EXIT_DRX_MOVE 29
99/** 30 I/O instruction. */
100#define VMX_EXIT_PORT_IO 30
101/** 31 RDMSR. Guest software attempted to execute RDMSR. */
102#define VMX_EXIT_RDMSR 31
103/** 32 WRMSR. Guest software attempted to execute WRMSR. */
104#define VMX_EXIT_WRMSR 32
105/** 33 VM-entry failure due to invalid guest state. */
106#define VMX_EXIT_ERR_INVALID_GUEST_STATE 33
107/** 34 VM-entry failure due to MSR loading. */
108#define VMX_EXIT_ERR_MSR_LOAD 34
109/** 36 Guest software executed MWAIT. */
110#define VMX_EXIT_MWAIT 36
111/** 39 Guest software attempted to execute MONITOR. */
112#define VMX_EXIT_MONITOR 39
113/** 40 Guest software attempted to execute PAUSE. */
114#define VMX_EXIT_PAUSE 40
115/** 41 VM-entry failure due to machine-check. */
116#define VMX_EXIT_ERR_MACHINE_CHECK 41
117/** 43 TPR below threshold. Guest software executed MOV to CR8. */
118#define VMX_EXIT_TPR 43
119
120/** @} */
121
122
123/** VM Instruction Errors
124 * @{
125 */
126/** 1 VMCALL executed in VMX root operation. */
127#define VMX_ERROR_VMCALL 1
128/** 2 VMCLEAR with invalid physical address. */
129#define VMX_ERROR_VMCLEAR_INVALID_PHYS_ADDR 2
130/** 3 VMCLEAR with VMXON pointer. */
131#define VMX_ERROR_VMCLEAR_INVALID_VMXON_PTR 3
132/** 4 VMLAUNCH with non-clear VMCS. */
133#define VMX_ERROR_VMLAUCH_NON_CLEAR_VMCS 4
134/** 5 VMRESUME with non-launched VMCS. */
135#define VMX_ERROR_VMRESUME_NON_LAUNCHED_VMCS 5
136/** 6 VMRESUME with a corrupted VMCS (indicates corruption of the current VMCS). */
137#define VMX_ERROR_VMRESUME_CORRUPTED_VMCS 6
138/** 7 VM entry with invalid control field(s). */
139#define VMX_ERROR_VMENTRY_INVALID_CONTROL_FIELDS 7
140/** 8 VM entry with invalid host-state field(s). */
141#define VMX_ERROR_VMENTRY_INVALID_HOST_STATE 8
142/** 9 VMPTRLD with invalid physical address. */
143#define VMX_ERROR_VMPTRLD_INVALID_PHYS_ADDR 9
144/** 10 VMPTRLD with VMXON pointer. */
145#define VMX_ERROR_VMPTRLD_VMXON_PTR 10
146/** 11 VMPTRLD with incorrect VMCS revision identifier. */
147#define VMX_ERROR_VMPTRLD_WRONG_VMCS_REVISION 11
148/** 12 VMREAD/VMWRITE from/to unsupported VMCS component. */
149#define VMX_ERROR_VMREAD_INVALID_COMPONENT 12
150#define VMX_ERROR_VMWRITE_INVALID_COMPONENT VMX_ERROR_VMREAD_INVALID_COMPONENT
151/** 13 VMWRITE to read-only VMCS component. */
152#define VMX_ERROR_VMWRITE_READONLY_COMPONENT 13
153/** 15 VMXON executed in VMX root operation. */
154#define VMX_ERROR_VMXON_IN_VMX_ROOT_OP 15
155/** 16 VM entry with invalid executive-VMCS pointer. */
156#define VMX_ERROR_VMENTRY_INVALID_VMCS_EXEC_PTR 16
157/** 17 VM entry with non-launched executive VMCS. */
158#define VMX_ERROR_VMENTRY_NON_LAUNCHED_EXEC_VMCS 17
159/** 18 VM entry with executive-VMCS pointer not VMXON pointer. */
160#define VMX_ERROR_VMENTRY_EXEC_VMCS_PTR 18
161/** 19 VMCALL with non-clear VMCS. */
162#define VMX_ERROR_VMCALL_NON_CLEAR_VMCS 19
163/** 20 VMCALL with invalid VM-exit control fields. */
164#define VMX_ERROR_VMCALL_INVALID_VMEXIT_FIELDS 20
165/** 22 VMCALL with incorrect MSEG revision identifier. */
166#define VMX_ERROR_VMCALL_INVALID_MSEG_REVISION 22
167/** 23 VMXOFF under dual-monitor treatment of SMIs and SMM. */
168#define VMX_ERROR_VMXOFF_DUAL_MONITOR 23
169/** 24 VMCALL with invalid SMM-monitor features. */
170#define VMX_ERROR_VMCALL_INVALID_SMM_MONITOR 24
171/** 25 VM entry with invalid VM-execution control fields in executive VMCS. */
172#define VMX_ERROR_VMENTRY_INVALID_VM_EXEC_CTRL 25
173/** 26 VM entry with events blocked by MOV SS. */
174#define VMX_ERROR_VMENTRY_MOV_SS 26
175
176/** @} */
177
178
179/** VMX MSR bit definitions
180 * @{
181 */
182
183/** Basic VMX information.
184 * @{
185 */
186/** VMCS revision identifier used by the processor. */
187#define MSR_IA32_VMX_BASIC_INFO_VMCS_ID(a) (a & 0x7FFFFFFF)
188/** Size of the VMCS. */
189#define MSR_IA32_VMX_BASIC_INFO_VMCS_SIZE(a) ((a >> 31ULL) & 0xFFF)
190/** Width of physical address used for the VMCS.
191 * 0 -> limited to the available amount of physical ram
192 * 1 -> within the first 4 GB
193 */
194#define MSR_IA32_VMX_BASIC_INFO_VMCS_PHYS_WIDTH(a) ((a >> 48ULL) & 1)
195/** Whether the processor supports the dual-monitor treatment of system-management interrupts and system-management code. (always 1) */
196#define MSR_IA32_VMX_BASIC_INFO_VMCS_DUAL_MON(a) ((a >> 49ULL) & 1)
197/** Memory type that must be used for the VMCS. */
198#define MSR_IA32_VMX_BASIC_INFO_VMCS_MEM_TYPE(a) ((a >> 50ULL) & 0xF)
199/** @} */
200
201
202/** Misc VMX info.
203 * @{
204 */
205/** Activity states supported by the implementation. */
206#define MSR_IA32_VMX_MISC_ACTIVITY_STATES(a) ((a >> 6ULL) & 0x7)
207/** Number of CR3 target values supported by the processor. (0-256) */
208#define MSR_IA32_VMX_MISC_CR3_TARGET(a) ((a >> 16ULL) & 0x1FF)
209/** Maximum nr of MSRs in the VMCS. (N+1)*512. */
210#define MSR_IA32_VMX_MISC_MAX_MSR(a) ((((a >> 25ULL) & 0x7) + 1) * 512)
211/** MSEG revision identifier used by the processor. */
212#define MSR_IA32_VMX_MISC_MSEG_ID(a) (a >> 32ULL)
213/** @} */
214
215
216/** VMCS enumeration field info
217 * @{
218 */
219/** Highest field index. */
220#define MSR_IA32_VMX_VMCS_ENUM_HIGHEST_INDEX(a) ((a >> 1ULL) & 0x1FF)
221
222/** @} */
223
224/** @} */
225
226
227/** VMCS field encoding
228 * @{
229 */
230
231/* 16 bits guest fields
232 * @{
233 */
234#define VMX_VMCS_GUEST_FIELD_ES 0x800
235#define VMX_VMCS_GUEST_FIELD_CS 0x802
236#define VMX_VMCS_GUEST_FIELD_SS 0x804
237#define VMX_VMCS_GUEST_FIELD_DS 0x806
238#define VMX_VMCS_GUEST_FIELD_FS 0x808
239#define VMX_VMCS_GUEST_FIELD_GS 0x80A
240#define VMX_VMCS_GUEST_FIELD_LDTR 0x80C
241#define VMX_VMCS_GUEST_FIELD_TR 0x80E
242/** @} */
243
244/** 16 bits host fields
245 * @{
246 */
247#define VMX_VMCS_HOST_FIELD_ES 0xC00
248#define VMX_VMCS_HOST_FIELD_CS 0xC02
249#define VMX_VMCS_HOST_FIELD_SS 0xC04
250#define VMX_VMCS_HOST_FIELD_DS 0xC06
251#define VMX_VMCS_HOST_FIELD_FS 0xC08
252#define VMX_VMCS_HOST_FIELD_GS 0xC0A
253#define VMX_VMCS_HOST_FIELD_TR 0xC0C
254/** @} */
255
256/** 64 Bits control fields
257 * @{
258 */
259#define VMX_VMCS_CTRL_IO_BITMAP_A_FULL 0x2000
260#define VMX_VMCS_CTRL_IO_BITMAP_A_HIGH 0x2001
261#define VMX_VMCS_CTRL_IO_BITMAP_B_FULL 0x2002
262#define VMX_VMCS_CTRL_IO_BITMAP_B_HIGH 0x2003
263
264/* Optional */
265#define VMX_VMCS_CTRL_MSR_BITMAP_FULL 0x2004
266#define VMX_VMCS_CTRL_MSR_BITMAP_HIGH 0x2005
267
268#define VMX_VMCS_CTRL_VMEXIT_MSR_STORE_FULL 0x2006
269#define VMX_VMCS_CTRL_VMEXIT_MSR_STORE_HIGH 0x2007
270#define VMX_VMCS_CTRL_VMEXIT_MSR_LOAD_FULL 0x2008
271#define VMX_VMCS_CTRL_VMEXIT_MSR_LOAD_HIGH 0x2009
272
273#define VMX_VMCS_CTRL_VMENTRY_MSR_LOAD_FULL 0x200A
274#define VMX_VMCS_CTRL_VMENTRY_MSR_LOAD_HIGH 0x200B
275
276#define VMX_VMCS_CTRL_EXEC_VMCS_PTR_FULL 0x200C
277#define VMX_VMCS_CTRL_EXEC_VMCS_PTR_HIGH 0x200D
278
279#define VMX_VMCS_CTRL_TSC_OFFSET_FULL 0x2010
280#define VMX_VMCS_CTRL_TSC_OFFSET_HIGH 0x2011
281
282/* Optional */
283#define VMX_VMCS_CTRL_VAPIC_PAGEADDR_FULL 0x2012
284#define VMX_VMCS_CTRL_VAPIC_PAGEADDR_HIGH 0x2013
285/** @} */
286
287
288/** 64 Bits guest fields
289 * @{
290 */
291#define VMX_VMCS_GUEST_LINK_PTR_FULL 0x2800
292#define VMX_VMCS_GUEST_LINK_PTR_HIGH 0x2801
293#define VMX_VMCS_GUEST_DEBUGCTL_FULL 0x2802 /* MSR IA32_DEBUGCTL */
294#define VMX_VMCS_GUEST_DEBUGCTL_HIGH 0x2803 /* MSR IA32_DEBUGCTL */
295/** @} */
296
297
298/** 32 Bits control fields
299 * @{
300 */
301#define VMX_VMCS_CTRL_PIN_EXEC_CONTROLS 0x4000
302#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS 0x4002
303#define VMX_VMCS_CTRL_EXCEPTION_BITMAP 0x4004
304#define VMX_VMCS_CTRL_PAGEFAULT_ERROR_MASK 0x4006
305#define VMX_VMCS_CTRL_PAGEFAULT_ERROR_MATCH 0x4008
306#define VMX_VMCS_CTRL_CR3_TARGET_COUNT 0x400A
307#define VMX_VMCS_CTRL_EXIT_CONTROLS 0x400C
308#define VMX_VMCS_CTRL_EXIT_MSR_STORE_COUNT 0x400E
309#define VMX_VMCS_CTRL_EXIT_MSR_LOAD_COUNT 0x4010
310#define VMX_VMCS_CTRL_ENTRY_CONTROLS 0x4012
311#define VMX_VMCS_CTRL_ENTRY_MSR_LOAD_COUNT 0x4014
312#define VMX_VMCS_CTRL_ENTRY_IRQ_INFO 0x4016
313#define VMX_VMCS_CTRL_ENTRY_EXCEPTION_ERRCODE 0x4018
314#define VMX_VMCS_CTRL_ENTRY_INSTR_LENGTH 0x401A
315/* Optional */
316#define VMX_VMCS_CTRL_TPR_TRESHOLD 0x401C
317/** @} */
318
319
320/** VMX_VMCS_CTRL_PIN_EXEC_CONTROLS
321 * @{
322 */
323/* External interrupts cause VM exits if set; otherwise dispatched through the guest's IDT. */
324#define VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_EXT_INT_EXIT RT_BIT(0)
325/* Non-maskable interrupts cause VM exits if set; otherwise dispatched through the guest's IDT. */
326#define VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_NMI_EXIT RT_BIT(3)
327/* All other bits are reserved and must be set according to MSR IA32_VMX_PROCBASED_CTLS. */
328/** @} */
329
330
331/** VMX_VMCS_CTRL_PROC_EXEC_CONTROLS
332 * @{
333 */
334/* VM Exit as soon as RFLAGS.IF=1 and no blocking is active. */
335#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT RT_BIT(2)
336/* Use timestamp counter offset. */
337#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_TSC_OFFSET RT_BIT(3)
338/* VM Exit when executing the HLT instruction. */
339#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_HLT_EXIT RT_BIT(7)
340/* VM Exit when executing the INVLPG instruction. */
341#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_INVLPG_EXIT RT_BIT(9)
342/* VM Exit when executing the MWAIT instruction. */
343#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_MWAIT_EXIT RT_BIT(10)
344/* VM Exit when executing the RDPMC instruction. */
345#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDPMC_EXIT RT_BIT(11)
346/* VM Exit when executing the RDTSC instruction. */
347#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT RT_BIT(12)
348/* VM Exit on CR8 loads. */
349#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_LOAD_EXIT RT_BIT(19)
350/* VM Exit on CR8 stores. */
351#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_STORE_EXIT RT_BIT(20)
352/* Use TPR shadow. */
353#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW RT_BIT(21)
354/* VM Exit when executing a MOV DRx instruction. */
355#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_MOV_DR_EXIT RT_BIT(23)
356/* VM Exit when executing IO instructions. */
357#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_UNCOND_IO_EXIT RT_BIT(24)
358/* Use IO bitmaps. */
359#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_IO_BITMAPS RT_BIT(25)
360/* Use MSR bitmaps. */
361#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_MSR_BITMAPS RT_BIT(28)
362/* VM Exit when executing the MONITOR instruction. */
363#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_MONITOR_EXIT RT_BIT(29)
364/* VM Exit when executing the PAUSE instruction. */
365#define VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_PAUSE_EXIT RT_BIT(30)
366/** @} */
367
368
369/** VMX_VMCS_CTRL_ENTRY_CONTROLS
370 * @{
371 */
372/** 64 bits guest mode. Must be 0 for CPUs that don't support AMD64. */
373#define VMX_VMCS_CTRL_ENTRY_CONTROLS_IA64_MODE RT_BIT(9)
374/** In SMM mode after VM-entry. */
375#define VMX_VMCS_CTRL_ENTRY_CONTROLS_ENTRY_SMM RT_BIT(10)
376/** Disable dual treatment of SMI and SMM; must be zero for VM-entry outside of SMM. */
377#define VMX_VMCS_CTRL_ENTRY_CONTROLS_DEACTIVATE_DUALMON RT_BIT(11)
378/** @} */
379
380
381/** VMX_VMCS_CTRL_EXIT_CONTROLS
382 * @{
383 */
384/** Return to long mode after a VM-exit. */
385#define VMX_VMCS_CTRL_EXIT_CONTROLS_HOST_AMD64 RT_BIT(9)
386/** Acknowledge external interrupts with the irq controller if one caused a VM-exit. */
387#define VMX_VMCS_CTRL_EXIT_CONTROLS_ACK_EXTERNAL_IRQ RT_BIT(15)
388/** @} */
389
390/** 32 Bits read-only fields
391 * @{
392 */
393#define VMX_VMCS_RO_VM_INSTR_ERROR 0x4400
394#define VMX_VMCS_RO_EXIT_REASON 0x4402
395#define VMX_VMCS_RO_EXIT_INTERRUPTION_INFO 0x4404
396#define VMX_VMCS_RO_EXIT_INTERRUPTION_ERRCODE 0x4406
397#define VMX_VMCS_RO_IDT_INFO 0x4408
398#define VMX_VMCS_RO_IDT_ERRCODE 0x440A
399#define VMX_VMCS_RO_EXIT_INSTR_LENGTH 0x440C
400#define VMX_VMCS_RO_EXIT_INSTR_INFO 0x440E
401/** @} */
402
403/** VMX_VMCS_RO_EXIT_INTERRUPTION_INFO
404 * @{
405 */
406#define VMX_EXIT_INTERRUPTION_INFO_VECTOR(a) (a & 0xff)
407#define VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT 8
408#define VMX_EXIT_INTERRUPTION_INFO_TYPE(a) ((a >> VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT) & 7)
409#define VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID RT_BIT(11)
410#define VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_IS_VALID(a) (a & VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID)
411#define VMX_EXIT_INTERRUPTION_INFO_NMI_UNBLOCK(a) (a & RT_BIT(12))
412#define VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT 31
413#define VMX_EXIT_INTERRUPTION_INFO_VALID(a) (a & RT_BIT(31))
414/* Construct an irq event injection value from the exit interruption info value (same except that bit 12 is reserved). */
415#define VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(a) (a & ~RT_BIT(12))
416/** @} */
417
418/** VMX_VMCS_RO_EXIT_INTERRUPTION_INFO_TYPE
419 * @{
420 */
421#define VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT 0
422#define VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI 2
423#define VMX_EXIT_INTERRUPTION_INFO_TYPE_HWEXCPT 3
424#define VMX_EXIT_INTERRUPTION_INFO_TYPE_SW 4 /* int xx */
425#define VMX_EXIT_INTERRUPTION_INFO_TYPE_SWEXCPT 6
426/** @} */
427
428
429/** 32 Bits guest state fields
430 * @{
431 */
432#define VMX_VMCS_GUEST_ES_LIMIT 0x4800
433#define VMX_VMCS_GUEST_CS_LIMIT 0x4802
434#define VMX_VMCS_GUEST_SS_LIMIT 0x4804
435#define VMX_VMCS_GUEST_DS_LIMIT 0x4806
436#define VMX_VMCS_GUEST_FS_LIMIT 0x4808
437#define VMX_VMCS_GUEST_GS_LIMIT 0x480A
438#define VMX_VMCS_GUEST_LDTR_LIMIT 0x480C
439#define VMX_VMCS_GUEST_TR_LIMIT 0x480E
440#define VMX_VMCS_GUEST_GDTR_LIMIT 0x4810
441#define VMX_VMCS_GUEST_IDTR_LIMIT 0x4812
442#define VMX_VMCS_GUEST_ES_ACCESS_RIGHTS 0x4814
443#define VMX_VMCS_GUEST_CS_ACCESS_RIGHTS 0x4816
444#define VMX_VMCS_GUEST_SS_ACCESS_RIGHTS 0x4818
445#define VMX_VMCS_GUEST_DS_ACCESS_RIGHTS 0x481A
446#define VMX_VMCS_GUEST_FS_ACCESS_RIGHTS 0x481C
447#define VMX_VMCS_GUEST_GS_ACCESS_RIGHTS 0x481E
448#define VMX_VMCS_GUEST_LDTR_ACCESS_RIGHTS 0x4820
449#define VMX_VMCS_GUEST_TR_ACCESS_RIGHTS 0x4822
450#define VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE 0x4824
451#define VMX_VMCS_GUEST_ACTIVITY_STATE 0x4826
452#define VMX_VMCS_GUEST_SYSENTER_CS 0x482A /* MSR IA32_SYSENTER_CS */
453/** @} */
454
455
456/** VMX_VMCS_GUEST_ACTIVITY_STATE
457 * @{
458 */
459/* The logical processor is active. */
460#define VMX_CMS_GUEST_ACTIVITY_ACTIVE 0x0
461/* The logical processor is inactive, because executed a HLT instruction. */
462#define VMX_CMS_GUEST_ACTIVITY_HLT 0x1
463/* The logical processor is inactive, because of a triple fault or other serious error. */
464#define VMX_CMS_GUEST_ACTIVITY_SHUTDOWN 0x2
465/* The logical processor is inactive, because it's waiting for a startup-IPI */
466#define VMX_CMS_GUEST_ACTIVITY_SIPI_WAIT 0x3
467/** @} */
468
469
470/** VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE
471 * @{
472 */
473#define VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI RT_BIT(0)
474#define VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS RT_BIT(1)
475#define VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_SMI RT_BIT(2)
476#define VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_NMI RT_BIT(3)
477/** @} */
478
479
480/** 32 Bits host state fields
481 * @{
482 */
483#define VMX_VMCS_HOST_SYSENTER_CS 0x4C00
484/** @} */
485
486/** Natural width control fields
487 * @{
488 */
489#define VMX_VMCS_CTRL_CR0_MASK 0x6000
490#define VMX_VMCS_CTRL_CR4_MASK 0x6002
491#define VMX_VMCS_CTRL_CR0_READ_SHADOW 0x6004
492#define VMX_VMCS_CTRL_CR4_READ_SHADOW 0x6006
493#define VMX_VMCS_CTRL_CR3_TARGET_VAL0 0x6008
494#define VMX_VMCS_CTRL_CR3_TARGET_VAL1 0x600A
495#define VMX_VMCS_CTRL_CR3_TARGET_VAL2 0x600C
496#define VMX_VMCS_CTRL_CR3_TARGET_VAL31 0x600E
497/** @} */
498
499
500/** Natural width read-only data fields
501 * @{
502 */
503#define VMX_VMCS_RO_EXIT_QUALIFICATION 0x6400
504#define VMX_VMCS_RO_IO_RCX 0x6402
505#define VMX_VMCS_RO_IO_RSX 0x6404
506#define VMX_VMCS_RO_IO_RDI 0x6406
507#define VMX_VMCS_RO_IO_RIP 0x6408
508#define VMX_VMCS_GUEST_LINEAR_ADDR 0x640A
509/** @} */
510
511
512/** VMX_VMCS_RO_EXIT_QUALIFICATION
513 * @{
514 */
515
516/** DRx moves
517 * @{
518 */
519/** 0-2: Debug register number */
520#define VMX_EXIT_QUALIFICATION_DRX_REGISTER(a) (a & 7)
521/** 3: Reserved; cleared to 0. */
522#define VMX_EXIT_QUALIFICATION_DRX_RES1(a) ((a >> 3) & 1)
523/** 4: Direction of move (0 = write, 1 = read) */
524#define VMX_EXIT_QUALIFICATION_DRX_DIRECTION(a) ((a >> 4) & 1)
525/** 5-7: Reserved; cleared to 0. */
526#define VMX_EXIT_QUALIFICATION_DRX_RES2(a) ((a >> 5) & 7)
527/** 8-11: General purpose register number. */
528#define VMX_EXIT_QUALIFICATION_DRX_GENREG(a) ((a >> 8) & 0xF)
529/** Rest: reserved. */
530
531/** VMX_EXIT_QUALIFICATION_DRX_DIRECTION
532 * @{
533 */
534#define VMX_EXIT_QUALIFICATION_DRX_DIRECTION_WRITE 0
535#define VMX_EXIT_QUALIFICATION_DRX_DIRECTION_READ 1
536/** @} */
537
538/** @} */
539
540
541/** CRx accesses
542 * @{
543 */
544/** 0-3: Control register number (0 for CLTS & LMSW) */
545#define VMX_EXIT_QUALIFICATION_CRX_REGISTER(a) (a & 0xF)
546/** 4-5: Access type. */
547#define VMX_EXIT_QUALIFICATION_CRX_ACCESS(a) ((a >> 4) & 3)
548/** 6: LMSW operand type */
549#define VMX_EXIT_QUALIFICATION_CRX_LMSW_OP(a) ((a >> 6) & 1)
550/** 7: Reserved; cleared to 0. */
551#define VMX_EXIT_QUALIFICATION_CRX_RES1(a) ((a >> 7) & 1)
552/** 8-11: General purpose register number (0 for CLTS & LMSW). */
553#define VMX_EXIT_QUALIFICATION_CRX_GENREG(a) ((a >> 8) & 0xF)
554/** 12-15: Reserved; cleared to 0. */
555#define VMX_EXIT_QUALIFICATION_CRX_RES2(a) ((a >> 12) & 0xF)
556/** 16-31: LMSW source data (else 0). */
557#define VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(a) ((a >> 16) & 0xFFFF)
558/** Rest: reserved. */
559
560
561/** VMX_EXIT_QUALIFICATION_CRX_ACCESS
562 * @{
563 */
564#define VMX_EXIT_QUALIFICATION_CRX_ACCESS_WRITE 0
565#define VMX_EXIT_QUALIFICATION_CRX_ACCESS_READ 1
566#define VMX_EXIT_QUALIFICATION_CRX_ACCESS_CLTS 2
567#define VMX_EXIT_QUALIFICATION_CRX_ACCESS_LMSW 3
568/** @} */
569
570/** @} */
571
572
573/** VMX_EXIT_PORT_IO
574 * @{
575 */
576/** 0-2: IO operation width. */
577#define VMX_EXIT_QUALIFICATION_IO_WIDTH(a) (a & 7)
578/** 3: IO operation direction. */
579#define VMX_EXIT_QUALIFICATION_IO_DIRECTION(a) ((a >> 3) & 1)
580/** 4: String IO operation. */
581#define VMX_EXIT_QUALIFICATION_IO_STRING(a) ((a >> 4) & 1)
582/** 5: Repeated IO operation. */
583#define VMX_EXIT_QUALIFICATION_IO_REP(a) ((a >> 5) & 1)
584/** 6: Operand encoding. */
585#define VMX_EXIT_QUALIFICATION_IO_ENCODING(a) ((a >> 6) & 1)
586/** 16-31: IO Port (0-0xffff). */
587#define VMX_EXIT_QUALIFICATION_IO_PORT(a) ((a >> 16) & 0xffff)
588/* Rest reserved. */
589/** @} */
590
591/** VMX_EXIT_QUALIFICATION_IO_DIRECTION
592 * @{
593 */
594#define VMX_EXIT_QUALIFICATION_IO_DIRECTION_OUT 0
595#define VMX_EXIT_QUALIFICATION_IO_DIRECTION_IN 1
596/** @} */
597
598
599/** VMX_EXIT_QUALIFICATION_IO_ENCODING
600 * @{
601 */
602#define VMX_EXIT_QUALIFICATION_IO_ENCODING_DX 0
603#define VMX_EXIT_QUALIFICATION_IO_ENCODING_IMM 1
604/** @} */
605
606/** @} */
607
608/** Natural width guest state fields
609 * @{
610 */
611#define VMX_VMCS_GUEST_CR0 0x6800
612#define VMX_VMCS_GUEST_CR3 0x6802
613#define VMX_VMCS_GUEST_CR4 0x6804
614#define VMX_VMCS_GUEST_ES_BASE 0x6806
615#define VMX_VMCS_GUEST_CS_BASE 0x6808
616#define VMX_VMCS_GUEST_SS_BASE 0x680A
617#define VMX_VMCS_GUEST_DS_BASE 0x680C
618#define VMX_VMCS_GUEST_FS_BASE 0x680E
619#define VMX_VMCS_GUEST_GS_BASE 0x6810
620#define VMX_VMCS_GUEST_LDTR_BASE 0x6812
621#define VMX_VMCS_GUEST_TR_BASE 0x6814
622#define VMX_VMCS_GUEST_GDTR_BASE 0x6816
623#define VMX_VMCS_GUEST_IDTR_BASE 0x6818
624#define VMX_VMCS_GUEST_DR7 0x681A
625#define VMX_VMCS_GUEST_RSP 0x681C
626#define VMX_VMCS_GUEST_RIP 0x681E
627#define VMX_VMCS_GUEST_RFLAGS 0x6820
628#define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS 0x6822
629#define VMX_VMCS_GUEST_SYSENTER_ESP 0x6824 /* MSR IA32_SYSENTER_ESP */
630#define VMX_VMCS_GUEST_SYSENTER_EIP 0x6826 /* MSR IA32_SYSENTER_EIP */
631/** @} */
632
633
634/** VMX_VMCS_GUEST_DEBUG_EXCEPTIONS
635 * @{
636 */
637/* Hardware breakpoint 0 was met. */
638#define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_B0 RT_BIT(0)
639/* Hardware breakpoint 1 was met. */
640#define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_B1 RT_BIT(1)
641/* Hardware breakpoint 2 was met. */
642#define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_B2 RT_BIT(2)
643/* Hardware breakpoint 3 was met. */
644#define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_B3 RT_BIT(3)
645/* At least one data or IO breakpoint was hit. */
646#define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_BREAKPOINT_ENABLED RT_BIT(12)
647/* A debug exception would have been triggered by single-step execution mode. */
648#define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_BS RT_BIT(14)
649/* Bits 4-11, 13 and 15-63 are reserved. */
650
651
652
653
654/** @} */
655
656/** Natural width host state fields
657 * @{
658 */
659#define VMX_VMCS_HOST_CR0 0x6C00
660#define VMX_VMCS_HOST_CR3 0x6C02
661#define VMX_VMCS_HOST_CR4 0x6C04
662#define VMX_VMCS_HOST_FS_BASE 0x6C06
663#define VMX_VMCS_HOST_GS_BASE 0x6C08
664#define VMX_VMCS_HOST_TR_BASE 0x6C0A
665#define VMX_VMCS_HOST_GDTR_BASE 0x6C0C
666#define VMX_VMCS_HOST_IDTR_BASE 0x6C0E
667#define VMX_VMCS_HOST_SYSENTER_ESP 0x6C10
668#define VMX_VMCS_HOST_SYSENTER_EIP 0x6C12
669#define VMX_VMCS_HOST_RSP 0x6C14
670#define VMX_VMCS_HOST_RIP 0x6C16
671/** @} */
672
673/** @} */
674
675
676#if RT_INLINE_ASM_GNU_STYLE
677# define __STR(x) #x
678# define STR(x) __STR(x)
679#endif
680
681
682/** @} */
683
684/** @defgroup grp_vmx_asm vmx assembly helpers
685 * @ingroup grp_vmx
686 * @{
687 */
688
689/**
690 * Executes VMXON
691 *
692 * @returns VBox status code
693 * @param pVMXOn Physical address of VMXON structure
694 */
695#if RT_INLINE_ASM_EXTERNAL || HC_ARCH_BITS == 64
696DECLASM(int) VMXEnable(RTHCPHYS pVMXOn);
697#else
698DECLINLINE(int) VMXEnable(RTHCPHYS pVMXOn)
699{
700 int rc = VINF_SUCCESS;
701# if RT_INLINE_ASM_GNU_STYLE
702 __asm__ __volatile__ (
703 "push %3 \n\t"
704 "push %2 \n\t"
705 ".byte 0xF3, 0x0F, 0xC7, 0x34, 0x24 # VMXON [esp] \n\t"
706 "ja 2f \n\t"
707 "je 1f \n\t"
708 "movl $"STR(VERR_VMX_INVALID_VMXON_PTR)", %0 \n\t"
709 "jmp 2f \n\t"
710 "1: \n\t"
711 "movl $"STR(VERR_VMX_GENERIC)", %0 \n\t"
712 "2: \n\t"
713 "add $8, %%esp \n\t"
714 :"=rm"(rc)
715 :"0"(VINF_SUCCESS),
716 "ir"((uint32_t)pVMXOn), /* don't allow direct memory reference here, */
717 "ir"((uint32_t)(pVMXOn >> 32)) /* this would not work with -fomit-frame-pointer */
718 :"memory"
719 );
720# else
721 __asm
722 {
723 push dword ptr [pVMXOn+4]
724 push dword ptr [pVMXOn]
725 _emit 0xF3
726 _emit 0x0F
727 _emit 0xC7
728 _emit 0x34
729 _emit 0x24 /* VMXON [esp] */
730 jnc vmxon_good
731 mov dword ptr [rc], VERR_VMX_INVALID_VMXON_PTR
732 jmp the_end
733
734vmxon_good:
735 jnz the_end
736 mov dword ptr [rc], VERR_VMX_GENERIC
737the_end:
738 add esp, 8
739 }
740# endif
741 return rc;
742}
743#endif
744
745
746/**
747 * Executes VMXOFF
748 */
749#if RT_INLINE_ASM_EXTERNAL || HC_ARCH_BITS == 64
750DECLASM(void) VMXDisable(void);
751#else
752DECLINLINE(void) VMXDisable(void)
753{
754# if RT_INLINE_ASM_GNU_STYLE
755 __asm__ __volatile__ (
756 ".byte 0x0F, 0x01, 0xC4 # VMXOFF \n\t"
757 );
758# else
759 __asm
760 {
761 _emit 0x0F
762 _emit 0x01
763 _emit 0xC4 /* VMXOFF */
764 }
765# endif
766}
767#endif
768
769
770/**
771 * Executes VMCLEAR
772 *
773 * @returns VBox status code
774 * @param pVMCS Physical address of VM control structure
775 */
776#if RT_INLINE_ASM_EXTERNAL || HC_ARCH_BITS == 64
777DECLASM(int) VMXClearVMCS(RTHCPHYS pVMCS);
778#else
779DECLINLINE(int) VMXClearVMCS(RTHCPHYS pVMCS)
780{
781 int rc = VINF_SUCCESS;
782# if RT_INLINE_ASM_GNU_STYLE
783 __asm__ __volatile__ (
784 "push %3 \n\t"
785 "push %2 \n\t"
786 ".byte 0x66, 0x0F, 0xC7, 0x34, 0x24 # VMCLEAR [esp] \n\t"
787 "jnc 1f \n\t"
788 "movl $"STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
789 "1: \n\t"
790 "add $8, %%esp \n\t"
791 :"=rm"(rc)
792 :"0"(VINF_SUCCESS),
793 "ir"((uint32_t)pVMCS), /* don't allow direct memory reference here, */
794 "ir"((uint32_t)(pVMCS >> 32)) /* this would not work with -fomit-frame-pointer */
795 :"memory"
796 );
797# else
798 __asm
799 {
800 push dword ptr [pVMCS+4]
801 push dword ptr [pVMCS]
802 _emit 0x66
803 _emit 0x0F
804 _emit 0xC7
805 _emit 0x34
806 _emit 0x24 /* VMCLEAR [esp] */
807 jnc success
808 mov dword ptr [rc], VERR_VMX_INVALID_VMCS_PTR
809success:
810 add esp, 8
811 }
812# endif
813 return rc;
814}
815#endif
816
817
818/**
819 * Executes VMPTRLD
820 *
821 * @returns VBox status code
822 * @param pVMCS Physical address of VMCS structure
823 */
824#if RT_INLINE_ASM_EXTERNAL || HC_ARCH_BITS == 64
825DECLASM(int) VMXActivateVMCS(RTHCPHYS pVMCS);
826#else
827DECLINLINE(int) VMXActivateVMCS(RTHCPHYS pVMCS)
828{
829 int rc = VINF_SUCCESS;
830# if RT_INLINE_ASM_GNU_STYLE
831 __asm__ __volatile__ (
832 "push %3 \n\t"
833 "push %2 \n\t"
834 ".byte 0x0F, 0xC7, 0x34, 0x24 # VMPTRLD [esp] \n\t"
835 "jnc 1f \n\t"
836 "movl $"STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
837 "1: \n\t"
838 "add $8, %%esp \n\t"
839 :"=rm"(rc)
840 :"0"(VINF_SUCCESS),
841 "ir"((uint32_t)pVMCS), /* don't allow direct memory reference here, */
842 "ir"((uint32_t)(pVMCS >> 32)) /* this will not work with -fomit-frame-pointer */
843 );
844# else
845 __asm
846 {
847 push dword ptr [pVMCS+4]
848 push dword ptr [pVMCS]
849 _emit 0x0F
850 _emit 0xC7
851 _emit 0x34
852 _emit 0x24 /* VMPTRLD [esp] */
853 jnc success
854 mov dword ptr [rc], VERR_VMX_INVALID_VMCS_PTR
855
856success:
857 add esp, 8
858 }
859# endif
860 return rc;
861}
862#endif
863
864
865/**
866 * Executes VMWRITE
867 *
868 * @returns VBox status code
869 * @param idxField VMCS index
870 * @param u64Val 16, 32 or 64 bits value
871 */
872DECLASM(int) VMXWriteVMCS64(uint32_t idxField, uint64_t u64Val);
873
874/**
875 * Executes VMWRITE
876 *
877 * @returns VBox status code
878 * @param idxField VMCS index
879 * @param u32Val 32 bits value
880 */
881#if RT_INLINE_ASM_EXTERNAL || HC_ARCH_BITS == 64
882DECLASM(int) VMXWriteVMCS32(uint32_t idxField, uint32_t u32Val);
883#else
884DECLINLINE(int) VMXWriteVMCS32(uint32_t idxField, uint32_t u32Val)
885{
886 int rc = VINF_SUCCESS;
887# if RT_INLINE_ASM_GNU_STYLE
888 __asm__ __volatile__ (
889 ".byte 0x0F, 0x79, 0xC2 # VMWRITE eax, edx \n\t"
890 "ja 2f \n\t"
891 "je 1f \n\t"
892 "movl $"STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
893 "jmp 2f \n\t"
894 "1: \n\t"
895 "movl $"STR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t"
896 "2: \n\t"
897 :"=rm"(rc)
898 :"0"(VINF_SUCCESS),
899 "a"(idxField),
900 "d"(u32Val)
901 );
902# else
903 __asm
904 {
905 push dword ptr [u32Val]
906 mov eax, [idxField]
907 _emit 0x0F
908 _emit 0x79
909 _emit 0x04
910 _emit 0x24 /* VMWRITE eax, [esp] */
911 jnc valid_vmcs
912 mov dword ptr [rc], VERR_VMX_INVALID_VMCS_PTR
913 jmp the_end
914
915valid_vmcs:
916 jnz the_end
917 mov dword ptr [rc], VERR_VMX_INVALID_VMCS_FIELD
918the_end:
919 add esp, 4
920 }
921# endif
922 return rc;
923}
924#endif
925
926#if HC_ARCH_BITS == 64
927#define VMXWriteVMCS VMXWriteVMCS64
928#else
929#define VMXWriteVMCS VMXWriteVMCS32
930#endif /* HC_ARCH_BITS == 64 */
931
932
933/**
934 * Executes VMREAD
935 *
936 * @returns VBox status code
937 * @param idxField VMCS index
938 * @param pData Ptr to store VM field value
939 */
940DECLASM(int) VMXReadVMCS64(uint32_t idxField, uint64_t *pData);
941
942/**
943 * Executes VMREAD
944 *
945 * @returns VBox status code
946 * @param idxField VMCS index
947 * @param pData Ptr to store VM field value
948 */
949#if RT_INLINE_ASM_EXTERNAL || HC_ARCH_BITS == 64
950DECLASM(int) VMXReadVMCS32(uint32_t idxField, uint32_t *pData);
951#else
952DECLINLINE(int) VMXReadVMCS32(uint32_t idxField, uint32_t *pData)
953{
954 int rc = VINF_SUCCESS;
955# if RT_INLINE_ASM_GNU_STYLE
956 __asm__ __volatile__ (
957 "movl $"STR(VINF_SUCCESS)", %0 \n\t"
958 ".byte 0x0F, 0x78, 0xc2 # VMREAD eax, edx \n\t"
959 "ja 2f \n\t"
960 "je 1f \n\t"
961 "movl $"STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
962 "jmp 2f \n\t"
963 "1: \n\t"
964 "movl $"STR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t"
965 "2: \n\t"
966 :"=&r"(rc),
967 "=d"(*pData)
968 :"a"(idxField),
969 "d"(0)
970 );
971# else
972 __asm
973 {
974 sub esp, 4
975 mov dword ptr [esp], 0
976 mov eax, [idxField]
977 _emit 0x0F
978 _emit 0x78
979 _emit 0x04
980 _emit 0x24 /* VMREAD eax, [esp] */
981 mov edx, pData
982 pop dword ptr [edx]
983 jnc valid_vmcs
984 mov dword ptr [rc], VERR_VMX_INVALID_VMCS_PTR
985 jmp the_end
986
987valid_vmcs:
988 jnz the_end
989 mov dword ptr [rc], VERR_VMX_INVALID_VMCS_FIELD
990the_end:
991 }
992# endif
993 return rc;
994}
995#endif
996
997#if HC_ARCH_BITS == 64
998#define VMXReadVMCS VMXReadVMCS64
999#else
1000#define VMXReadVMCS VMXReadVMCS32
1001#endif /* HC_ARCH_BITS == 64 */
1002
1003/**
1004 * Prepares for and executes VMLAUNCH
1005 *
1006 * @returns VBox status code
1007 * @param pCtx Guest context
1008 */
1009DECLASM(int) VMXStartVM(PCPUMCTX pCtx);
1010
1011/**
1012 * Prepares for and executes VMRESUME
1013 *
1014 * @returns VBox status code
1015 * @param pCtx Guest context
1016 */
1017DECLASM(int) VMXResumeVM(PCPUMCTX pCtx);
1018
1019/**
1020 * Gets the last instruction error value from the current VMCS
1021 *
1022 * @returns error value
1023 */
1024DECLINLINE(uint32_t) VMXGetLastError(void)
1025{
1026#if HC_ARCH_BITS == 64
1027 uint64_t uLastError = 0;
1028 int rc = VMXReadVMCS(VMX_VMCS_RO_VM_INSTR_ERROR, &uLastError);
1029 AssertRC(rc);
1030 return (uint32_t)uLastError;
1031
1032#else /* 32-bit host: */
1033 uint32_t lasterr = 0;
1034 int rc;
1035
1036 rc = VMXReadVMCS32(VMX_VMCS_RO_VM_INSTR_ERROR, &lasterr);
1037 AssertRC(rc);
1038 return lasterr;
1039#endif
1040}
1041
1042/** @} */
1043
1044#endif
1045
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