VirtualBox

Ignore:
Timestamp:
Mar 15, 2019 6:44:10 AM (6 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Nested VMX: bugref:9180 CPUM helper for figuring out blocking of NMIs (and virtual-NMIs).

File:
1 edited

Legend:

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

    r77149 r77712  
    27782778
    27792779/**
     2780 * Gets whether the guest (or nested-guest) is currently blocking delivery of NMIs.
     2781 *
     2782 * @returns @c true if NMIs are blocked, @c false otherwise.
     2783 * @param   pVCpu       The cross context virtual CPU structure.
     2784 */
     2785VMM_INT_DECL(bool) CPUMIsGuestNmiBlocking(PVMCPU pVCpu)
     2786{
     2787#ifndef IN_RC
     2788    /*
     2789     * Return the state of guest-NMI blocking in any of the following cases:
     2790     *   - We're not executing a nested-guest.
     2791     *   - We're executing an SVM nested-guest[1].
     2792     *   - We're executing a VMX nested-guest without virtual-NMIs enabled.
     2793     *
     2794     * [1] -- SVM does not support virtual-NMIs or virtual-NMI blocking.
     2795     *        SVM hypervisors must track NMI blocking themselves by intercepting
     2796     *        the IRET instruction after injection of an NMI.
     2797     */
     2798    PCCPUMCTX pCtx = &pVCpu->cpum.s.Guest;
     2799    if (   !CPUMIsGuestInNestedHwvirtMode(pCtx)
     2800        ||  CPUMIsGuestInSvmNestedHwVirtMode(pCtx)
     2801        || !CPUMIsGuestVmxPinCtlsSet(pVCpu, pCtx, VMX_PIN_CTLS_VIRT_NMI))
     2802        return VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
     2803
     2804    /*
     2805     * Return the state of virtual-NMI blocking, if we are executing a
     2806     * VMX nested-guest with virtual-NMIs enabled.
     2807     */
     2808    Assert(CPUMIsGuestVmxPinCtlsSet(pVCpu, pCtx, VMX_PIN_CTLS_VIRT_NMI));
     2809    return pCtx->hwvirt.vmx.fVirtNmiBlocking;
     2810#else
     2811    return VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
     2812#endif
     2813}
     2814
     2815
     2816/**
    27802817 * Checks whether the VMX nested-guest is in a state to receive physical (APIC)
    27812818 * interrupts.
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