optimization and code duplication cleanup in event handling code
This commit is contained in:
parent
5247dfb709
commit
9132c29280
@ -1123,6 +1123,13 @@ public: // for now...
|
||||
return (BX_CPU_THIS_PTR event_mask & event) != 0;
|
||||
}
|
||||
|
||||
BX_SMF BX_CPP_INLINE bx_bool is_pending(void) {
|
||||
return (BX_CPU_THIS_PTR pending_event) != 0;
|
||||
}
|
||||
BX_SMF BX_CPP_INLINE bx_bool is_unmasked_event_pending() {
|
||||
return (BX_CPU_THIS_PTR pending_event & ~BX_CPU_THIS_PTR event_mask) != 0;
|
||||
}
|
||||
|
||||
BX_SMF BX_CPP_INLINE bx_bool is_pending(Bit32u event) {
|
||||
return (BX_CPU_THIS_PTR pending_event & event) != 0;
|
||||
}
|
||||
|
@ -339,23 +339,16 @@ bx_bool BX_CPU_C::handleAsyncEvent(void)
|
||||
|
||||
if (!((BX_CPU_INTR && interrupts_enabled() && SVM_GIF) ||
|
||||
BX_CPU_THIS_PTR debug_trap ||
|
||||
// BX_CPU_THIS_PTR get_TF() // implies debug_trap is set
|
||||
BX_HRQ
|
||||
#if BX_SUPPORT_VMX
|
||||
|| is_unmasked_event_pending(BX_EVENT_VMX_INTERRUPT_WINDOW_EXITING |
|
||||
BX_EVENT_VMX_NMI_WINDOW_EXITING |
|
||||
BX_EVENT_VMX_PREEMPTION_TIMER_EXPIRED)
|
||||
#endif
|
||||
// BX_CPU_THIS_PTR get_TF() || // implies debug_trap is set
|
||||
BX_HRQ ||
|
||||
#if BX_SUPPORT_SVM
|
||||
|| (BX_CPU_THIS_PTR in_svm_guest && SVM_V_IRQ && BX_CPU_THIS_PTR get_IF() &&
|
||||
((SVM_V_INTR_PRIO > SVM_V_TPR) || SVM_V_IGNORE_TPR))
|
||||
(BX_CPU_THIS_PTR in_svm_guest && SVM_V_IRQ && BX_CPU_THIS_PTR get_IF() &&
|
||||
((SVM_V_INTR_PRIO > SVM_V_TPR) || SVM_V_IGNORE_TPR)) ||
|
||||
#endif
|
||||
#if BX_X86_DEBUGGER
|
||||
// a debug code breakpoint is set in current page
|
||||
|| is_pending(BX_EVENT_CODE_BREAKPOINT_ASSIST)
|
||||
#endif
|
||||
))
|
||||
is_unmasked_event_pending()))
|
||||
{
|
||||
BX_CPU_THIS_PTR async_event = 0;
|
||||
}
|
||||
|
||||
return 0; // Continue executing cpu_loop.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user