more cleaning

merge-requests/6/head
_xeroxz 4 years ago
parent 33c12f1aa2
commit 7492e52c73

@ -32,10 +32,22 @@ auto exit_handler(hv::pguest_registers regs) -> void
ia32_vmx_procbased_ctls_register procbased_ctls; ia32_vmx_procbased_ctls_register procbased_ctls;
__vmx_vmread(VMCS_CTRL_PROCESSOR_BASED_VM_EXECUTION_CONTROLS, &procbased_ctls.flags); __vmx_vmread(VMCS_CTRL_PROCESSOR_BASED_VM_EXECUTION_CONTROLS, &procbased_ctls.flags);
// if an NMI happens right here and my NMI handler sets nmi window exiting on...
// its going to be overwritten with off right here... sus...
procbased_ctls.nmi_window_exiting = false; procbased_ctls.nmi_window_exiting = false;
__vmx_vmwrite(VMCS_CTRL_PROCESSOR_BASED_VM_EXECUTION_CONTROLS, procbased_ctls.flags); __vmx_vmwrite(VMCS_CTRL_PROCESSOR_BASED_VM_EXECUTION_CONTROLS, procbased_ctls.flags);
goto dont_advance; goto dont_advance;
} }
case VMX_EXIT_REASON_EXCEPTION_OR_NMI:
{
ia32_vmx_procbased_ctls_register procbased_ctls;
__vmx_vmread(VMCS_CTRL_PROCESSOR_BASED_VM_EXECUTION_CONTROLS, &procbased_ctls.flags);
procbased_ctls.nmi_window_exiting = true;
__vmx_vmwrite(VMCS_CTRL_PROCESSOR_BASED_VM_EXECUTION_CONTROLS, procbased_ctls.flags);
goto dont_advance;
}
case VMX_EXIT_REASON_EXECUTE_XSETBV: case VMX_EXIT_REASON_EXECUTE_XSETBV:
{ {
if (handle::xsetbv(regs)) if (handle::xsetbv(regs))

@ -689,7 +689,6 @@ namespace hv
u64 vmcs_phys; u64 vmcs_phys;
u64 vmxon_phys; u64 vmxon_phys;
u64 error_code; u64 error_code;
u64 nmi_code;
} vcpu_ctx, * pvcpu_ctx; } vcpu_ctx, * pvcpu_ctx;
typedef struct _vmx_ctx typedef struct _vmx_ctx

@ -8638,6 +8638,10 @@ typedef union
#define IA32_MTRR_PHYSBASE7 0x0000020E #define IA32_MTRR_PHYSBASE7 0x0000020E
#define IA32_MTRR_PHYSBASE8 0x00000210 #define IA32_MTRR_PHYSBASE8 0x00000210
#define IA32_MTRR_PHYSBASE9 0x00000212 #define IA32_MTRR_PHYSBASE9 0x00000212
#define IA32_MTRR_PHYSBASEN(n) \
IA32_MTRR_PHYSBASE0 + (n * 2)
/** /**
* @} * @}
*/ */
@ -8708,6 +8712,10 @@ typedef union
#define IA32_MTRR_PHYSMASK7 0x0000020F #define IA32_MTRR_PHYSMASK7 0x0000020F
#define IA32_MTRR_PHYSMASK8 0x00000211 #define IA32_MTRR_PHYSMASK8 0x00000211
#define IA32_MTRR_PHYSMASK9 0x00000213 #define IA32_MTRR_PHYSMASK9 0x00000213
#define IA32_MTRR_PHYSMASKN(n) \
IA32_MTRR_PHYSMASK0 + (n * 2)
/** /**
* @} * @}
*/ */

@ -153,6 +153,8 @@ namespace vmcs
ia32_vmx_basic_register vmx_basic{ __readmsr(IA32_VMX_BASIC) }; ia32_vmx_basic_register vmx_basic{ __readmsr(IA32_VMX_BASIC) };
pinbased_ctls.virtual_nmi = true; pinbased_ctls.virtual_nmi = true;
pinbased_ctls.nmi_exiting = true;
procbased_ctls.activate_secondary_controls = true; procbased_ctls.activate_secondary_controls = true;
exit_ctls.host_address_space_size = true; exit_ctls.host_address_space_size = true;

Loading…
Cancel
Save