VirtualBox

Changeset 49978 in vbox


Ignore:
Timestamp:
Dec 18, 2013 6:06:52 PM (11 years ago)
Author:
vboxsync
Message:

CPUM: One more P4 related issue that needs fudging.

File:
1 edited

Legend:

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

    r49977 r49978  
    440440
    441441/**
     442 * Worker for cpumR3MsrApplyFudge that applies one table.
     443 *
     444 * @returns VBox status code.
     445 * @param   pVM                 Pointer to the cross context VM structure.
     446 * @param   paRanges            Array of MSRs to fudge.
     447 * @param   cRanges             Number of MSRs in the array.
     448 */
     449static int cpumR3MsrApplyFudgeTable(PVM pVM, PCCPUMMSRRANGE paRanges, size_t cRanges)
     450{
     451    for (uint32_t i = 0; i < cRanges; i++)
     452        if (!cpumLookupMsrRange(pVM, paRanges[i].uFirst))
     453        {
     454            LogRel(("CPUM: MSR fudge: %#010x %s\n", paRanges[i].uFirst, paRanges[i].szName));
     455            int rc = cpumR3MsrRangesInsert(&pVM->cpum.s.GuestInfo.paMsrRangesR3, &pVM->cpum.s.GuestInfo.cMsrRanges,
     456                                           &paRanges[i]);
     457            if (RT_FAILURE(rc))
     458                return rc;
     459        }
     460    return VINF_SUCCESS;
     461}
     462
     463
     464/**
    442465 * Fudges the MSRs that guest are known to access in some odd cases.
    443466 *
     
    450473int cpumR3MsrApplyFudge(PVM pVM)
    451474{
     475    /*
     476     * Basic.
     477     */
    452478    static CPUMMSRRANGE const s_aFudgeMsrs[] =
    453479    {
    454         MFO(0x00000099, "IA32_P5_MC_ADDR",          Ia32P5McAddr),
     480        MFO(0x00000000, "IA32_P5_MC_ADDR",          Ia32P5McAddr),
    455481        MFX(0x00000001, "IA32_P5_MC_TYPE",          Ia32P5McType,   Ia32P5McType,   0, 0, UINT64_MAX),
    456482        MVO(0x00000017, "IA32_PLATFORM_ID",         0),
     
    470496        MFN(0x00000400, "IA32_MCi_CTL_STATUS_ADDR_MISC", Ia32McCtlStatusAddrMiscN, Ia32McCtlStatusAddrMiscN),
    471497    };
    472 
    473     for (uint32_t i = 0; i < RT_ELEMENTS(s_aFudgeMsrs); i++)
    474         if (!cpumLookupMsrRange(pVM, s_aFudgeMsrs[i].uFirst))
    475         {
    476             LogRel(("CPUM: MSR fudge: %#010x %s\n", s_aFudgeMsrs[i].uFirst, s_aFudgeMsrs[i].szName));
    477             int rc = cpumR3MsrRangesInsert(&pVM->cpum.s.GuestInfo.paMsrRangesR3, &pVM->cpum.s.GuestInfo.cMsrRanges,
    478                                            &s_aFudgeMsrs[i]);
    479             if (RT_FAILURE(rc))
    480                 return rc;
    481         }
    482 
    483     return VINF_SUCCESS;
     498    int rc = cpumR3MsrApplyFudgeTable(pVM, &s_aFudgeMsrs[0], RT_ELEMENTS(s_aFudgeMsrs));
     499    AssertLogRelRCReturn(rc, rc);
     500
     501    /*
     502     * XP might mistake opterons and other newer CPUs for P4s.
     503     */
     504    if (pVM->cpum.s.GuestFeatures.uFamily >= 0xf)
     505    {
     506        static CPUMMSRRANGE const s_aP4FudgeMsrs[] =
     507        {
     508            MFX(0x0000002c, "P4_EBC_FREQUENCY_ID", IntelP4EbcFrequencyId, IntelP4EbcFrequencyId, 0xf12010f, UINT64_MAX, 0),
     509        };
     510        int rc = cpumR3MsrApplyFudgeTable(pVM, &s_aP4FudgeMsrs[0], RT_ELEMENTS(s_aP4FudgeMsrs));
     511        AssertLogRelRCReturn(rc, rc);
     512    }
     513
     514    return rc;
    484515}
    485516
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