VirtualBox

Changeset 48701 in vbox


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.

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r48670 r48701  
    881881
    882882        if (fOsXGuest)
    883             InsertConfigInteger(pCPUM, "EnableHVP", 1);
     883        {
     884            if (   osTypeId == "MacOS"
     885                || osTypeId == "MacOS_x64"
     886                || osTypeId >= "MacOS107_x64")
     887                InsertConfigInteger(pCPUM, "EnableHVP", 1);
     888
     889            /* Fake the CPU family/model so the guest works.  This is partly
     890               because older mac releases really doesn't work on newer cpus,
     891               and partly because mac os x expects more from systems with newer
     892               cpus (MSRs, power features, whatever). */
     893            uint32_t uMaxIntelFamilyModelStep = UINT32_MAX;
     894            if (   osTypeId == "MacOS"
     895                || osTypeId == "MacOS_x64")
     896                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 0); /* Penryn. */
     897            else if (   osTypeId == "MacOS106"
     898                     || osTypeId == "MacOS106_x64")
     899                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 0); /* Penryn */
     900            else if (   osTypeId == "MacOS107"
     901                     || osTypeId == "MacOS107_x64")
     902                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 0); /* Penryn */ /** @todo figure out what is required here. */
     903            else if (   osTypeId == "MacOS108"
     904                     || osTypeId == "MacOS108_x64")
     905                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 0); /* Penryn */ /** @todo figure out what is required here. */
     906            else if (   osTypeId == "MacOS109"
     907                     || osTypeId == "MacOS109_x64")
     908                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 0); /* Penryn */ /** @todo figure out what is required here. */
     909            if (uMaxIntelFamilyModelStep != UINT32_MAX)
     910                InsertConfigInteger(pCPUM, "MaxIntelFamilyModelStep", uMaxIntelFamilyModelStep);
     911        }
     912
    884913
    885914        /* Synthetic CPU */
     
    26732702        if (fACPI)
    26742703        {
    2675             BOOL fCpuHotPlug = false;
    2676             BOOL fShowCpu = fOsXGuest;
    26772704            /* Always show the CPU leafs when we have multiple VCPUs or when the IO-APIC is enabled.
    26782705             * The Windows SMP kernel needs a CPU leaf or else its idle loop will burn cpu cycles; the
    26792706             * intelppm driver refuses to register an idle state handler.
    2680              */
    2681             if ((cCpus > 1) || fIOAPIC)
     2707             * Always show CPU leafs for OS X guests. */
     2708            BOOL fShowCpu = fOsXGuest;
     2709            if (cCpus > 1 || fIOAPIC)
    26822710                fShowCpu = true;
    26832711
     2712            BOOL fCpuHotPlug;
    26842713            hrc = pMachine->COMGETTER(CPUHotPlugEnabled)(&fCpuHotPlug);                     H();
    26852714
  • 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