- Timestamp:
- Dec 29, 2017 9:53:09 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r70359 r70379 3017 3017 NOREF(pVCpu); NOREF(pCtx); 3018 3018 3019 Assert(!pVmcb->ctrl.EventInject.n.u1Valid); 3019 3020 pVmcb->ctrl.EventInject.u = pEvent->u; 3020 3021 STAM_COUNTER_INC(&pVCpu->hm.s.paStatInjectedIrqsR0[pEvent->n.u8Vector & MASK_INJECT_IRQ_STAT]); … … 3493 3494 Assert(!VMMRZCallRing3IsEnabled(pVCpu)); 3494 3495 3495 bool const fIntShadow = hmR0SvmIsIntrShadowActive(pVCpu, pCtx); 3496 3497 /* 3498 * When executing the nested-guest, we avoid assertions on whether the 3499 * event injection is valid purely based on EFLAGS, as V_INTR_MASKING 3500 * affects the interpretation of interruptibility (see CPUMCanSvmNstGstTakePhysIntr). 3501 */ 3502 #ifndef VBOX_WITH_NESTED_HWVIRT 3503 bool const fBlockInt = !(pCtx->eflags.u32 & X86_EFL_IF); 3504 #endif 3505 3506 if (pVCpu->hm.s.Event.fPending) /* First, inject any pending HM events. */ 3496 bool const fIsNestedGuest = CPUMIsGuestInSvmNestedHwVirtMode(pCtx); 3497 bool const fIntShadow = hmR0SvmIsIntrShadowActive(pVCpu, pCtx); 3498 bool const fBlockInt = !fIsNestedGuest ? !(pCtx->eflags.u32 & X86_EFL_IF) : CPUMCanSvmNstGstTakePhysIntr(pVCpu, pCtx); 3499 3500 if (pVCpu->hm.s.Event.fPending) 3507 3501 { 3508 3502 SVMEVENT Event; … … 3510 3504 Assert(Event.n.u1Valid); 3511 3505 3512 #ifndef VBOX_WITH_NESTED_HWVIRT 3506 /* 3507 * Validate event injection pre-conditions. 3508 */ 3513 3509 if (Event.n.u3Type == SVM_EVENT_EXTERNAL_IRQ) 3514 3510 { … … 3519 3515 Assert(!fIntShadow); 3520 3516 NOREF(fBlockInt); 3521 #else 3522 Assert(!pVmcb->ctrl.EventInject.n.u1Valid);3523 #endif 3524 3517 3518 /* 3519 * Inject it (update VMCB for injection by the hardware). 3520 */ 3525 3521 Log4(("Injecting pending HM event\n")); 3526 3522 hmR0SvmInjectEventVmcb(pVCpu, pVmcb, pCtx, &Event); 3527 3523 pVCpu->hm.s.Event.fPending = false; 3528 3524 3529 #ifdef VBOX_WITH_STATISTICS3530 3525 if (Event.n.u3Type == SVM_EVENT_EXTERNAL_IRQ) 3531 3526 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectInterrupt); 3532 3527 else 3533 3528 STAM_COUNTER_INC(&pVCpu->hm.s.StatInjectXcpt); 3529 } 3530 else 3531 { 3532 #ifdef VBOX_WITH_NESTED_HWVIRT 3533 /* 3534 * If IEM emulated VMRUN and injected an event it would not clear the EVENTINJ::Valid bit 3535 * as a physical CPU clears it as part of the #VMEXIT. However, now we are continuing 3536 * nested-guest execution using hardware-assisted SVM, so we need to clear this field 3537 * otherwise we will inject the event twice, see @bugref{7243#78}. 3538 */ 3539 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 3540 pVmcb->ctrl.EventInject.n.u1Valid = 0; 3534 3541 #endif 3542 Assert(pVmcb->ctrl.EventInject.n.u1Valid == 0); 3535 3543 } 3536 3544
Note:
See TracChangeset
for help on using the changeset viewer.