VirtualBox

Ignore:
Timestamp:
May 30, 2019 5:22:30 AM (6 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 Use CPUMIsGuestVmxVmreadVmwriteInterceptSet.

File:
1 edited

Legend:

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

    r78776 r78864  
    77367736
    77377737/**
    7738  * Checks whether a VMREAD or VMWRITE instruction for the given VMCS field is
    7739  * intercepted (causes a VM-exit) or not.
    7740  *
    7741  * @returns @c true if the instruction is intercepted, @c false otherwise.
    7742  * @param   pVCpu           The cross context virtual CPU structure.
    7743  * @param   u64FieldEnc     The VMCS field encoding.
    7744  * @param   uExitReason     The VM-exit reason (VMX_EXIT_VMREAD or
    7745  *                          VMX_EXIT_VMREAD).
    7746  */
    7747 IEM_STATIC bool iemVmxIsVmreadVmwriteInterceptSet(PCVMCPU pVCpu, uint32_t uExitReason, uint64_t u64FieldEnc)
    7748 {
    7749     Assert(IEM_VMX_IS_NON_ROOT_MODE(pVCpu));
    7750     Assert(   uExitReason == VMX_EXIT_VMREAD
    7751            || uExitReason == VMX_EXIT_VMWRITE);
    7752 
    7753     /* Without VMCS shadowing, all VMREAD and VMWRITE instructions are intercepted. */
    7754     if (!IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fVmxVmcsShadowing)
    7755         return true;
    7756 
    7757     /*
    7758      * If any reserved bit in the 64-bit VMCS field encoding is set, the VMREAD/VMWRITE is intercepted.
    7759      * This excludes any reserved bits in the valid parts of the field encoding (i.e. bit 12).
    7760      */
    7761     if (u64FieldEnc & VMX_VMCS_ENC_RSVD_MASK)
    7762         return true;
    7763 
    7764     /* Finally, consult the VMREAD/VMWRITE bitmap whether to intercept the instruction or not. */
    7765     uint32_t const u32FieldEnc = RT_LO_U32(u64FieldEnc);
    7766     Assert(u32FieldEnc >> 3 < VMX_V_VMREAD_VMWRITE_BITMAP_SIZE);
    7767     Assert(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvVmreadBitmap));
    7768     uint8_t const *pbBitmap = uExitReason == VMX_EXIT_VMREAD
    7769                             ? (uint8_t const *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvVmreadBitmap)
    7770                             : (uint8_t const *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvVmwriteBitmap);
    7771     pbBitmap += (u32FieldEnc >> 3);
    7772     if (*pbBitmap & RT_BIT(u32FieldEnc & 7))
    7773         return true;
    7774 
    7775     return false;
    7776 }
    7777 
    7778 
    7779 /**
    77807738 * VMREAD common (memory/register) instruction execution worker
    77817739 *
     
    77947752    /* Nested-guest intercept. */
    77957753    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
    7796         && iemVmxIsVmreadVmwriteInterceptSet(pVCpu, VMX_EXIT_VMREAD, u64FieldEnc))
     7754        && CPUMIsGuestVmxVmreadVmwriteInterceptSet(pVCpu, VMX_EXIT_VMREAD, u64FieldEnc))
    77977755    {
    77987756        if (pExitInfo)
     
    80107968    /* Nested-guest intercept. */
    80117969    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
    8012         && iemVmxIsVmreadVmwriteInterceptSet(pVCpu, VMX_EXIT_VMWRITE, u64FieldEnc))
     7970        && CPUMIsGuestVmxVmreadVmwriteInterceptSet(pVCpu, VMX_EXIT_VMWRITE, u64FieldEnc))
    80137971    {
    80147972        if (pExitInfo)
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