VirtualBox

Changeset 76550 in vbox


Ignore:
Timestamp:
Dec 31, 2018 4:15:57 AM (6 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Nested VMX: bugref:9180 Fix reporting CR0, CR4 fixed-1 bits according to real hardware.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
2 edited

Legend:

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

    r76493 r76550  
    14221422
    14231423    /* CR0 Fixed-0. */
    1424     pGuestVmxMsrs->u64Cr0Fixed0 = pGuestFeatures->fVmxUnrestrictedGuest ? VMX_V_CR0_FIXED0_UX:  VMX_V_CR0_FIXED0;
     1424    pGuestVmxMsrs->u64Cr0Fixed0 = pGuestFeatures->fVmxUnrestrictedGuest ? VMX_V_CR0_FIXED0_UX: VMX_V_CR0_FIXED0;
    14251425
    14261426    /* CR0 Fixed-1. */
    14271427    {
    1428         uint64_t const uHostMsr = fIsNstGstHwExecAllowed ? pHostVmxMsrs->u64Cr0Fixed1 : 0;
     1428        /*
     1429         * All CPUs I've looked at so far report CR0 fixed-1 bits as 0xffffffff.
     1430         * This is different from CR4 fixed-1 bits which are reported as per the
     1431         * CPU features and/or micro-architecture/generation. Why? Ask Intel.
     1432         */
     1433        uint64_t const uHostMsr = fIsNstGstHwExecAllowed ? pHostVmxMsrs->u64Cr0Fixed1 : 0xffffffff;
    14291434        pGuestVmxMsrs->u64Cr0Fixed1 = uHostMsr | VMX_V_CR0_FIXED0;   /* Make sure the CR0 MB1 bits are not clear. */
    14301435    }
     
    14351440    /* CR4 Fixed-1. */
    14361441    {
    1437         uint64_t const uHostMsr = fIsNstGstHwExecAllowed ? pHostVmxMsrs->u64Cr4Fixed1 : 0;
     1442        uint64_t const uHostMsr = fIsNstGstHwExecAllowed ? pHostVmxMsrs->u64Cr4Fixed1 : CPUMGetGuestCR4ValidMask(pVM);
    14381443        pGuestVmxMsrs->u64Cr4Fixed1 = uHostMsr | VMX_V_CR4_FIXED0;   /* Make sure the CR4 MB1 bits are not clear. */
    14391444    }
  • trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp

    r76464 r76550  
    44624462         *
    44634463         * This needs to be done -after- exploding guest features and sanitizing CPUID leaves
    4464          * as constructing VMX capabilities MSRs rely on CPU feature bits such as long mode,
    4465          * unrestricted execution and possibly more in the future.
     4464         * as constructing VMX capabilities MSRs rely on CPU feature bits like long mode,
     4465         * unrestricted-guest execution, CR4 feature bits and possibly more in the future.
    44664466         */
    44674467        if (pVM->cpum.s.GuestFeatures.fVmx)
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