VirtualBox

Changeset 49182 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Oct 18, 2013 2:14:27 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
90059
Message:

Added ASMCpuIdExSlow and made CPUM use it.

File:
1 edited

Legend:

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

    r49019 r49182  
    550550static void cpumR3CheckLeakyFpu(PVM pVM)
    551551{
    552     uint32_t u32CpuVersion;
    553     uint32_t u32Dummy;
    554     ASMCpuId(1, &u32CpuVersion, &u32Dummy, &u32Dummy, &u32Dummy);
     552    uint32_t u32CpuVersion = ASMCpuId_EAX(1);
    555553    uint32_t const u32Family = u32CpuVersion >> 8;
    556554    if (   u32Family >= 6      /* K7 and higher */
    557555        && ASMIsAmdCpu())
    558556    {
    559         uint32_t cExt = 0;
    560         ASMCpuId(0x80000000, &cExt, &u32Dummy, &u32Dummy, &u32Dummy);
     557        uint32_t cExt = ASMCpuId_EAX(0x80000000);
    561558        if (ASMIsValidExtRange(cExt))
    562559        {
     
    810807    /* Using the ECX variant for all of them can't hurt... */
    811808    for (uint32_t i = 0; i < cLeaves; i++)
    812         ASMCpuId_Idx_ECX(uStart + i, 0, &paLeaves[i].eax, &paLeaves[i].ebx, &paLeaves[i].ecx, &paLeaves[i].edx);
     809        ASMCpuIdExSlow(uStart + i, 0, 0, 0, &paLeaves[i].eax, &paLeaves[i].ebx, &paLeaves[i].ecx, &paLeaves[i].edx);
    813810
    814811    /* Load CPUID leaf override; we currently don't care if the user
     
    891888     * perhaps some random garbage, we don't try to duplicate this behavior.
    892889     */
    893     ASMCpuId(pCPUM->aGuestCpuIdStd[0].eax + 10, /** @todo r=bird: Use the host value here in case of overrides and more than 10 leaves being stripped already. */
    894              &pCPUM->GuestCpuIdDef.eax, &pCPUM->GuestCpuIdDef.ebx,
    895              &pCPUM->GuestCpuIdDef.ecx, &pCPUM->GuestCpuIdDef.edx);
     890    ASMCpuIdExSlow(pCPUM->aGuestCpuIdStd[0].eax + 10, 0, 0, 0, /** @todo r=bird: Use the host value here in case of overrides and more than 10 leaves being stripped already. */
     891                   &pCPUM->GuestCpuIdDef.eax, &pCPUM->GuestCpuIdDef.ebx,
     892                   &pCPUM->GuestCpuIdDef.ecx, &pCPUM->GuestCpuIdDef.edx);
    896893
    897894    /** @cfgm{/CPUM/CMPXCHG16B, boolean, false}
     
    17191716    CPUMCPUID   aRawStd[16];
    17201717    for (unsigned i = 0; i < RT_ELEMENTS(aRawStd); i++)
    1721         ASMCpuId(i, &aRawStd[i].eax, &aRawStd[i].ebx, &aRawStd[i].ecx, &aRawStd[i].edx);
     1718        ASMCpuIdExSlow(i, 0, 0, 0, &aRawStd[i].eax, &aRawStd[i].ebx, &aRawStd[i].ecx, &aRawStd[i].edx);
    17221719    SSMR3PutU32(pSSM, RT_ELEMENTS(aRawStd));
    17231720    SSMR3PutMem(pSSM, &aRawStd[0], sizeof(aRawStd));
     
    17251722    CPUMCPUID   aRawExt[32];
    17261723    for (unsigned i = 0; i < RT_ELEMENTS(aRawExt); i++)
    1727         ASMCpuId(i | UINT32_C(0x80000000), &aRawExt[i].eax, &aRawExt[i].ebx, &aRawExt[i].ecx, &aRawExt[i].edx);
     1724        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0, &aRawExt[i].eax, &aRawExt[i].ebx, &aRawExt[i].ecx, &aRawExt[i].edx);
    17281725    SSMR3PutU32(pSSM, RT_ELEMENTS(aRawExt));
    17291726    SSMR3PutMem(pSSM, &aRawExt[0], sizeof(aRawExt));
     
    19801977
    19811978    for (uint32_t i = cRawStd; i < RT_ELEMENTS(aRawStd); i++)
    1982         ASMCpuId(i, &aRawStd[i].eax, &aRawStd[i].ebx, &aRawStd[i].ecx, &aRawStd[i].edx);
     1979        ASMCpuIdExSlow(i, 0, 0, 0, &aRawStd[i].eax, &aRawStd[i].ebx, &aRawStd[i].ecx, &aRawStd[i].edx);
    19831980
    19841981    for (uint32_t i = cRawExt; i < RT_ELEMENTS(aRawExt); i++)
    1985         ASMCpuId(i | UINT32_C(0x80000000), &aRawExt[i].eax, &aRawExt[i].ebx, &aRawExt[i].ecx, &aRawExt[i].edx);
     1982        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0, &aRawExt[i].eax, &aRawExt[i].ebx, &aRawExt[i].ecx, &aRawExt[i].edx);
    19861983
    19871984    /*
     
    19901987    CPUMCPUID   aHostRawStd[16];
    19911988    for (unsigned i = 0; i < RT_ELEMENTS(aHostRawStd); i++)
    1992         ASMCpuId(i, &aHostRawStd[i].eax, &aHostRawStd[i].ebx, &aHostRawStd[i].ecx, &aHostRawStd[i].edx);
     1989        ASMCpuIdExSlow(i, 0, 0, 0, &aHostRawStd[i].eax, &aHostRawStd[i].ebx, &aHostRawStd[i].ecx, &aHostRawStd[i].edx);
    19931990
    19941991    CPUMCPUID   aHostRawExt[32];
    19951992    for (unsigned i = 0; i < RT_ELEMENTS(aHostRawExt); i++)
    1996         ASMCpuId(i | UINT32_C(0x80000000), &aHostRawExt[i].eax, &aHostRawExt[i].ebx, &aHostRawExt[i].ecx, &aHostRawExt[i].edx);
     1993        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0,
     1994                       &aHostRawExt[i].eax, &aHostRawExt[i].ebx, &aHostRawExt[i].ecx, &aHostRawExt[i].edx);
    19971995
    19981996    /*
     
    27002698    /** @todo we should check the 64 bits capabilities too! */
    27012699    uint32_t au32CpuId[8] = {0,0,0,0, 0,0,0,0};
    2702     ASMCpuId(0, &au32CpuId[0], &au32CpuId[1], &au32CpuId[2], &au32CpuId[3]);
    2703     ASMCpuId(1, &au32CpuId[4], &au32CpuId[5], &au32CpuId[6], &au32CpuId[7]);
     2700    ASMCpuIdExSlow(0, 0, 0, 0, &au32CpuId[0], &au32CpuId[1], &au32CpuId[2], &au32CpuId[3]);
     2701    ASMCpuIdExSlow(1, 0, 0, 0, &au32CpuId[4], &au32CpuId[5], &au32CpuId[6], &au32CpuId[7]);
    27042702    uint32_t au32CpuIdSaved[8];
    27052703    rc = SSMR3GetMem(pSSM, &au32CpuIdSaved[0], sizeof(au32CpuIdSaved));
     
    33853383    uint32_t    cStdHstMax;
    33863384    uint32_t    dummy;
    3387     ASMCpuId_Idx_ECX(0, 0, &cStdHstMax, &dummy, &dummy, &dummy);
     3385    ASMCpuIdExSlow(0, 0, 0, 0, &cStdHstMax, &dummy, &dummy, &dummy);
    33883386
    33893387    unsigned    cStdLstMax = RT_MAX(RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd), cStdHstMax);
     
    33973395        {
    33983396            Guest = pVM->cpum.s.aGuestCpuIdStd[i];
    3399             ASMCpuId_Idx_ECX(i, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     3397            ASMCpuIdExSlow(i, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
    34003398
    34013399            pHlp->pfnPrintf(pHlp,
     
    34083406        else
    34093407        {
    3410             ASMCpuId_Idx_ECX(i, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     3408            ASMCpuIdExSlow(i, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
    34113409
    34123410            pHlp->pfnPrintf(pHlp,
     
    35343532        else
    35353533        {
    3536             ASMCpuId(1, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     3534            ASMCpuIdExSlow(1, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
    35373535
    35383536            X86CPUIDFEATEDX EdxHost  = *(PX86CPUIDFEATEDX)&Host.edx;
     
    36263624    {
    36273625        Guest = pVM->cpum.s.aGuestCpuIdExt[i];
    3628         ASMCpuId(0x80000000 | i, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     3626        ASMCpuIdExSlow(0x80000000 | i, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
    36293627
    36303628        pHlp->pfnPrintf(pHlp,
     
    37233721        else
    37243722        {
    3725             ASMCpuId(0x80000001, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     3723            ASMCpuIdExSlow(0x80000001, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
    37263724
    37273725            uint32_t uEdxGst = Guest.edx;
     
    39183916    {
    39193917        Guest = pVM->cpum.s.aGuestCpuIdCentaur[i];
    3920         ASMCpuId(0xc0000000 | i, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     3918        ASMCpuIdExSlow(0xc0000000 | i, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
    39213919
    39223920        pHlp->pfnPrintf(pHlp,
     
    39413939    if (iVerbosity && cCentaurMax >= 1)
    39423940    {
    3943         ASMCpuId(0xc0000001, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     3941        ASMCpuIdExSlow(0xc0000001, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
    39443942        uint32_t uEdxGst = pVM->cpum.s.aGuestCpuIdExt[1].edx;
    39453943        uint32_t uEdxHst = Host.edx;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette