implemented VMX Monitor Trap Flag handling
This commit is contained in:
parent
180c1f09d5
commit
b946570838
@ -213,7 +213,7 @@ Bit32u broadwell_ult_t::get_vmx_extensions_bitmask(void) const
|
||||
BX_VMX_VIRTUAL_NMI |
|
||||
BX_VMX_APIC_VIRTUALIZATION |
|
||||
BX_VMX_WBINVD_VMEXIT |
|
||||
/* BX_VMX_MONITOR_TRAP_FLAG | */ // not implemented yet
|
||||
BX_VMX_MONITOR_TRAP_FLAG |
|
||||
BX_VMX_VPID |
|
||||
BX_VMX_EPT |
|
||||
BX_VMX_UNRESTRICTED_GUEST |
|
||||
|
@ -235,7 +235,7 @@ Bit32u corei3_cnl_t::get_vmx_extensions_bitmask(void) const
|
||||
BX_VMX_VIRTUAL_NMI |
|
||||
BX_VMX_APIC_VIRTUALIZATION |
|
||||
BX_VMX_WBINVD_VMEXIT |
|
||||
/* BX_VMX_MONITOR_TRAP_FLAG | */ // not implemented yet
|
||||
BX_VMX_MONITOR_TRAP_FLAG |
|
||||
BX_VMX_VPID |
|
||||
BX_VMX_EPT |
|
||||
BX_VMX_UNRESTRICTED_GUEST |
|
||||
|
@ -175,7 +175,7 @@ Bit32u corei5_arrandale_m520_t::get_vmx_extensions_bitmask(void) const
|
||||
BX_VMX_VIRTUAL_NMI |
|
||||
BX_VMX_APIC_VIRTUALIZATION |
|
||||
BX_VMX_WBINVD_VMEXIT |
|
||||
/* BX_VMX_MONITOR_TRAP_FLAG | */ // not implemented yet
|
||||
BX_VMX_MONITOR_TRAP_FLAG |
|
||||
BX_VMX_VPID |
|
||||
BX_VMX_EPT |
|
||||
BX_VMX_UNRESTRICTED_GUEST |
|
||||
|
@ -154,7 +154,7 @@ Bit32u corei5_lynnfield_750_t::get_vmx_extensions_bitmask(void) const
|
||||
BX_VMX_VIRTUAL_NMI |
|
||||
BX_VMX_APIC_VIRTUALIZATION |
|
||||
BX_VMX_WBINVD_VMEXIT |
|
||||
/* BX_VMX_MONITOR_TRAP_FLAG | */ // not implemented yet
|
||||
BX_VMX_MONITOR_TRAP_FLAG |
|
||||
BX_VMX_VPID |
|
||||
BX_VMX_EPT |
|
||||
BX_VMX_SAVE_DEBUGCTL_DISABLE |
|
||||
|
@ -183,7 +183,7 @@ Bit32u corei7_haswell_4770_t::get_vmx_extensions_bitmask(void) const
|
||||
BX_VMX_VIRTUAL_NMI |
|
||||
BX_VMX_APIC_VIRTUALIZATION |
|
||||
BX_VMX_WBINVD_VMEXIT |
|
||||
/* BX_VMX_MONITOR_TRAP_FLAG | */ // not implemented yet
|
||||
BX_VMX_MONITOR_TRAP_FLAG |
|
||||
BX_VMX_VPID |
|
||||
BX_VMX_EPT |
|
||||
BX_VMX_UNRESTRICTED_GUEST |
|
||||
|
@ -193,7 +193,7 @@ Bit32u corei7_ivy_bridge_3770k_t::get_vmx_extensions_bitmask(void) const
|
||||
BX_VMX_VIRTUAL_NMI |
|
||||
BX_VMX_APIC_VIRTUALIZATION |
|
||||
BX_VMX_WBINVD_VMEXIT |
|
||||
/* BX_VMX_MONITOR_TRAP_FLAG | */ // not implemented yet
|
||||
BX_VMX_MONITOR_TRAP_FLAG |
|
||||
BX_VMX_VPID |
|
||||
BX_VMX_EPT |
|
||||
BX_VMX_UNRESTRICTED_GUEST |
|
||||
|
@ -189,7 +189,7 @@ Bit32u corei7_sandy_bridge_2600k_t::get_vmx_extensions_bitmask(void) const
|
||||
BX_VMX_VIRTUAL_NMI |
|
||||
BX_VMX_APIC_VIRTUALIZATION |
|
||||
BX_VMX_WBINVD_VMEXIT |
|
||||
/* BX_VMX_MONITOR_TRAP_FLAG | */ // not implemented yet
|
||||
BX_VMX_MONITOR_TRAP_FLAG |
|
||||
BX_VMX_VPID |
|
||||
BX_VMX_EPT |
|
||||
BX_VMX_UNRESTRICTED_GUEST |
|
||||
|
@ -229,7 +229,7 @@ Bit32u corei7_skylake_x_t::get_vmx_extensions_bitmask(void) const
|
||||
BX_VMX_VIRTUAL_NMI |
|
||||
BX_VMX_APIC_VIRTUALIZATION |
|
||||
BX_VMX_WBINVD_VMEXIT |
|
||||
/* BX_VMX_MONITOR_TRAP_FLAG | */ // not implemented yet
|
||||
BX_VMX_MONITOR_TRAP_FLAG |
|
||||
BX_VMX_VPID |
|
||||
BX_VMX_EPT |
|
||||
BX_VMX_UNRESTRICTED_GUEST |
|
||||
|
@ -258,8 +258,13 @@ bool BX_CPU_C::handleAsyncEvent(void)
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_VMX
|
||||
if (is_unmasked_event_pending(BX_EVENT_VMX_MONITOR_TRAP_FLAG)) {
|
||||
VMexit(VMX_VMEXIT_MONITOR_TRAP_FLAG, 0);
|
||||
if (is_pending(BX_EVENT_VMX_MONITOR_TRAP_FLAG)) {
|
||||
if (is_unmasked_event_pending(BX_EVENT_VMX_MONITOR_TRAP_FLAG)) {
|
||||
VMexit(VMX_VMEXIT_MONITOR_TRAP_FLAG, 0);
|
||||
}
|
||||
else {
|
||||
unmask_event(BX_EVENT_VMX_MONITOR_TRAP_FLAG);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -369,7 +374,7 @@ bool BX_CPU_C::handleAsyncEvent(void)
|
||||
// Alignment check
|
||||
// (handled by rest of the code)
|
||||
|
||||
if (!((SVM_GIF && unmasked_events_pending()) || BX_CPU_THIS_PTR debug_trap ||
|
||||
if (!((SVM_GIF && unmasked_events_pending()) || BX_CPU_THIS_PTR debug_trap || is_unmasked_event_pending(BX_EVENT_VMX_MONITOR_TRAP_FLAG) ||
|
||||
// BX_CPU_THIS_PTR get_TF() || // implies debug_trap is set
|
||||
BX_HRQ))
|
||||
{
|
||||
|
@ -2157,6 +2157,11 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification)
|
||||
mask_event(BX_EVENT_NMI);
|
||||
}
|
||||
|
||||
if (vm->vmexec_ctrls2 & VMX_VM_EXEC_CTRL2_MONITOR_TRAP_FLAG) {
|
||||
signal_event(BX_EVENT_VMX_MONITOR_TRAP_FLAG);
|
||||
mask_event(BX_EVENT_VMX_MONITOR_TRAP_FLAG);
|
||||
}
|
||||
|
||||
if (vm->vmexec_ctrls2 & VMX_VM_EXEC_CTRL2_NMI_WINDOW_EXITING)
|
||||
signal_event(BX_EVENT_VMX_VIRTUAL_NMI);
|
||||
|
||||
|
@ -148,11 +148,11 @@ enum VMX_vmexit_reason {
|
||||
VMX_VMEXIT_LAST_REASON
|
||||
};
|
||||
|
||||
// note, MONITOR_TRAP_FLAG should not be here because it taken between instructions
|
||||
#define IS_TRAP_LIKE_VMEXIT(reason) \
|
||||
(reason == VMX_VMEXIT_TPR_THRESHOLD || \
|
||||
reason == VMX_VMEXIT_VIRTUALIZED_EOI || \
|
||||
reason == VMX_VMEXIT_APIC_WRITE || \
|
||||
reason == VMX_VMEXIT_MONITOR_TRAP_FLAG || \
|
||||
reason == VMX_VMEXIT_BUS_LOCK)
|
||||
|
||||
// VMexit on CR register access
|
||||
@ -173,7 +173,7 @@ enum VMX_vmentry_error {
|
||||
|
||||
// VMABORT error code
|
||||
enum VMX_vmabort_code {
|
||||
VMABORT_SAVING_GUEST_MSRS_FAILURE,
|
||||
VMABORT_SAVING_GUEST_MSRS_FAILURE = 0,
|
||||
VMABORT_HOST_PDPTR_CORRUPTED,
|
||||
VMABORT_VMEXIT_VMCS_CORRUPTED,
|
||||
VMABORT_LOADING_HOST_MSRS,
|
||||
|
Loading…
Reference in New Issue
Block a user