VirtualBox

Changeset 14565 in vbox for trunk


Ignore:
Timestamp:
Nov 25, 2008 11:34:42 AM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: IHost::GetProcessorFeature reused in VBoxVMSettingsGeneral.cpp.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsGeneral.cpp

    r14540 r14565  
    199199    mCbApic->setChecked (biosSettings.GetIOAPICEnabled());
    200200
    201     /*
    202      * Check for VT-x and AMD-V capabilities.
    203      * This is a best effort check. A full check requires ring-0 access (msrs).
    204      */
    205     bool fVTxAMDVSupported = false;
    206     bool fPAESupported = false;
    207 
    208     if (ASMHasCpuId())
    209     {
    210         uint32_t u32FeaturesECX;
    211         uint32_t u32Dummy;
    212         uint32_t u32FeaturesEDX;
    213         uint32_t u32VendorEBX, u32VendorECX, u32VendorEDX, u32AMDFeatureEDX, u32AMDFeatureECX;
    214 
    215         ASMCpuId (0, &u32Dummy, &u32VendorEBX, &u32VendorECX, &u32VendorEDX);
    216         ASMCpuId (1, &u32Dummy, &u32Dummy, &u32FeaturesECX, &u32FeaturesEDX);
    217         /* Query AMD features. */
    218         ASMCpuId (0x80000001, &u32Dummy, &u32Dummy, &u32AMDFeatureECX, &u32AMDFeatureEDX);
    219 
    220         fPAESupported = !!(u32FeaturesEDX & X86_CPUID_FEATURE_EDX_PAE);
    221 
    222         if (    u32VendorEBX == X86_CPUID_VENDOR_INTEL_EBX
    223             &&  u32VendorECX == X86_CPUID_VENDOR_INTEL_ECX
    224             &&  u32VendorEDX == X86_CPUID_VENDOR_INTEL_EDX
    225            )
    226         {
    227             if (    (u32FeaturesECX & X86_CPUID_FEATURE_ECX_VMX)
    228                  && (u32FeaturesEDX & X86_CPUID_FEATURE_EDX_MSR)
    229                  && (u32FeaturesEDX & X86_CPUID_FEATURE_EDX_FXSR)
    230                )
    231                 fVTxAMDVSupported = true;
    232         }
    233         else
    234         if (    u32VendorEBX == X86_CPUID_VENDOR_AMD_EBX
    235             &&  u32VendorECX == X86_CPUID_VENDOR_AMD_ECX
    236             &&  u32VendorEDX == X86_CPUID_VENDOR_AMD_EDX
    237            )
    238         {
    239             if (   (u32AMDFeatureECX & X86_CPUID_AMD_FEATURE_ECX_SVM)
    240                 && (u32FeaturesEDX & X86_CPUID_FEATURE_EDX_MSR)
    241                 && (u32FeaturesEDX & X86_CPUID_FEATURE_EDX_FXSR)
    242                )
    243                 fVTxAMDVSupported = true;
    244         }
    245     }
     201    /* VT-x/AMD-V */
     202    bool fVTxAMDVSupported = vboxGlobal().virtualBox().GetHost()
     203                             .GetProcessorFeature (KProcessorFeature_HWVirtEx);
    246204#ifdef Q_WS_MAC
    247205    /* Not currently available on the Mac. */
     
    249207#endif
    250208    mCbVirt->setEnabled (fVTxAMDVSupported);
    251 
    252     /* VT-x/AMD-V */
    253209    aMachine.GetHWVirtExEnabled() == KTSBool_True ?
    254210        mCbVirt->setCheckState (Qt::Checked) :
     
    256212
    257213    /* PAE/NX */
     214    bool fPAESupported = vboxGlobal().virtualBox().GetHost()
     215                         .GetProcessorFeature (KProcessorFeature_PAE);
    258216    mCbPae->setEnabled (fPAESupported);
    259217    mCbPae->setChecked (aMachine.GetPAEEnabled());
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