Moved VMX field definitions into appropriate header
This commit is contained in:
parent
4e110312e9
commit
c226f85b5f
2 changed files with 71 additions and 72 deletions
|
|
@ -3,9 +3,79 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define VM_ENTRY_CONTROLS 0x4012
|
/* begin VMX field definitions */
|
||||||
|
|
||||||
|
#define GUEST_ES_SELECTOR 0x0800
|
||||||
|
#define GUEST_CS_SELECTOR 0x0802
|
||||||
|
#define GUEST_SS_SELECTOR 0x0804
|
||||||
|
#define GUEST_DS_SELECTOR 0x0806
|
||||||
|
#define GUEST_FS_SELECTOR 0x0808
|
||||||
|
#define GUEST_GS_SELECTOR 0x080A
|
||||||
|
|
||||||
|
#define HOST_ES_SELECTOR 0x0C00
|
||||||
|
#define HOST_CS_SELECTOR 0x0C02
|
||||||
|
#define HOST_SS_SELECTOR 0x0C04
|
||||||
|
#define HOST_DS_SELECTOR 0x0C06
|
||||||
|
#define HOST_FS_SELECTOR 0x0C08
|
||||||
|
#define HOST_GS_SELECTOR 0x0C0A
|
||||||
|
#define HOST_TR_SELECTOR 0x0C0C
|
||||||
|
|
||||||
|
#define VMCS_LINK_POINTER 0x2800
|
||||||
|
#define GUEST_IA32_DEBUGCTL 0x2802
|
||||||
|
#define GUEST_IA32_PAT 0x2804
|
||||||
|
#define GUEST_IA32_EFER 0x2806
|
||||||
|
|
||||||
|
#define HOST_IA32_PAT 0x2C00
|
||||||
|
#define HOST_IA32_EFER 0x2C02
|
||||||
|
|
||||||
|
#define PIN_BASED_VM_EXEC_CONTROL 0x4000
|
||||||
|
#define CPU_BASED_VM_EXEC_CONTROL 0x4002
|
||||||
|
#define EXCEPTION_BITMAP 0x4004
|
||||||
|
#define CR3_TARGET_COUNT 0x400A
|
||||||
|
#define VM_EXIT_CONTROLS 0x400C
|
||||||
|
#define VM_ENTRY_CONTROLS 0x4012
|
||||||
|
#define VM_ENTRY_MSR_LOAD_COUNT 0x4014
|
||||||
|
#define VM_ENTRY_INTR_INFO_FIELD 0x4016
|
||||||
|
#define CPU_BASED_VM_EXEC_CONTROL2 0x401E
|
||||||
|
|
||||||
#define VMCS_INSTRUCTION_ERROR 0x4400
|
#define VMCS_INSTRUCTION_ERROR 0x4400
|
||||||
|
|
||||||
|
#define GUEST_ES_LIMIT 0x4800
|
||||||
|
#define GUEST_ES_ACCESS 0x4814
|
||||||
|
#define GUEST_SYSENTER_CS 0x482A
|
||||||
|
|
||||||
|
#define HOST_SYSENTER_CS 0x4C00
|
||||||
|
|
||||||
|
#define GUEST_CR0 0x6800
|
||||||
|
#define GUEST_CR3 0x6802
|
||||||
|
#define GUEST_CR4 0x6804
|
||||||
|
#define GUEST_ES_BASE 0x6806
|
||||||
|
#define GUEST_FS_BASE 0x680E
|
||||||
|
#define GUEST_GS_BASE 0x6810
|
||||||
|
#define GUEST_GDTR_BASE 0x6816
|
||||||
|
#define GUEST_IDTR_BASE 0x6818
|
||||||
|
#define GUEST_DR7 0x681A
|
||||||
|
#define GUEST_RSP 0x681C
|
||||||
|
#define GUEST_RIP 0x681E
|
||||||
|
#define GUEST_RFLAGS 0x6820
|
||||||
|
#define GUEST_SYSENTER_ESP 0x6824
|
||||||
|
#define GUEST_SYSENTER_EIP 0x6826
|
||||||
|
|
||||||
|
#define HOST_CR0 0x6C00
|
||||||
|
#define HOST_CR3 0x6C02
|
||||||
|
#define HOST_CR4 0x6C04
|
||||||
|
#define HOST_FS_BASE 0x6C06
|
||||||
|
#define HOST_GS_BASE 0x6C08
|
||||||
|
#define HOST_TR_BASE 0x6C0A
|
||||||
|
#define HOST_GDTR_BASE 0x6C0C
|
||||||
|
#define HOST_IDTR_BASE 0x6C0E
|
||||||
|
#define HOST_SYSENTER_ESP 0x6C10
|
||||||
|
#define HOST_SYSENTER_EIP 0x6C12
|
||||||
|
#define HOST_RSP 0x6C14
|
||||||
|
#define HOST_RIP 0x6C16
|
||||||
|
|
||||||
|
/* end VMX field definitions */
|
||||||
|
|
||||||
struct VMXON {
|
struct VMXON {
|
||||||
uint32_t revisionID;
|
uint32_t revisionID;
|
||||||
uint32_t abortIndicator;
|
uint32_t abortIndicator;
|
||||||
|
|
|
||||||
71
src/vintel.c
71
src/vintel.c
|
|
@ -59,43 +59,6 @@ vintel_fix_cr_bits(void)
|
||||||
writecr4((readcr4() | cr4_fixed0) & cr4_fixed1);
|
writecr4((readcr4() | cr4_fixed0) & cr4_fixed1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GUEST_CR0 0x6800
|
|
||||||
#define GUEST_CR3 0x6802
|
|
||||||
#define GUEST_CR4 0x6804
|
|
||||||
#define GUEST_DR7 0x681A
|
|
||||||
#define GUEST_RSP 0x681C
|
|
||||||
#define GUEST_RIP 0x681E
|
|
||||||
#define GUEST_RFLAGS 0x6820
|
|
||||||
#define VMCS_LINK_POINTER 0x2800
|
|
||||||
#define GUEST_IA32_DEBUGCTL 0x2802
|
|
||||||
#define GUEST_IA32_PAT 0x2804
|
|
||||||
#define GUEST_IA32_EFER 0x2806
|
|
||||||
#define GUEST_FS_BASE 0x680E
|
|
||||||
#define GUEST_GS_BASE 0x6810
|
|
||||||
#define GUEST_SYSENTER_CS 0x482A
|
|
||||||
#define GUEST_SYSENTER_ESP 0x6824
|
|
||||||
#define GUEST_SYSENTER_EIP 0x6826
|
|
||||||
|
|
||||||
#define GUEST_ES_SELECTOR 0x0800
|
|
||||||
#define GUEST_CS_SELECTOR 0x0802
|
|
||||||
#define GUEST_SS_SELECTOR 0x0804
|
|
||||||
#define GUEST_DS_SELECTOR 0x0806
|
|
||||||
#define GUEST_FS_SELECTOR 0x0808
|
|
||||||
#define GUEST_GS_SELECTOR 0x080A
|
|
||||||
|
|
||||||
#define GUEST_ES_LIMIT 0x4800
|
|
||||||
#define GUEST_ES_ACCESS 0x4814
|
|
||||||
#define GUEST_ES_BASE 0x6806
|
|
||||||
|
|
||||||
#define GUEST_GDTR_BASE 0x6816
|
|
||||||
#define GUEST_IDTR_BASE 0x6818
|
|
||||||
|
|
||||||
#define PIN_BASED_VM_EXEC_CONTROL 0x4000
|
|
||||||
#define CPU_BASED_VM_EXEC_CONTROL 0x4002
|
|
||||||
#define VM_ENTRY_MSR_LOAD_COUNT 0x4014
|
|
||||||
#define VM_ENTRY_INTR_INFO_FIELD 0x4016
|
|
||||||
#define CPU_BASED_VM_EXEC_CONTROL2 0x401E
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
checked_vmwrite(uint64_t field, uint64_t value)
|
checked_vmwrite(uint64_t field, uint64_t value)
|
||||||
{
|
{
|
||||||
|
|
@ -211,40 +174,6 @@ vintel_init_guest(void)
|
||||||
checked_vmwrite(GUEST_IDTR_BASE, (uintptr_t)idtr.base);
|
checked_vmwrite(GUEST_IDTR_BASE, (uintptr_t)idtr.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HOST_ES_SELECTOR 0xC00
|
|
||||||
#define HOST_CS_SELECTOR 0xC02
|
|
||||||
#define HOST_SS_SELECTOR 0xC04
|
|
||||||
#define HOST_DS_SELECTOR 0xC06
|
|
||||||
#define HOST_FS_SELECTOR 0xC08
|
|
||||||
#define HOST_GS_SELECTOR 0xC0A
|
|
||||||
#define HOST_TR_SELECTOR 0xC0C
|
|
||||||
|
|
||||||
#define HOST_CR0 0x6C00
|
|
||||||
#define HOST_CR3 0x6C02
|
|
||||||
#define HOST_CR4 0x6C04
|
|
||||||
|
|
||||||
#define HOST_RSP 0x6C14
|
|
||||||
#define HOST_RIP 0x6C16
|
|
||||||
|
|
||||||
#define HOST_IA32_PAT 0x2C00
|
|
||||||
#define HOST_IA32_EFER 0x2C02
|
|
||||||
|
|
||||||
#define HOST_FS_BASE 0x6C06
|
|
||||||
#define HOST_GS_BASE 0x6C08
|
|
||||||
#define HOST_TR_BASE 0x6C0A
|
|
||||||
|
|
||||||
#define HOST_SYSENTER_CS 0x4C00
|
|
||||||
#define HOST_SYSENTER_ESP 0x6C10
|
|
||||||
#define HOST_SYSENTER_EIP 0x6C12
|
|
||||||
|
|
||||||
#define HOST_GDTR_BASE 0x6C0C
|
|
||||||
#define HOST_IDTR_BASE 0x6C0E
|
|
||||||
|
|
||||||
#define CR3_TARGET_COUNT 0x400A
|
|
||||||
#define VM_EXIT_CONTROLS 0x400C
|
|
||||||
|
|
||||||
#define EXCEPTION_BITMAP 0x4004
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vintel_init_host(void)
|
vintel_init_host(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue