VirtualBox

Changeset 75729 in vbox


Ignore:
Timestamp:
Nov 26, 2018 9:32:52 AM (6 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:9180 Adapt CPUMGetGuestInterruptibility for nested-guest physical-interrupt state.

File:
1 edited

Legend:

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

    r75646 r75729  
    26492649
    26502650/**
     2651 * Gets whether the guest or nested-guest's are ready to receive physical
     2652 * interrupts.
     2653 *
     2654 * This function assumes there is no global
     2655 *
     2656 * @returns @c true if interrupts can be injected into the guest (or nested-guest),
     2657 *          @c false otherwise.
     2658 * @param   pVCpu       The cross context virtual CPU structure.
     2659 */
     2660DECLINLINE(bool) CPUMIsGuestPhysIntrsEnabled(PVMCPU pVCpu)
     2661{
     2662    Assert(pVCpu->cpum.s.Guest.hwvirt.fGif);
     2663    if (   !CPUMIsGuestInVmxNonRootMode(&pVCpu->cpum.s.Guest)
     2664        && !CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.s.Guest))
     2665        return RT_BOOL(pVCpu->cpum.s.Guest.rflags.Bits.u1IF);
     2666
     2667    if (CPUMIsGuestInVmxNonRootMode(&pVCpu->cpum.s.Guest))
     2668        return CPUMCanVmxNstGstTakePhysIntr(pVCpu, &pVCpu->cpum.s.Guest);
     2669
     2670    return CPUMCanSvmNstGstTakePhysIntr(pVCpu, &pVCpu->cpum.s.Guest);
     2671}
     2672
     2673
     2674/**
    26512675 * Calculates the interruptiblity of the guest.
    26522676 *
     
    26562680VMM_INT_DECL(CPUMINTERRUPTIBILITY) CPUMGetGuestInterruptibility(PVMCPU pVCpu)
    26572681{
     2682#if 1
     2683    if (pVCpu->cpum.s.Guest.hwvirt.fGif)
     2684    {
     2685        /** @todo r=ramshankar: What about virtual-interrupt delivery to nested-guests? */
     2686        if (CPUMIsGuestPhysIntrsEnabled(pVCpu))
     2687        {
     2688            if (!VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_BLOCK_NMIS | VMCPU_FF_INHIBIT_INTERRUPTS))
     2689                return CPUMINTERRUPTIBILITY_UNRESTRAINED;
     2690
     2691            /** @todo does blocking NMIs mean interrupts are also inhibited? */
     2692            if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
     2693            {
     2694                if (!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS))
     2695                    return CPUMINTERRUPTIBILITY_INT_INHIBITED;
     2696                return CPUMINTERRUPTIBILITY_NMI_INHIBIT;
     2697            }
     2698            AssertFailed();
     2699            return CPUMINTERRUPTIBILITY_NMI_INHIBIT;
     2700        }
     2701        else
     2702        {
     2703            if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS))
     2704                return CPUMINTERRUPTIBILITY_NMI_INHIBIT;
     2705            return CPUMINTERRUPTIBILITY_INT_DISABLED;
     2706        }
     2707    }
     2708    return CPUMINTERRUPTIBILITY_GLOBAL_INHIBIT;
     2709#else
    26582710    if (pVCpu->cpum.s.Guest.rflags.Bits.u1IF)
    26592711    {
     
    26852737        return CPUMINTERRUPTIBILITY_GLOBAL_INHIBIT;
    26862738    }
     2739#endif
    26872740}
    26882741
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