VirtualBox

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


Ignore:
Timestamp:
Jan 31, 2022 10:45:35 PM (3 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Quick arm64 build adjustments. bugref:9898

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

Legend:

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

    r93515 r93519  
    3737#include <iprt/mem.h>
    3838#include <iprt/string.h>
     39#include <iprt/x86-helpers.h>
    3940
    4041
     
    822823
    823824
     825#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    824826/**
    825827 * Append a CPUID leaf or sub-leaf.
     
    866868    return VINF_SUCCESS;
    867869}
     870#endif /* RT_ARCH_X86 || RT_ARCH_AMD64 */
    868871
    869872
     
    52785281     * handy when validating features for raw mode.
    52795282     */
     5283#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    52805284    CPUMCPUID   aRawStd[16];
    52815285    for (unsigned i = 0; i < RT_ELEMENTS(aRawStd); i++)
     
    52895293    SSMR3PutU32(pSSM, RT_ELEMENTS(aRawExt));
    52905294    SSMR3PutMem(pSSM, &aRawExt[0], sizeof(aRawExt));
     5295
     5296#else
     5297    /* Two zero counts on non-x86 hosts. */
     5298    SSMR3PutU32(pSSM, 0);
     5299    SSMR3PutU32(pSSM, 0);
     5300#endif
    52915301}
    52925302
     
    54785488    AssertRCReturn(rc, rc);
    54795489    for (uint32_t i = cRawStd; i < RT_ELEMENTS(aRawStd); i++)
     5490#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    54805491        ASMCpuIdExSlow(i, 0, 0, 0, &aRawStd[i].uEax, &aRawStd[i].uEbx, &aRawStd[i].uEcx, &aRawStd[i].uEdx);
     5492#else
     5493        RT_ZERO(aRawStd[i]);
     5494#endif
    54815495
    54825496    CPUMCPUID   aRawExt[32];
     
    54885502    AssertRCReturn(rc, rc);
    54895503    for (uint32_t i = cRawExt; i < RT_ELEMENTS(aRawExt); i++)
     5504#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    54905505        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0, &aRawExt[i].uEax, &aRawExt[i].uEbx, &aRawExt[i].uEcx, &aRawExt[i].uEdx);
     5506#else
     5507        RT_ZERO(aRawExt[i]);
     5508#endif
    54915509
    54925510    /*
     
    54945512     */
    54955513    CPUMCPUID   aHostRawStd[16];
     5514#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    54965515    for (unsigned i = 0; i < RT_ELEMENTS(aHostRawStd); i++)
    54975516        ASMCpuIdExSlow(i, 0, 0, 0, &aHostRawStd[i].uEax, &aHostRawStd[i].uEbx, &aHostRawStd[i].uEcx, &aHostRawStd[i].uEdx);
     5517#else
     5518    RT_ZERO(aHostRawStd);
     5519#endif
    54985520
    54995521    CPUMCPUID   aHostRawExt[32];
     5522#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    55005523    for (unsigned i = 0; i < RT_ELEMENTS(aHostRawExt); i++)
    55015524        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0,
    55025525                       &aHostRawExt[i].uEax, &aHostRawExt[i].uEbx, &aHostRawExt[i].uEcx, &aHostRawExt[i].uEdx);
     5526#else
     5527    RT_ZERO(aHostRawExt);
     5528#endif
    55035529
    55045530    /*
     
    59035929
    59045930
     5931#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    59055932        for (uint32_t uSubLeaf = 2; uSubLeaf < 64; uSubLeaf++)
    59065933        {
     
    59225949            }
    59235950        }
     5951#endif
    59245952    }
    59255953    /* Clear leaf 0xd just in case we're loading an old state... */
     
    60566084    /** @todo we should check the 64 bits capabilities too! */
    60576085    uint32_t au32CpuId[8] = {0,0,0,0, 0,0,0,0};
     6086#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    60586087    ASMCpuIdExSlow(0, 0, 0, 0, &au32CpuId[0], &au32CpuId[1], &au32CpuId[2], &au32CpuId[3]);
    60596088    ASMCpuIdExSlow(1, 0, 0, 0, &au32CpuId[4], &au32CpuId[5], &au32CpuId[6], &au32CpuId[7]);
     6089#endif
    60606090    uint32_t au32CpuIdSaved[8];
    60616091    rc = SSMR3GetMem(pSSM, &au32CpuIdSaved[0], sizeof(au32CpuIdSaved));
     
    66306660    if (fVerbose)
    66316661    {
    6632         CPUMCPUID Host;
     6662        CPUMCPUID Host = {0};
     6663#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    66336664        ASMCpuIdExSlow(1, 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     6665#endif
    66346666        pHlp->pfnPrintf(pHlp, "Features\n");
    66356667        pHlp->pfnPrintf(pHlp, "  Mnemonic - Description                                  = guest (host)\n");
     
    66616693    for (;;)
    66626694    {
    6663         CPUMCPUID Host;
     6695        CPUMCPUID Host = {0};
     6696#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    66646697        ASMCpuIdExSlow(pCurLeaf->uLeaf, 0, pCurLeaf->uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     6698#endif
    66656699
    66666700        switch (pCurLeaf->uSubLeaf)
     
    67186752    for (uint32_t uSubLeaf = 0; uSubLeaf < 64; uSubLeaf++)
    67196753    {
    6720         CPUMCPUID Host;
     6754        CPUMCPUID Host = {0};
     6755#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    67216756        ASMCpuIdExSlow(UINT32_C(0x0000000d), 0, uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     6757#endif
    67226758
    67236759        switch (uSubLeaf)
     
    68106846               && pCurLeaf->uLeaf <= uUpToLeaf)
    68116847        {
    6812             CPUMCPUID Host;
     6848            CPUMCPUID Host = {0};
     6849#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    68136850            ASMCpuIdExSlow(pCurLeaf->uLeaf, 0, pCurLeaf->uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     6851#endif
    68146852            pHlp->pfnPrintf(pHlp,
    68156853                            "Gst: %08x/%04x  %08x %08x %08x %08x\n"
     
    68486886
    68496887    uint32_t        uLeaf;
    6850     CPUMCPUID       Host;
     6888    CPUMCPUID       Host     = {0};
    68516889    uint32_t        cLeaves  = pVM->cpum.s.GuestInfo.cCpuIdLeaves;
    68526890    PCPUMCPUIDLEAF  paLeaves = pVM->cpum.s.GuestInfo.paCpuIdLeavesR3;
     
    68606898     * Standard leaves.  Custom raw dump here due to ECX sub-leaves host handling.
    68616899     */
     6900#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    68626901    uint32_t        cHstMax = ASMCpuId_EAX(0);
     6902#else
     6903    uint32_t        cHstMax = 0;
     6904#endif
    68636905    uint32_t        cGstMax = paLeaves[0].uLeaf == 0 ? paLeaves[0].uEax : 0;
    68646906    uint32_t        cMax    = RT_MAX(cGstMax, cHstMax);
     
    68766918        for (uint32_t uSubLeaf = 0; uSubLeaf < cMaxSubLeaves; uSubLeaf++)
    68776919        {
     6920#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    68786921            ASMCpuIdExSlow(uLeaf, 0, uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     6922#endif
    68796923            if (   (uintptr_t)(pCurLeaf - paLeaves) < cLeaves
    68806924                && pCurLeaf->uLeaf    == uLeaf
     
    69406984    pCurLeaf = cpumR3CpuIdInfoRawRange(pHlp, paLeaves, cLeaves, pCurLeaf, UINT32_C(0x3fffffff), "Unknown CPUID Leaves");
    69416985
     6986#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    69426987    ASMCpuIdExSlow(UINT32_C(0x40000000), 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     6988#endif
    69436989    cHstMax  = Host.uEax >= UINT32_C(0x40000001) && Host.uEax <= UINT32_C(0x40000fff) ? Host.uEax : 0;
    69446990    cGstMax  = (uintptr_t)(pCurLeaf - paLeaves) < cLeaves && pCurLeaf->uLeaf == UINT32_C(0x40000000)
     
    69617007    pCurLeaf = cpumR3CpuIdInfoRawRange(pHlp, paLeaves, cLeaves, pCurLeaf, UINT32_C(0x7fffffff), "Unknown CPUID Leaves");
    69627008
     7009#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    69637010    ASMCpuIdExSlow(UINT32_C(0x80000000), 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     7011#endif
    69647012    cHstMax  = RTX86IsValidExtRange(Host.uEax) ? RT_MIN(Host.uEax, UINT32_C(0x80000fff)) : 0;
    69657013    cGstMax  = (uintptr_t)(pCurLeaf - paLeaves) < cLeaves && pCurLeaf->uLeaf == UINT32_C(0x80000000)
     
    69817029            for (uint32_t uSubLeaf = 0; uSubLeaf < cMaxSubLeaves; uSubLeaf++)
    69827030            {
     7031#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    69837032                ASMCpuIdExSlow(uLeaf, 0, uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     7033#endif
    69847034                if (   (uintptr_t)(pCurLeaf - paLeaves) < cLeaves
    69857035                    && pCurLeaf->uLeaf    == uLeaf
     
    70397089            else
    70407090            {
     7091#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    70417092                ASMCpuIdExSlow(0x80000001, 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     7093#endif
    70427094                pHlp->pfnPrintf(pHlp, "Ext Features\n");
    70437095                pHlp->pfnPrintf(pHlp, "  Mnemonic - Description                                  = guest (host)\n");
     
    70477099                {
    70487100                    pHlp->pfnPrintf(pHlp, "SVM Feature Identification (leaf A):\n");
     7101#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    70497102                    ASMCpuIdExSlow(0x8000000a, 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     7103#endif
    70507104                    pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x8000000a), 0);
    70517105                    uint32_t const uGstEdx = pCurLeaf ? pCurLeaf->uEdx : 0;
     
    71497203        if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x80000007), 0)) != NULL)
    71507204        {
     7205#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    71517206            ASMCpuIdExSlow(UINT32_C(0x80000007), 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     7207#endif
    71527208            if (pCurLeaf->uEdx || (Host.uEdx && iVerbosity))
    71537209            {
     
    71627218        if (pCurLeaf != NULL)
    71637219        {
     7220#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    71647221            ASMCpuIdExSlow(UINT32_C(0x80000008), 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     7222#endif
    71657223            if (pCurLeaf->uEbx || (Host.uEbx && iVerbosity))
    71667224            {
     
    72067264    pCurLeaf = cpumR3CpuIdInfoRawRange(pHlp, paLeaves, cLeaves, pCurLeaf, UINT32_C(0xbfffffff), "Unknown CPUID Leaves");
    72077265
     7266#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    72087267    ASMCpuIdExSlow(UINT32_C(0xc0000000), 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     7268#endif
    72097269    cHstMax  = Host.uEax >= UINT32_C(0xc0000001) && Host.uEax <= UINT32_C(0xc0000fff)
    72107270             ? RT_MIN(Host.uEax,      UINT32_C(0xc0000fff)) : 0;
     
    72267286        if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0xc0000001), 0)) != NULL)
    72277287        {
     7288#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    72287289            ASMCpuIdExSlow(0xc0000001, 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
     7290#endif
    72297291            uint32_t uEdxGst = pCurLeaf->uEdx;
    72307292            uint32_t uEdxHst = Host.uEdx;
  • trunk/src/VBox/VMM/VMMR3/CPUMR3Db.cpp

    r93515 r93519  
    752752}
    753753
     754#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    754755
    755756/**
     
    869870}
    870871
     872#endif /* RT_ARCH_X86 || RT_ARCH_AMD64 */
    871873
    872874int cpumR3DbGetCpuInfo(const char *pszName, PCPUMINFO pInfo)
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