#ifndef VMXCONTROLSTRUCTURES_H_
#define VMXCONTROLSTRUCTURES_H_
#include "common.h"
#define BLOCKINGBYSTI (1<<0)
#define BLOCKINGBYSS (1<<1)
#define BLOCKINGBYSMI (1<<2)
#define BLOCKINGBYNMI (1<<3)
#define EXTERNAL_INTERRUPT_EXITING (1<<0)
#define NMI_EXITING (1<<3)
#define VIRTUAL_NMIS (1<<5)
#define ACTIVATE_VMX_PREEMPTION_TIMER (1<<6)
#define INTERRUPT_WINDOW_EXITING (1<<2)
#define USE_TSC_OFFSETTING (1<<3)
#define HLT_EXITING (1<<7)
#define INVLPG_EXITING (1<<9)
#define MWAIT_EXITING (1<<10)
#define RDPMC_EXITING (1<<11)
#define RDTSC_EXITING (1<<12)
#define CR8LOAD_EXITING (1<<19)
#define CR8STORE_EXITING (1<<20)
#define USE_TPR_SHADOW (1<<21)
#define MOV_DR_EXITING (1<<23)
#define UNCONDITIONAL_IO_EXITING (1<<24)
#define USE_IO_BITMAPS (1<<25)
#define USE_MSR_BITMAPS (1<<28)
#define MONITOR_EXITING (1<<29)
#define PAUSE_EXITING (1<<30)
#define SPBEF_ENABLE_RDTSCP (1<<3)
#define SPBEF_ENABLE_INVPCID (1<<12)
#define SPBEF_ENABLE_XSAVES (1<<20)
#define SAVE_DEBUG_CONTROLS (1<<2)
#define HOST_ADDRESS_SPACE_SIZE (1<<9)
#define ACKNOWLEDGE_INTERRUPT_ON_EXIT (1<<15)
#define RESTORE_DEBUG_CONTROLS (1<<2)
#define IA32E_MODE_GUEST (1<<9)
#define ENTRY_TO_SMM (1<<10)
#define DEACTIVATE_DUALMANAGEMENT_TREATMENT (1<<11)
#define FEATURE_CONTROL_LOCK (1<<0)
#define FEATURE_CONTROL_VMXON_SMX (1<<1)
#define FEATURE_CONTROL_VMXON (1<<2)
#define vm_exit_interrupt 0
#define vm_exit_sipi 4
#define vm_exit_taskswitch 9
#define vm_exit_cpuid 10
#define vm_exit_invlpg 14
#define vm_exit_vmcall 18
#define vm_exit_cr_access 28
#define vm_exit_io_access 30
#define vm_exit_rdmsr 31
#define vm_exit_wrmsr 32
#define vm_exit_vmx_preemptiontimer_reachedzero 52
#define vm_exit_invalid_guest_state 0x80000021
typedef struct
{
DWORD RevisionID;
DWORD VMXAbortIndicator;
DWORD VMCSData[(4096 - 8) / 4];
}__attribute__((__packed__)) VMCSRegion, *PVMCSRegion;
typedef struct
{
union {
ULONG AccessRights;
struct {
ULONG Segment_type : 4; ULONG S : 1; ULONG DPL : 2; ULONG P : 1; ULONG reserved : 4; ULONG AVL : 1; ULONG L : 1; ULONG D_B : 1; ULONG G : 1; ULONG unusable : 1; ULONG reserved_2 : 15;
};
};
} Access_Rights, *PAccess_Rights;
typedef union
{
UINT64 pendingDebugExceptions;
struct {
unsigned B0 :1;
unsigned B1 :1;
unsigned B2 :1;
unsigned B3 :1;
unsigned reserved :8; unsigned EnabledBreakpoint :1; unsigned reserved2 :1; unsigned BS :1; UINT64 reserved3 :49; } binary;
}__attribute__((__packed__)) PendingDebugExceptions, *PPendingDebugExceptions;
typedef struct _vmexit_interruption_information
{
union {
ULONG interruption_information;
struct {
ULONG interruptvector : 8;
ULONG type : 3;
ULONG haserrorcode : 1;
ULONG ireterror : 1;
ULONG reserved0 : 18;
ULONG valid : 1;
};
};
} __attribute__((__packed__)) VMExit_interruption_information;
typedef struct _vmexit_idt_vector_information
{
union {
ULONG idtvector_info;
struct {
ULONG interruptvector : 8;
ULONG type : 3;
ULONG haserrorcode : 1;
ULONG undefined : 1;
ULONG reserved0 : 18;
ULONG valid : 1;
};
};
} __attribute__((__packed__)) VMExit_idt_vector_information;
typedef struct _vmentry_interruption_information
{
union {
ULONG interruption_information;
struct {
ULONG interruptvector : 8;
ULONG type : 3;
ULONG haserrorcode : 1;
ULONG reserved0 : 19;
ULONG valid : 1;
};
};
} __attribute__((__packed__)) VMEntry_interruption_information;
typedef struct _IA32_VMX_BASIC
{
union{
unsigned long long IA32_VMX_BASIC;
struct {
ULONG rev_id :32; ULONG VMXON_size :13; ULONG reserved1 :3; ULONG addresswidth:1; ULONG dual_monitor:1; ULONG memtype :4; ULONG reserved2 :10; };
};
} __attribute__((__packed__)) TIA32_VMX_BASIC;
typedef struct _IA32_VMX_MISC
{
union{
unsigned long long IA32_VMX_MISC;
struct {
ULONG vmx_premption_timer_tsc_relation: 5; ULONG storeslma: 1; ULONG activity_HLT:1; ULONG activity_shutdown: 1; ULONG activity_waitforsipi: 1; ULONG reserved2 : 7; ULONG maxcr3targets : 9; ULONG maxmsrsavelist : 3; ULONG reserved3 : 4; ULONG MSEG_revid : 32;
};
};
} __attribute__((__packed__)) TIA32_VMX_MISC;
#endif