Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
Moved VMX-specific definitions to vmx.h
Browse files Browse the repository at this point in the history
- Moved vcpu_vmx_data and interruptibility_state_t from {vcpu,vcpu_state}.h to vmx.h.

- Removed vcpu_state_t::interruptibility_state_t since it's not used.

Signed-off-by: Alexandro Sanchez Bach <asanchez@kryptoslogic.com>
  • Loading branch information
AlexAltea committed Nov 18, 2018
1 parent 5e8b93c commit d92b106
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 49 deletions.
34 changes: 0 additions & 34 deletions core/include/vcpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,40 +68,6 @@ struct cvtlb {
struct hax_mmu;
struct per_cpu_data;

struct vcpu_vmx_data {
uint32_t pin_ctls_base;
uint32_t pcpu_ctls_base;
uint32_t scpu_ctls_base;
uint32_t entry_ctls_base;
uint32_t exc_bitmap_base;
uint32_t exit_ctls_base;

uint32_t pin_ctls;
uint32_t pcpu_ctls;
uint32_t scpu_ctls;
uint32_t entry_ctls;
uint32_t exc_bitmap;
uint32_t exit_ctls;

uint64_t cr0_mask, cr0_shadow;
uint64_t cr4_mask, cr4_shadow;
uint32_t entry_exception_vector;
uint32_t entry_exception_error_code;

uint32_t exit_exception_error_code;
interruption_info_t exit_intr_info;
interruption_info_t entry_intr_info;
uint32_t exit_idt_vectoring;
uint32_t exit_instr_length;
uint32_t entry_instr_length;

exit_reason_t exit_reason;
exit_qualification_t exit_qualification;
interruptibility_state_t interruptibility_state;

uint64_t exit_gpa;
};

/* Information saved by instruction decoder and used by post-MMIO handler */
struct vcpu_post_mmio {
enum {
Expand Down
50 changes: 50 additions & 0 deletions core/include/vmx.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ enum {
VMX_EXIT_XRSTORS = 64
};

// Intel SDM Vol. 3D: Appendix B: Field Encoding in VMCS
enum component_index_t {
VMX_PIN_CONTROLS = 0x00004000,
VMX_PRIMARY_PROCESSOR_CONTROLS = 0x00004002,
Expand Down Expand Up @@ -467,6 +468,21 @@ union instruction_info_t {

typedef union instruction_info_t instruction_info_t;

// Intel SDM Vol. 3C: Table 24-3. Format of Interruptibility State
union interruptibility_state_t {
uint32_t raw;
struct {
uint32_t sti_blocking : 1;
uint32_t movss_blocking : 1;
uint32_t smi_blocking : 1;
uint32_t nmi_blocking : 1;
uint32_t reserved : 28;
};
uint64_t pad;
} PACKED;

typedef union interruptibility_state_t interruptibility_state_t;

// 64-bit OK
union interruption_info_t {
uint32_t raw;
Expand Down Expand Up @@ -636,6 +652,40 @@ struct invept_desc {
struct vcpu_state_t;
struct vcpu_t;

struct vcpu_vmx_data {
uint32_t pin_ctls_base;
uint32_t pcpu_ctls_base;
uint32_t scpu_ctls_base;
uint32_t entry_ctls_base;
uint32_t exc_bitmap_base;
uint32_t exit_ctls_base;

uint32_t pin_ctls;
uint32_t pcpu_ctls;
uint32_t scpu_ctls;
uint32_t entry_ctls;
uint32_t exc_bitmap;
uint32_t exit_ctls;

uint64_t cr0_mask, cr0_shadow;
uint64_t cr4_mask, cr4_shadow;
uint32_t entry_exception_vector;
uint32_t entry_exception_error_code;

uint32_t exit_exception_error_code;
interruption_info_t exit_intr_info;
interruption_info_t entry_intr_info;
uint32_t exit_idt_vectoring;
uint32_t exit_instr_length;
uint32_t entry_instr_length;

exit_reason_t exit_reason;
exit_qualification_t exit_qualification;
interruptibility_state_t interruptibility_state;

uint64_t exit_gpa;
};

vmx_result_t ASMCALL asm_invept(uint type, struct invept_desc *desc);
vmx_result_t ASMCALL asm_vmclear(const paddr_t *addr_in);
vmx_result_t ASMCALL asm_vmptrld(const paddr_t *addr_in);
Expand Down
15 changes: 0 additions & 15 deletions include/vcpu_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@
#ifndef HAX_VCPU_STATE_H_
#define HAX_VCPU_STATE_H_

union interruptibility_state_t {
uint32_t raw;
struct {
uint32_t sti_blocking : 1;
uint32_t movss_blocking : 1;
uint32_t smi_blocking : 1;
uint32_t nmi_blocking : 1;
uint32_t reserved : 28;
};
uint64_t pad;
} PACKED;

typedef union interruptibility_state_t interruptibility_state_t;

// Segment descriptor
struct segment_desc_t {
uint16_t selector;
Expand Down Expand Up @@ -187,7 +173,6 @@ struct vcpu_state_t {

uint32_t _activity_state;
uint32_t pad;
interruptibility_state_t _interruptibility_state;
} PACKED;

void dump(void);
Expand Down

0 comments on commit d92b106

Please sign in to comment.