VirtualBox

Changeset 54740 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 12, 2015 11:12:21 PM (10 years ago)
Author:
vboxsync
Message:

VMM: Made the max CPUID leaf cutoffs configurable.

File:
1 edited

Legend:

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

    r54739 r54740  
    19611961    bool        fNt4LeafLimit;
    19621962    bool        fInvariantTsc;
     1963    uint32_t    uMaxStdLeaf;
     1964    uint32_t    uMaxExtLeaf;
     1965    uint32_t    uMaxCentaurLeaf;
    19631966    uint32_t    uMaxIntelFamilyModelStep;
    19641967    char        szCpuName[128];
     
    20652068        if (uLimit <= UINT32_C(0x000fffff))
    20662069        {
    2067             /** @todo raise the limits! */
    2068             if (pCurLeaf->uEax > 5)
     2070            if (uLimit > pConfig->uMaxStdLeaf)
    20692071            {
    2070                 pCurLeaf->uEax = uLimit = 5;
     2072                pCurLeaf->uEax = uLimit = pConfig->uMaxStdLeaf;
    20712073                cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
    20722074                                       uLimit + 1, UINT32_C(0x000fffff));
     
    20992101            && uLimit <= UINT32_C(0x800fffff))
    21002102        {
    2101             /** @todo raise the limits! */
    2102             if (pCurLeaf->uEax > UINT32_C(0x80000008))
     2103            if (uLimit > pConfig->uMaxExtLeaf)
    21032104            {
    2104                 pCurLeaf->uEax = uLimit = UINT32_C(0x80000008);
     2105                pCurLeaf->uEax = uLimit = pConfig->uMaxExtLeaf;
    21052106                cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
    21062107                                       uLimit + 1, UINT32_C(0x800fffff));
     2108                while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x80000000), ++uSubLeaf)) != NULL)
     2109                    pCurLeaf->uEax = uLimit;
    21072110            }
    2108 
    2109             while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x80000000), ++uSubLeaf)) != NULL)
    2110                 pCurLeaf->uEax = uLimit;
    21112111        }
    21122112        else
     
    21292129            && uLimit <= UINT32_C(0xc00fffff))
    21302130        {
    2131             pCurLeaf->uEax = RT_MIN(uLimit, UINT32_C(0xc0000004));
    2132             cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
    2133                                    uLimit + 1, UINT32_C(0xcfffffff));
    2134 
    2135             while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0xc0000000), ++uSubLeaf)) != NULL)
    2136                 pCurLeaf->uEax = uLimit;
     2131            if (uLimit > pConfig->uMaxCentaurLeaf)
     2132            {
     2133                pCurLeaf->uEax = uLimit = pConfig->uMaxCentaurLeaf;
     2134                cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
     2135                                       uLimit + 1, UINT32_C(0xcfffffff));
     2136                while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0xc0000000), ++uSubLeaf)) != NULL)
     2137                    pCurLeaf->uEax = uLimit;
     2138            }
    21372139        }
    21382140        else
     
    31673169    AssertLogRelRCReturn(rc, rc);
    31683170
     3171    /** @cfgm{/CPUM/MaxStdLeaf, uint32_t, 0x00000005}
     3172     * The last standard leaf to keep.  The actual last value that is stored in EAX
     3173     * is RT_MAX(CPUID[0].EAX,/CPUM/MaxStdLeaf).  Leaves beyond the max leaf are
     3174     * removed.  (This works independently of and differently from NT4LeafLimit.)
     3175     */
     3176    rc = CFGMR3QueryU32Def(pCpumCfg, "MaxStdLeaf", &pConfig->uMaxStdLeaf, UINT32_C(0x00000005));
     3177    AssertLogRelRCReturn(rc, rc);
     3178
     3179    /** @cfgm{/CPUM/MaxExtLeaf, uint32_t, 0x80000008}
     3180     * The last extended leaf to keep.  The actual last value that is stored in EAX
     3181     * is RT_MAX(CPUID[0x80000000].EAX,/CPUM/MaxStdLeaf).  Leaves beyond the max
     3182     * leaf are removed.
     3183     */
     3184    rc = CFGMR3QueryU32Def(pCpumCfg, "MaxExtLeaf", &pConfig->uMaxExtLeaf, UINT32_C(0x80000008));
     3185    AssertLogRelRCReturn(rc, rc);
     3186
     3187    /** @cfgm{/CPUM/MaxCentaurLeaf, uint32_t, 0xc0000004}
     3188     * The last extended leaf to keep.  The actual last value that is stored in EAX
     3189     * is RT_MAX(CPUID[0xc0000000].EAX,/CPUM/MaxCentaurLeaf).  Leaves beyond the max
     3190     * leaf are removed.
     3191     */
     3192    rc = CFGMR3QueryU32Def(pCpumCfg, "MaxCentaurLeaf", &pConfig->uMaxCentaurLeaf, UINT32_C(0xc0000004));
     3193    AssertLogRelRCReturn(rc, rc);
     3194
    31693195    return VINF_SUCCESS;
    31703196}
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