VirtualBox

Changeset 67204 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Jun 1, 2017 11:55:18 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
115886
Message:

VMM: Nested Hw.virt: Physical interrupts and virtual interrupt fixes.

File:
1 edited

Legend:

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

    r67200 r67204  
    811811
    812812/**
    813  * Checks whether an interrupt is pending for the nested-guest.
     813 * Checks whether the nested-guest is in a state to receive physical (APIC)
     814 * interrupts.
    814815 *
    815816 * @returns VBox status code.
    816  * @retval  true if there's a pending interrupt, false otherwise.
     817 * @retval  true if it's ready, false otherwise.
    817818 *
    818819 * @param   pVCpu       The cross context virtual CPU structure.
    819820 * @param   pCtx        The guest-CPU context.
    820821 */
    821 VMM_INT_DECL(bool) HMSvmNstGstCanTakeInterrupt(PVMCPU pVCpu, PCCPUMCTX pCtx)
     822VMM_INT_DECL(bool) HMSvmNstGstCanTakePhysInterrupt(PVMCPU pVCpu, PCCPUMCTX pCtx)
    822823{
     824    Assert(CPUMIsGuestInSvmNestedHwVirtMode(pCtx));
     825    RT_NOREF(pVCpu);
     826
    823827    PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.VmcbCtrl;
     828    X86EFLAGS fEFlags;
     829    if (!pVmcbCtrl->IntCtrl.n.u1VIntrMasking)
     830        fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u;
     831    else
     832        fEFlags.u = pCtx->eflags.u;
     833
     834    return pCtx->hwvirt.svm.fGif && fEFlags.Bits.u1IF;
     835}
     836
     837
     838/**
     839 * Checks whether the nested-guest is in a state to receive virtual (injected by
     840 * VMRUN) interrupts.
     841 *
     842 * @returns VBox status code.
     843 * @retval  true if it's ready, false otherwise.
     844 *
     845 * @param   pVCpu       The cross context virtual CPU structure.
     846 * @param   pCtx        The guest-CPU context.
     847 */
     848VMM_INT_DECL(bool) HMSvmNstGstCanTakeVirtInterrupt(PVMCPU pVCpu, PCCPUMCTX pCtx)
     849{
    824850    Assert(CPUMIsGuestInSvmNestedHwVirtMode(pCtx));
    825 
    826     X86RFLAGS RFlags;
    827     if (pVmcbCtrl->IntCtrl.n.u1VIntrMasking)
    828         RFlags.u = pCtx->rflags.u;
    829     else
    830         RFlags.u = pCtx->hwvirt.svm.HostState.rflags.u;
    831 
    832     if (!RFlags.Bits.u1IF)
    833         return false;
    834 
     851    Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS));
     852    Assert(VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NESTED_GUEST));
     853    RT_NOREF(pVCpu);
     854
     855    PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.VmcbCtrl;
    835856    if (   !pVmcbCtrl->IntCtrl.n.u1IgnoreTPR
    836857        &&  pVmcbCtrl->IntCtrl.n.u4VIntrPrio <= pVmcbCtrl->IntCtrl.n.u8VTPR)
    837858        return false;
    838859
    839     /* Paranoia. */
    840     Assert(RT_BOOL(pCtx->hwvirt.svm.fGif));
    841     Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS));
    842     Assert(VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NESTED_GUEST));
    843     RT_NOREF(pVCpu);
     860    if (!pCtx->rflags.Bits.u1IF)
     861        return false;
     862
     863    if (!pCtx->hwvirt.svm.fGif)
     864        return false;
     865
    844866    return true;
    845867}
Note: See TracChangeset for help on using the changeset viewer.

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