VirtualBox

Changeset 79074 in vbox


Ignore:
Timestamp:
Jun 11, 2019 5:27:55 AM (6 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 Pass the guest/host mask as parameter to CPUMGetGuestVmxMasked[Cr0|Cr4] for fix done in r131233.

File:
1 edited

Legend:

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

    r78919 r79074  
    54335433    if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
    54345434    {
     5435        PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
     5436        Assert(pVmcs);
    54355437        switch (iCrReg)
    54365438        {
    54375439            /* CR0/CR4 reads are subject to masking when in VMX non-root mode. */
    5438             case 0: crX = CPUMGetGuestVmxMaskedCr0(pVCpu, &pVCpu->cpum.GstCtx); break;
    5439             case 4: crX = CPUMGetGuestVmxMaskedCr4(pVCpu, &pVCpu->cpum.GstCtx); break;
     5440            case 0: crX = CPUMGetGuestVmxMaskedCr0(pVCpu, &pVCpu->cpum.GstCtx, pVmcs->u64Cr0Mask.u); break;
     5441            case 4: crX = CPUMGetGuestVmxMaskedCr4(pVCpu, &pVCpu->cpum.GstCtx, pVmcs->u64Cr4Mask.u); break;
    54405442
    54415443            case 3:
     
    54725474
    54735475#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    5474     uint64_t const u64GuestCr0 = !IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
    5475                                ? pVCpu->cpum.GstCtx.cr0
    5476                                : CPUMGetGuestVmxMaskedCr0(pVCpu, &pVCpu->cpum.GstCtx);
     5476    uint64_t u64MaskedCr0;
     5477    if (!IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
     5478        u64MaskedCr0 = pVCpu->cpum.GstCtx.cr0;
     5479    else
     5480    {
     5481        PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
     5482        Assert(pVmcs);
     5483        u64MaskedCr0 = CPUMGetGuestVmxMaskedCr0(pVCpu, &pVCpu->cpum.GstCtx, pVmcs->u64Cr0Mask.u);
     5484    }
     5485    uint64_t const u64GuestCr0 = u64MaskedCr0;
    54775486#else
    54785487    uint64_t const u64GuestCr0 = pVCpu->cpum.GstCtx.cr0;
     
    55185527
    55195528#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    5520     uint64_t const u64GuestCr0 = !IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
    5521                                ? pVCpu->cpum.GstCtx.cr0
    5522                                : CPUMGetGuestVmxMaskedCr0(pVCpu, &pVCpu->cpum.GstCtx);
     5529    uint64_t u64MaskedCr0;
     5530    if (!IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
     5531        u64MaskedCr0 = pVCpu->cpum.GstCtx.cr0;
     5532    else
     5533    {
     5534        PCVMXVVMCS pVmcs = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
     5535        Assert(pVmcs);
     5536        u64MaskedCr0 = CPUMGetGuestVmxMaskedCr0(pVCpu, &pVCpu->cpum.GstCtx, pVmcs->u64Cr0Mask.u);
     5537    }
     5538    uint64_t const u64GuestCr0 = u64MaskedCr0;
    55235539#else
    55245540    uint64_t const u64GuestCr0 = pVCpu->cpum.GstCtx.cr0;
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