VirtualBox

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


Ignore:
Timestamp:
Jun 25, 2019 6:28:07 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131534
Message:

VMM/CPUM: Nested VMX: bugref:9180 We need to look at the current VMCS' control (rather than VCPU VMX capability) while checking if VMREAD/VMWRITE is intercepted.
Ofc, the control can't be set if the VCPU VMX capability is not present but that's already checked during VM-entry.
Naming nit and corresponding doxygen.

File:
1 edited

Legend:

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

    r79202 r79316  
    35873587 * @param   uExitReason     The VM-exit reason (VMX_EXIT_VMREAD or
    35883588 *                          VMX_EXIT_VMREAD).
    3589  * @param   u64FieldEnc     The VMCS field encoding.
    3590  */
    3591 VMM_INT_DECL(bool) CPUMIsGuestVmxVmreadVmwriteInterceptSet(PCVMCPU pVCpu, uint32_t uExitReason, uint64_t u64FieldEnc)
     3589 * @param   u64VmcsField    The VMCS field.
     3590 */
     3591VMM_INT_DECL(bool) CPUMIsGuestVmxVmreadVmwriteInterceptSet(PCVMCPU pVCpu, uint32_t uExitReason, uint64_t u64VmcsField)
    35923592{
    35933593#ifndef IN_RC
     
    35993599     * Without VMCS shadowing, all VMREAD and VMWRITE instructions are intercepted.
    36003600     */
    3601     if (!pVCpu->CTX_SUFF(pVM)->cpum.s.GuestFeatures.fVmxVmcsShadowing)
     3601    if (!CPUMIsGuestVmxProcCtls2Set(pVCpu, &pVCpu->cpum.s.Guest, VMX_PROC_CTLS2_VMCS_SHADOWING))
    36023602        return true;
    36033603
     
    36073607     * encoding (i.e. bit 12).
    36083608     */
    3609     if (u64FieldEnc & VMX_VMCSFIELD_RSVD_MASK)
     3609    if (u64VmcsField & VMX_VMCSFIELD_RSVD_MASK)
    36103610        return true;
    36113611
     
    36133613     * Finally, consult the VMREAD/VMWRITE bitmap whether to intercept the instruction or not.
    36143614     */
    3615     uint32_t const u32FieldEnc = RT_LO_U32(u64FieldEnc);
    3616     Assert(u32FieldEnc >> 3 < VMX_V_VMREAD_VMWRITE_BITMAP_SIZE);
    3617     Assert(pVCpu->cpum.s.Guest.hwvirt.vmx.CTX_SUFF(pvVmreadBitmap));
     3615    uint32_t const u32VmcsField = RT_LO_U32(u64VmcsField);
    36183616    uint8_t const *pbBitmap = uExitReason == VMX_EXIT_VMREAD
    36193617                            ? (uint8_t const *)pVCpu->cpum.s.Guest.hwvirt.vmx.CTX_SUFF(pvVmreadBitmap)
    36203618                            : (uint8_t const *)pVCpu->cpum.s.Guest.hwvirt.vmx.CTX_SUFF(pvVmwriteBitmap);
    36213619    Assert(pbBitmap);
    3622     pbBitmap += (u32FieldEnc >> 3);
    3623     if (*pbBitmap & RT_BIT(u32FieldEnc & 7))
     3620    Assert(u32VmcsField >> 3 < VMX_V_VMREAD_VMWRITE_BITMAP_SIZE);
     3621    pbBitmap += (u32VmcsField >> 3);
     3622    if (*pbBitmap & RT_BIT(u32VmcsField & 7))
    36243623        return true;
    36253624
    36263625    return false;
    3627 
    36283626#else
    3629     RT_NOREF3(pVCpu, uExitReason, u64FieldEnc);
     3627    RT_NOREF3(pVCpu, uExitReason, u64VmcsField);
    36303628    return false;
    36313629#endif
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