VirtualBox

Changeset 98355 in vbox


Ignore:
Timestamp:
Jan 31, 2023 9:08:28 AM (2 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Nested VMX: bugref:10318 Get CR4 fixed bits from what we expose to the guest overriding what's supported by hardware.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r98103 r98355  
    15311531         * CPU features and/or micro-architecture/generation. Why? Ask Intel.
    15321532         */
    1533         uint64_t const uHostMsr = fIsNstGstHwExecAllowed ? pHostVmxMsrs->u64Cr0Fixed1 : VMX_V_CR0_FIXED1;
    1534         pGuestVmxMsrs->u64Cr0Fixed1 = uHostMsr | pGuestVmxMsrs->u64Cr0Fixed0;   /* Make sure the CR0 MB1 bits are not clear. */
     1533        pGuestVmxMsrs->u64Cr0Fixed1 = fIsNstGstHwExecAllowed ? pHostVmxMsrs->u64Cr0Fixed1 : VMX_V_CR0_FIXED1;
     1534
     1535        /* Make sure the CR0 MB1 bits are not clear. */
     1536        Assert((pGuestVmxMsrs->u64Cr0Fixed1 & pGuestVmxMsrs->u64Cr0Fixed0) == pGuestVmxMsrs->u64Cr0Fixed0);
    15351537    }
    15361538
     
    15401542    /* CR4 Fixed-1. */
    15411543    {
    1542         uint64_t const uHostMsr = fIsNstGstHwExecAllowed ? pHostVmxMsrs->u64Cr4Fixed1 : CPUMGetGuestCR4ValidMask(pVM);
    1543         pGuestVmxMsrs->u64Cr4Fixed1 = uHostMsr | pGuestVmxMsrs->u64Cr4Fixed0;   /* Make sure the CR4 MB1 bits are not clear. */
     1544        pGuestVmxMsrs->u64Cr4Fixed1 = CPUMGetGuestCR4ValidMask(pVM) & pHostVmxMsrs->u64Cr4Fixed1;
     1545
     1546        /* Make sure the CR4 MB1 bits are not clear. */
     1547        Assert((pGuestVmxMsrs->u64Cr4Fixed1 & pGuestVmxMsrs->u64Cr4Fixed0) == pGuestVmxMsrs->u64Cr4Fixed0);
     1548
     1549        /* Make sure bits that must always be set are set. */
     1550        Assert(pGuestVmxMsrs->u64Cr4Fixed1 & X86_CR4_PAE);
     1551        Assert(pGuestVmxMsrs->u64Cr4Fixed1 & X86_CR4_VMXE);
    15441552    }
    15451553
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