Changeset View
Changeset View
Standalone View
Standalone View
head/sys/amd64/include/vmm.h
Show First 20 Lines • Show All 509 Lines • ▼ Show 20 Lines | |||||
* consumers of instruction decoding. The only reason why their contents | * consumers of instruction decoding. The only reason why their contents | ||||
* need to be exposed is because they are part of the 'vm_exit' structure. | * need to be exposed is because they are part of the 'vm_exit' structure. | ||||
*/ | */ | ||||
struct vie_op { | struct vie_op { | ||||
uint8_t op_byte; /* actual opcode byte */ | uint8_t op_byte; /* actual opcode byte */ | ||||
uint8_t op_type; /* type of operation (e.g. MOV) */ | uint8_t op_type; /* type of operation (e.g. MOV) */ | ||||
uint16_t op_flags; | uint16_t op_flags; | ||||
}; | }; | ||||
_Static_assert(sizeof(struct vie_op) == 4, "ABI"); | |||||
_Static_assert(_Alignof(struct vie_op) == 2, "ABI"); | |||||
#define VIE_INST_SIZE 15 | #define VIE_INST_SIZE 15 | ||||
struct vie { | struct vie { | ||||
uint8_t inst[VIE_INST_SIZE]; /* instruction bytes */ | uint8_t inst[VIE_INST_SIZE]; /* instruction bytes */ | ||||
uint8_t num_valid; /* size of the instruction */ | uint8_t num_valid; /* size of the instruction */ | ||||
uint8_t num_processed; | uint8_t num_processed; | ||||
uint8_t addrsize:4, opsize:4; /* address and operand sizes */ | uint8_t addrsize:4, opsize:4; /* address and operand sizes */ | ||||
uint8_t rex_w:1, /* REX prefix */ | uint8_t rex_w:1, /* REX prefix */ | ||||
rex_r:1, | rex_r:1, | ||||
rex_x:1, | rex_x:1, | ||||
rex_b:1, | rex_b:1, | ||||
rex_present:1, | rex_present:1, | ||||
repz_present:1, /* REP/REPE/REPZ prefix */ | repz_present:1, /* REP/REPE/REPZ prefix */ | ||||
repnz_present:1, /* REPNE/REPNZ prefix */ | repnz_present:1, /* REPNE/REPNZ prefix */ | ||||
opsize_override:1, /* Operand size override */ | opsize_override:1, /* Operand size override */ | ||||
addrsize_override:1, /* Address size override */ | addrsize_override:1, /* Address size override */ | ||||
segment_override:1; /* Segment override */ | segment_override:1; /* Segment override */ | ||||
uint8_t mod:2, /* ModRM byte */ | uint8_t mod:2, /* ModRM byte */ | ||||
reg:4, | reg:4, | ||||
rm:4; | rm:4; | ||||
uint8_t ss:2, /* SIB byte */ | uint8_t ss:2, /* SIB byte */ | ||||
index:4, | _sparebits:2, | ||||
base:4; | index:4, /* SIB byte */ | ||||
base:4; /* SIB byte */ | |||||
uint8_t disp_bytes; | uint8_t disp_bytes; | ||||
uint8_t imm_bytes; | uint8_t imm_bytes; | ||||
uint8_t scale; | uint8_t scale; | ||||
uint8_t _sparebytes[3]; | |||||
int base_register; /* VM_REG_GUEST_xyz */ | int base_register; /* VM_REG_GUEST_xyz */ | ||||
int index_register; /* VM_REG_GUEST_xyz */ | int index_register; /* VM_REG_GUEST_xyz */ | ||||
int segment_register; /* VM_REG_GUEST_xyz */ | int segment_register; /* VM_REG_GUEST_xyz */ | ||||
int64_t displacement; /* optional addr displacement */ | int64_t displacement; /* optional addr displacement */ | ||||
int64_t immediate; /* optional immediate operand */ | int64_t immediate; /* optional immediate operand */ | ||||
uint8_t decoded; /* set to 1 if successfully decoded */ | uint8_t decoded; /* set to 1 if successfully decoded */ | ||||
uint8_t _sparebyte; | |||||
struct vie_op op; /* opcode description */ | struct vie_op op; /* opcode description */ | ||||
}; | }; | ||||
_Static_assert(sizeof(struct vie) == 64, "ABI"); | |||||
_Static_assert(__offsetof(struct vie, disp_bytes) == 22, "ABI"); | |||||
_Static_assert(__offsetof(struct vie, scale) == 24, "ABI"); | |||||
_Static_assert(__offsetof(struct vie, base_register) == 28, "ABI"); | |||||
enum vm_exitcode { | enum vm_exitcode { | ||||
VM_EXITCODE_INOUT, | VM_EXITCODE_INOUT, | ||||
VM_EXITCODE_VMX, | VM_EXITCODE_VMX, | ||||
VM_EXITCODE_BOGUS, | VM_EXITCODE_BOGUS, | ||||
VM_EXITCODE_RDMSR, | VM_EXITCODE_RDMSR, | ||||
VM_EXITCODE_WRMSR, | VM_EXITCODE_WRMSR, | ||||
VM_EXITCODE_HLT, | VM_EXITCODE_HLT, | ||||
▲ Show 20 Lines • Show All 162 Lines • Show Last 20 Lines |