VirtualBox

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


Ignore:
Timestamp:
Jan 29, 2019 2:28:03 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128467
Message:

VMM/CPUM: bugref:9375 Check for existence of leafs before exploding SVM features.

File:
1 edited

Legend:

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

    r76886 r77032  
    37113711    cpumR3CpuIdZeroLeaf(pCpum, UINT32_C(0x80000009));
    37123712
    3713     /* Cpuid 0x8000000a: SVM Information
    3714      * AMD: EAX - SVM revision.
    3715      *      EBX - Number of ASIDs.
    3716      *      ECX - Reserved.
    3717      *      EDX - SVM Feature identification.
     3713    /* Cpuid 0x8000000a: SVM information on AMD, invalid on Intel.
     3714     * AMD:   EAX - SVM revision.
     3715     *        EBX - Number of ASIDs.
     3716     *        ECX - Reserved.
     3717     *        EDX - SVM Feature identification.
    37183718     */
    37193719    pExtFeatureLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x80000001), 0);
    3720     if (pExtFeatureLeaf->uEcx & X86_CPUID_AMD_FEATURE_ECX_SVM)
     3720    if (   pExtFeatureLeaf
     3721        && (pExtFeatureLeaf->uEcx & X86_CPUID_AMD_FEATURE_ECX_SVM)
     3722        && pCpum->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
    37213723    {
    37223724        PCPUMCPUIDLEAF pSvmFeatureLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 0x8000000a, 0);
    3723         pSvmFeatureLeaf->uEax  = 0x1;
    3724         pSvmFeatureLeaf->uEbx  = 0x8000;                                        /** @todo figure out virtual NASID. */
    3725         pSvmFeatureLeaf->uEcx  = 0;
    3726         pSvmFeatureLeaf->uEdx &= (  X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE         /** @todo Support other SVM features */
    3727                                   | X86_CPUID_SVM_FEATURE_EDX_FLUSH_BY_ASID
    3728                                   | X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSISTS);
    3729     }
    3730     else
    3731         cpumR3CpuIdZeroLeaf(pCpum, UINT32_C(0x8000000a));
     3725        if (pSvmFeatureLeaf)
     3726        {
     3727            pSvmFeatureLeaf->uEax  = 0x1;
     3728            pSvmFeatureLeaf->uEbx  = 0x8000;                                        /** @todo figure out virtual NASID. */
     3729            pSvmFeatureLeaf->uEcx  = 0;
     3730            pSvmFeatureLeaf->uEdx &= (  X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE         /** @todo Support other SVM features */
     3731                                      | X86_CPUID_SVM_FEATURE_EDX_FLUSH_BY_ASID
     3732                                      | X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSISTS);
     3733        }
     3734        else
     3735        {
     3736            LogRel(("CPUM: Warning! Expected CPUID leaf 0x8000000a not present! SVM features not exposed to the guest\n"));
     3737            cpumR3CpuIdZeroLeaf(pCpum, UINT32_C(0x8000000a));
     3738        }
     3739    }
    37323740
    37333741    /* Cpuid 0x8000000b thru 0x80000018: Reserved
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