Commit ca0f2413 authored by Berenger Bramas's avatar Berenger Bramas

Update CMake -- ensure to check new capacities only if possible, and disable...

Update CMake -- ensure to check new capacities only if possible, and disable type if capacities are not detected
parent 9891e74b
...@@ -92,9 +92,10 @@ foreach(TYPE ${ALL_TYPES}) ...@@ -92,9 +92,10 @@ foreach(TYPE ${ALL_TYPES})
set(${TYPE}_SUPPORTED_BY_CPU TRUE) set(${TYPE}_SUPPORTED_BY_CPU TRUE)
foreach(RULE ${${TYPE}_CPU_RULES}) foreach(RULE ${${TYPE}_CPU_RULES})
if(NOT DEFINED CPU_INFO_${RULE}) if(NOT DEFINED CPU_INFO_${RULE})
MESSAGE(WARNING "Main -- The variable CPU_INFO_${RULE} is not defined but used as rule for ${TYPE}") MESSAGE(WARNING "Main -- The variable CPU_INFO_${RULE} cannot be read from the current CPU which might be too old. It turns off ${TYPE}.")
endif() set(${TYPE}_SUPPORTED_BY_CPU FALSE)
if(NOT ${CPU_INFO_${RULE}}) break()
elseif(NOT ${CPU_INFO_${RULE}})
set(${TYPE}_SUPPORTED_BY_CPU FALSE) set(${TYPE}_SUPPORTED_BY_CPU FALSE)
break() break()
endif() endif()
......
...@@ -63,7 +63,7 @@ enum RegistersNum { ...@@ -63,7 +63,7 @@ enum RegistersNum {
// GCC Inline Assembly but with the same prototype as windows // GCC Inline Assembly but with the same prototype as windows
void cpuid(unsigned int CPUInfo[4],int InfoTypeEax, int InfoTypeEcx){ void cpuid(unsigned int CPUInfo[4],unsigned int InfoTypeEax, unsigned int InfoTypeEcx){
__asm__ __volatile__ ( __asm__ __volatile__ (
"cpuid": // Execute this instruction "cpuid": // Execute this instruction
"=a" (CPUInfo[EaxRegister]), // Store eax in 0 "=a" (CPUInfo[EaxRegister]), // Store eax in 0
...@@ -128,15 +128,15 @@ std::list<CpuProperty> getProperties(){ ...@@ -128,15 +128,15 @@ std::list<CpuProperty> getProperties(){
// Basic CPUID Information // Basic CPUID Information
cpuid(info, 0, 0); cpuid(info, 0, 0);
// The largest CPUID standard-function input value supported by the processor implementation. // The largest CPUID standard-function input value supported by the processor implementation.
const int limitStandardFunction = info[EaxRegister]; const unsigned int limitStandardFunction = info[EaxRegister];
// Extended Function CPUID Information // Extended Function CPUID Information
cpuid(info, 0x80000000U, 0); cpuid(info, 0x80000000U, 0);
// The largest CPUID extended-function input value supported by the processor implementation // The largest CPUID extended-function input value supported by the processor implementation
unsigned int limitExtendedFunction = info[EaxRegister]; const unsigned int limitExtendedFunction = info[EaxRegister];
// Detect Instruction Set // Detect Instruction Set
if (limitStandardFunction >= 1){ if (limitStandardFunction >= 0x1U){
cpuid(info,0x00000001U, 0); // Basic CPUID Information cpuid(info,0x00000001U, 0); // Basic CPUID Information
/* /*
0x00000001 - EDX : 0x00000001 - EDX :
...@@ -244,7 +244,7 @@ std::list<CpuProperty> getProperties(){ ...@@ -244,7 +244,7 @@ std::list<CpuProperty> getProperties(){
properties.push_back(CpuProperty("FMA3", CPUInfoGetECX(info, 12))); properties.push_back(CpuProperty("FMA3", CPUInfoGetECX(info, 12)));
} }
if (limitExtendedFunction >= 0x80000001U){ if (limitExtendedFunction >= 0x80000004U){
cpuid(info,0x80000001U, 0); // Extended Function CPUID Information cpuid(info,0x80000001U, 0); // Extended Function CPUID Information
/* /*
0x80000001 - EDX : 0x80000001 - EDX :
...@@ -309,7 +309,7 @@ std::list<CpuProperty> getProperties(){ ...@@ -309,7 +309,7 @@ std::list<CpuProperty> getProperties(){
properties.push_back(CpuProperty("XOP", CPUInfoGetECX(info, 11))); properties.push_back(CpuProperty("XOP", CPUInfoGetECX(info, 11)));
} }
if (limitExtendedFunction >= 0x00000007U){ if (/*limitExtendedFunction >= 0x80000008U*/ limitStandardFunction > 0x6U){
cpuid(info,0x00000007U, 0); // Extended Function CPUID Information cpuid(info,0x00000007U, 0); // Extended Function CPUID Information
/* /*
0x00000007 - EBX 0x00000007 - EBX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment