VirtualBox

Changeset 48701 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Sep 26, 2013 10:20:10 AM (11 years ago)
Author:
vboxsync
Message:

Introduced /CPUM/MaxIntelFamilyModelStep config variable to hack Mac OS X guests into working.

File:
1 edited

Legend:

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

    r48646 r48701  
    857857    rc = CFGMR3QueryBoolDef(pCpumCfg, "CMPXCHG16B", &fCmpXchg16b, false); AssertRCReturn(rc, rc);
    858858
     859    /** @cfgm{/CPUM/MONITOR, boolean, true}
     860     * Expose MONITOR/MWAIT instructions to the guest.
     861     */
    859862    bool fMonitor;
    860863    rc = CFGMR3QueryBoolDef(pCpumCfg, "MONITOR", &fMonitor, true); AssertRCReturn(rc, rc);
     
    11931196    {
    11941197        pCPUM->aGuestCpuIdStd[5].ecx = X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0;
    1195         /* @todo: for now we just expose host's MWAIT C-states, although conceptually
     1198        /** @todo: for now we just expose host's MWAIT C-states, although conceptually
    11961199           it shall be part of our power management virtualization model */
    11971200#if 0
     
    12941297    bool fNt4LeafLimit;
    12951298    rc = CFGMR3QueryBoolDef(pCpumCfg, "NT4LeafLimit", &fNt4LeafLimit, false); AssertRCReturn(rc, rc);
    1296     if (fNt4LeafLimit)
    1297         pCPUM->aGuestCpuIdStd[0].eax = 3; /** @todo r=bird: shouldn't we check if pCPUM->aGuestCpuIdStd[0].eax > 3 before setting it 3 here? */
     1299    if (fNt4LeafLimit && pCPUM->aGuestCpuIdStd[0].eax > 3)
     1300        pCPUM->aGuestCpuIdStd[0].eax = 3;
    12981301
    12991302    /*
     
    13531356    pCPUM->aGuestCpuIdHyper[1].ebx = pCPUM->aGuestCpuIdHyper[1].ecx
    13541357                                   = pCPUM->aGuestCpuIdHyper[1].edx = 0;    /* Reserved */
     1358
     1359    /*
     1360     * Mini CPU selection support for making Mac OS X happy.
     1361     */
     1362    if (pCPUM->enmGuestCpuVendor == CPUMCPUVENDOR_INTEL)
     1363    {
     1364        /** @cfgm{/CPUM/MaxIntelFamilyModelStep, uint32_t, UINT32_MAX}
     1365         * Restrict the reported CPU family+model+stepping of intel CPUs.  This is
     1366         * probably going to be a temporary hack, so don't depend on this.
     1367         * The 1st byte of the value is the stepping, the 2nd byte value is the model
     1368         * number and the 3rd byte value is the family, and the 4th value must be zero.
     1369         */
     1370        uint32_t uMaxIntelFamilyModelStep;
     1371        rc = CFGMR3QueryU32Def(pCpumCfg, "MaxIntelFamilyModelStep", &uMaxIntelFamilyModelStep, UINT32_MAX);
     1372        AssertRCReturn(rc, rc);
     1373        uint32_t uCurIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(ASMGetCpuStepping(pCPUM->aGuestCpuIdStd[1].eax),
     1374                                                                ASMGetCpuModelIntel(pCPUM->aGuestCpuIdStd[1].eax),
     1375                                                                ASMGetCpuFamily(pCPUM->aGuestCpuIdStd[1].eax),
     1376                                                                0);
     1377        if (uMaxIntelFamilyModelStep < uCurIntelFamilyModelStep)
     1378        {
     1379            uint32_t uNew = pCPUM->aGuestCpuIdStd[1].eax & UINT32_C(0xf0003000);
     1380            uNew |= RT_BYTE1(uMaxIntelFamilyModelStep) & 0xf; /* stepping */
     1381            uNew |= (RT_BYTE2(uMaxIntelFamilyModelStep) & 0xf) << 4; /* 4 low model bits */
     1382            uNew |= (RT_BYTE2(uMaxIntelFamilyModelStep) >> 4) << 16; /* 4 high model bits */
     1383            uNew |= (RT_BYTE3(uMaxIntelFamilyModelStep) & 0xf) << 8; /* 4 low family bits */
     1384            if (RT_BYTE3(uMaxIntelFamilyModelStep) > 0xf) /* 8 high family bits, using intel's suggested calculation. */
     1385                uNew |= ( (RT_BYTE3(uMaxIntelFamilyModelStep) - (RT_BYTE3(uMaxIntelFamilyModelStep) & 0xf)) & 0xff ) << 20;
     1386            LogRel(("CPU: CPUID(0).EAX %#x -> %#x (uMaxIntelFamilyModelStep=%#x, uCurIntelFamilyModelStep=%#x\n",
     1387                    pCPUM->aGuestCpuIdStd[1].eax, uNew, uMaxIntelFamilyModelStep, uCurIntelFamilyModelStep));
     1388            pCPUM->aGuestCpuIdStd[1].eax = uNew;
     1389        }
     1390    }
    13551391
    13561392    /*
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