VirtualBox

Changeset 75998 in vbox for trunk/src


Ignore:
Timestamp:
Dec 6, 2018 7:35:24 AM (6 years ago)
Author:
vboxsync
Message:

VMM/EM: Nested VMX: bugref:9180 Consider GIF and virtual interrupts while determining whether HLT/MWAIT continue in HM ring-0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r75646 r75998  
    249249VMM_INT_DECL(bool) EMMonitorWaitShouldContinue(PVMCPU pVCpu, PCPUMCTX pCtx)
    250250{
    251     if (   pCtx->eflags.Bits.u1IF
    252         || (   (pVCpu->em.s.MWait.fWait & (EMMWAIT_FLAG_ACTIVE | EMMWAIT_FLAG_BREAKIRQIF0))
    253             ==                            (EMMWAIT_FLAG_ACTIVE | EMMWAIT_FLAG_BREAKIRQIF0)) )
    254     {
    255         if (VMCPU_FF_IS_ANY_SET(pVCpu, (VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC)))
     251    if (CPUMGetGuestGif(pCtx))
     252    {
     253        if (   CPUMIsGuestPhysIntrEnabled(pVCpu)
     254            || (   CPUMIsGuestInNestedHwvirtMode(pCtx)
     255                && CPUMIsGuestVirtIntrEnabled(pVCpu))
     256            || (   (pVCpu->em.s.MWait.fWait & (EMMWAIT_FLAG_ACTIVE | EMMWAIT_FLAG_BREAKIRQIF0))
     257                ==                            (EMMWAIT_FLAG_ACTIVE | EMMWAIT_FLAG_BREAKIRQIF0)) )
    256258        {
    257             pVCpu->em.s.MWait.fWait &= ~(EMMWAIT_FLAG_ACTIVE | EMMWAIT_FLAG_BREAKIRQIF0);
    258             return true;
     259            if (VMCPU_FF_IS_ANY_SET(pVCpu, (  VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC
     260                                            | VMCPU_FF_INTERRUPT_NESTED_GUEST)))
     261            {
     262                pVCpu->em.s.MWait.fWait &= ~(EMMWAIT_FLAG_ACTIVE | EMMWAIT_FLAG_BREAKIRQIF0);
     263                return true;
     264            }
    259265        }
    260266    }
     
    274280VMM_INT_DECL(bool) EMShouldContinueAfterHalt(PVMCPU pVCpu, PCPUMCTX pCtx)
    275281{
    276     /** @todo Shouldn't we be checking GIF here? */
    277     if (pCtx->eflags.Bits.u1IF)
    278         return VMCPU_FF_IS_ANY_SET(pVCpu, (VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC));
     282    if (CPUMGetGuestGif(pCtx))
     283    {
     284        if (CPUMIsGuestPhysIntrEnabled(pVCpu))
     285            return VMCPU_FF_IS_ANY_SET(pVCpu, (VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC));
     286
     287        if (   CPUMIsGuestInNestedHwvirtMode(pCtx)
     288            && CPUMIsGuestVirtIntrEnabled(pVCpu))
     289            return VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_NESTED_GUEST);
     290    }
    279291    return false;
    280292}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette