VirtualBox

Changeset 50038 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jan 9, 2014 3:14:58 PM (11 years ago)
Author:
vboxsync
Message:

CPUM: Don't use stale pStdFeatureLeaf and pExtFeatureLeaf pointers. Inserting and removing cpuid entires makes them go stale.

File:
1 edited

Legend:

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

    r49977 r50038  
    11691169
    11701170
    1171     PCPUMCPUIDLEAF pStdLeaf0 = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 0, 0);
    1172     AssertLogRelReturn(pStdLeaf0, VERR_CPUM_IPE_2);
    1173 
    1174 
    11751171    /* Cpuid 1:
    11761172     * Only report features we can support.
     
    11791175     *       options may require adjusting (i.e. stripping what was enabled).
    11801176     */
    1181     PCPUMCPUIDLEAF pStdFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 1, 0);
     1177    PCPUMCPUIDLEAF pStdFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves,
     1178                                                        1, 0); /* Note! Must refetch when used later. */
    11821179    AssertLogRelReturn(pStdFeatureLeaf, VERR_CPUM_IPE_2);
    11831180    pStdFeatureLeaf->uEdx        &= X86_CPUID_FEATURE_EDX_FPU
     
    12801277     */
    12811278    PCPUMCPUIDLEAF pExtFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves,
    1282                                                         UINT32_C(0x80000001), 0);
     1279                                                        UINT32_C(0x80000001), 0); /* Note! Must refetch when used later. */
    12831280    if (pExtFeatureLeaf)
    12841281    {
     
    14031400     */
    14041401    pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 3, 0);
     1402    pStdFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 1, 0);
    14051403    if (   !(pStdFeatureLeaf->uEdx & X86_CPUID_FEATURE_EDX_PSN)
    14061404        && pCurLeaf)
     
    14591457    if (pCurLeaf)
    14601458    {
     1459        pStdFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 1, 0);
    14611460        if (!(pStdFeatureLeaf->uEcx & X86_CPUID_FEATURE_ECX_MONITOR))
    14621461            pCurLeaf->uEax = pCurLeaf->uEbx = 0;
     
    15581557            /* Legacy method to determine the number of cores. */
    15591558            pCurLeaf->uEcx |= (pVM->cCpus - 1); /* NC: Number of CPU cores - 1; 8 bits */
     1559            pExtFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves,
     1560                                                 UINT32_C(0x80000001), 0);
    15601561            if (pExtFeatureLeaf)
    15611562                pExtFeatureLeaf->uEcx |= X86_CPUID_AMD_FEATURE_ECX_CMPL;
     
    16581659    if (pCPUM->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_INTEL)
    16591660    {
     1661        pStdFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 1, 0);
    16601662        uint32_t uCurIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(ASMGetCpuStepping(pStdFeatureLeaf->uEax),
    16611663                                                                ASMGetCpuModelIntel(pStdFeatureLeaf->uEax),
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