1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-12-16 16:35:45 +00:00

Merge remote-tracking branch 'remotes/upstream/master'

Signed-off-by: Zhang, Guodong <gdzhang@linx-info.com>
This commit is contained in:
Zhang, Guodong 2015-04-18 09:17:53 +08:00
commit efe0f6fe03
10 changed files with 218 additions and 20 deletions

2
.gitignore vendored
View file

@ -25,3 +25,5 @@ depcomp
install-sh install-sh
libcpuid.pc libcpuid.pc
libcpuid/docs libcpuid/docs
ar-lib
compile

View file

@ -189,8 +189,14 @@ static void load_features_common(struct cpu_raw_data_t* raw, struct cpu_id_t* da
{ 19, CPU_FEATURE_SSE4_1 }, { 19, CPU_FEATURE_SSE4_1 },
{ 21, CPU_FEATURE_X2APIC }, { 21, CPU_FEATURE_X2APIC },
{ 23, CPU_FEATURE_POPCNT }, { 23, CPU_FEATURE_POPCNT },
{ 28, CPU_FEATURE_AVX },
{ 29, CPU_FEATURE_F16C }, { 29, CPU_FEATURE_F16C },
}; };
const struct feature_map_t matchtable_ebx7[] = {
{ 3, CPU_FEATURE_BMI1 },
{ 5, CPU_FEATURE_AVX2 },
{ 8, CPU_FEATURE_BMI2 },
};
const struct feature_map_t matchtable_edx81[] = { const struct feature_map_t matchtable_edx81[] = {
{ 11, CPU_FEATURE_SYSCALL }, { 11, CPU_FEATURE_SYSCALL },
{ 27, CPU_FEATURE_RDTSCP }, { 27, CPU_FEATURE_RDTSCP },
@ -206,6 +212,9 @@ static void load_features_common(struct cpu_raw_data_t* raw, struct cpu_id_t* da
match_features(matchtable_edx1, COUNT_OF(matchtable_edx1), raw->basic_cpuid[1][3], data); match_features(matchtable_edx1, COUNT_OF(matchtable_edx1), raw->basic_cpuid[1][3], data);
match_features(matchtable_ecx1, COUNT_OF(matchtable_ecx1), raw->basic_cpuid[1][2], data); match_features(matchtable_ecx1, COUNT_OF(matchtable_ecx1), raw->basic_cpuid[1][2], data);
} }
if (raw->basic_cpuid[0][0] >= 7) {
match_features(matchtable_ebx7, COUNT_OF(matchtable_ebx7), raw->basic_cpuid[7][1], data);
}
if (raw->ext_cpuid[0][0] >= 0x80000001) { if (raw->ext_cpuid[0][0] >= 0x80000001) {
match_features(matchtable_edx81, COUNT_OF(matchtable_edx81), raw->ext_cpuid[1][3], data); match_features(matchtable_edx81, COUNT_OF(matchtable_edx81), raw->ext_cpuid[1][3], data);
match_features(matchtable_ecx81, COUNT_OF(matchtable_ecx81), raw->ext_cpuid[1][2], data); match_features(matchtable_ecx81, COUNT_OF(matchtable_ecx81), raw->ext_cpuid[1][2], data);
@ -578,6 +587,8 @@ const char* cpu_feature_str(cpu_feature_t feature)
{ CPU_FEATURE_PFI, "pfi" }, { CPU_FEATURE_PFI, "pfi" },
{ CPU_FEATURE_PA, "pa" }, { CPU_FEATURE_PA, "pa" },
{ CPU_FEATURE_AVX2, "avx2" }, { CPU_FEATURE_AVX2, "avx2" },
{ CPU_FEATURE_BMI1, "bmi1" },
{ CPU_FEATURE_BMI2, "bmi2" },
}; };
unsigned i, n = COUNT_OF(matchtable); unsigned i, n = COUNT_OF(matchtable);
if (n != NUM_CPU_FEATURES) { if (n != NUM_CPU_FEATURES) {

View file

@ -355,6 +355,8 @@ typedef enum {
CPU_FEATURE_PFI, /*!< Processor Feedback Interface support */ CPU_FEATURE_PFI, /*!< Processor Feedback Interface support */
CPU_FEATURE_PA, /*!< Processor accumulator */ CPU_FEATURE_PA, /*!< Processor accumulator */
CPU_FEATURE_AVX2, /*!< AVX2 instructions */ CPU_FEATURE_AVX2, /*!< AVX2 instructions */
CPU_FEATURE_BMI1, /*!< BMI1 instructions */
CPU_FEATURE_BMI2, /*!< BMI2 instructions */
/* termination: */ /* termination: */
NUM_CPU_FEATURES, NUM_CPU_FEATURES,
} cpu_feature_t; } cpu_feature_t;

View file

@ -78,16 +78,16 @@ static int score(const struct match_entry_t* entry, const struct cpu_id_t* data,
int brand_code, int model_code) int brand_code, int model_code)
{ {
int res = 0; int res = 0;
if (entry->family == data->family ) res++; if (entry->family == data->family ) res += 2;
if (entry->model == data->model ) res++; if (entry->model == data->model ) res += 2;
if (entry->stepping == data->stepping ) res++; if (entry->stepping == data->stepping ) res += 2;
if (entry->ext_family == data->ext_family) res++; if (entry->ext_family == data->ext_family) res += 2;
if (entry->ext_model == data->ext_model ) res++; if (entry->ext_model == data->ext_model ) res += 2;
if (entry->ncores == data->num_cores ) res++; if (entry->ncores == data->num_cores ) res += 2;
if (entry->l2cache == data->l2_cache ) res++; if (entry->l2cache == data->l2_cache ) res += 1;
if (entry->l3cache == data->l3_cache ) res++; if (entry->l3cache == data->l3_cache ) res += 1;
if (entry->brand_code == brand_code ) res++; if (entry->brand_code == brand_code ) res += 2;
if (entry->model_code == model_code ) res++; if (entry->model_code == model_code ) res += 2;
return res; return res;
} }

View file

@ -309,6 +309,10 @@ const struct match_entry_t cpudb_intel[] = {
{ 6, 12, -1, -1, 60, 4, -1, -1, CORE_HASWELL7 , 0, "Haswell (Core i7)" }, { 6, 12, -1, -1, 60, 4, -1, -1, CORE_HASWELL7 , 0, "Haswell (Core i7)" },
{ 6, 12, -1, -1, 60, 4, -1, -1, CORE_HASWELL5 , 0, "Haswell (Core i5)" }, { 6, 12, -1, -1, 60, 4, -1, -1, CORE_HASWELL5 , 0, "Haswell (Core i5)" },
{ 6, 12, -1, -1, 60, 2, -1, -1, CORE_HASWELL3 , 0, "Haswell (Core i3)" }, { 6, 12, -1, -1, 60, 2, -1, -1, CORE_HASWELL3 , 0, "Haswell (Core i3)" },
/* These ones also exist as well: */
{ 6, 5, -1, -1, 69, 4, -1, -1, CORE_HASWELL7 , 0, "Haswell (Core i7)" },
{ 6, 5, -1, -1, 69, 4, -1, -1, CORE_HASWELL5 , 0, "Haswell (Core i5)" },
{ 6, 5, -1, -1, 69, 2, -1, -1, CORE_HASWELL3 , 0, "Haswell (Core i3)" },
/* Core microarchitecture-based Xeons: */ /* Core microarchitecture-based Xeons: */
@ -359,12 +363,8 @@ static void load_intel_features(struct cpu_raw_data_t* raw, struct cpu_id_t* dat
{ 25, CPU_FEATURE_AES }, { 25, CPU_FEATURE_AES },
{ 26, CPU_FEATURE_XSAVE }, { 26, CPU_FEATURE_XSAVE },
{ 27, CPU_FEATURE_OSXSAVE }, { 27, CPU_FEATURE_OSXSAVE },
{ 28, CPU_FEATURE_AVX },
{ 30, CPU_FEATURE_RDRAND }, { 30, CPU_FEATURE_RDRAND },
}; };
const struct feature_map_t matchtable_ebx7[] = {
{ 5, CPU_FEATURE_AVX2 },
};
const struct feature_map_t matchtable_edx81[] = { const struct feature_map_t matchtable_edx81[] = {
{ 20, CPU_FEATURE_XD }, { 20, CPU_FEATURE_XD },
}; };
@ -372,9 +372,6 @@ static void load_intel_features(struct cpu_raw_data_t* raw, struct cpu_id_t* dat
match_features(matchtable_edx1, COUNT_OF(matchtable_edx1), raw->basic_cpuid[1][3], data); match_features(matchtable_edx1, COUNT_OF(matchtable_edx1), raw->basic_cpuid[1][3], data);
match_features(matchtable_ecx1, COUNT_OF(matchtable_ecx1), raw->basic_cpuid[1][2], data); match_features(matchtable_ecx1, COUNT_OF(matchtable_ecx1), raw->basic_cpuid[1][2], data);
} }
if (raw->basic_cpuid[0][0] >= 7) {
match_features(matchtable_ebx7, COUNT_OF(matchtable_ebx7), raw->basic_cpuid[7][1], data);
}
if (raw->ext_cpuid[0][0] >= 1) { if (raw->ext_cpuid[0][0] >= 1) {
match_features(matchtable_edx81, COUNT_OF(matchtable_edx81), raw->ext_cpuid[1][3], data); match_features(matchtable_edx81, COUNT_OF(matchtable_edx81), raw->ext_cpuid[1][3], data);
} }

View file

@ -90,4 +90,4 @@ intel_fn11[3]=00000000 00000000 00000000 00000000
64 64
128 (authoritative) 128 (authoritative)
Bulldozer X4 Bulldozer X4
fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht pni monitor ssse3 cx16 sse4_1 syscall popcnt mmxext nx fxsr_opt rdtscp lm lahf_lm cmp_legacy svm abm misalignsse sse4a 3dnowprefetch osvw ibs skinit wdt ts ttp tm_amd 100mhzsteps hwpstate constant_tsc xop fma4 cpb fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht pni monitor ssse3 cx16 sse4_1 syscall popcnt avx mmxext nx fxsr_opt rdtscp lm lahf_lm cmp_legacy svm abm misalignsse sse4a 3dnowprefetch osvw ibs skinit wdt ts ttp tm_amd 100mhzsteps hwpstate constant_tsc xop fma4 cpb

View file

@ -90,4 +90,4 @@ intel_fn11[3]=00000000 00000000 00000000 00000000
64 64
128 (authoritative) 128 (authoritative)
Vishera X4 Vishera X4
fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht pni monitor ssse3 cx16 sse4_1 syscall popcnt mmxext nx fxsr_opt rdtscp lm lahf_lm cmp_legacy svm abm misalignsse sse4a 3dnowprefetch osvw ibs skinit wdt ts ttp tm_amd 100mhzsteps hwpstate constant_tsc xop fma3 fma4 f16c cpb aperfmperf fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht pni monitor ssse3 cx16 sse4_1 syscall popcnt avx mmxext nx fxsr_opt rdtscp lm lahf_lm cmp_legacy svm abm misalignsse sse4a 3dnowprefetch osvw ibs skinit wdt ts ttp tm_amd 100mhzsteps hwpstate constant_tsc xop fma3 fma4 f16c cpb aperfmperf bmi1

View file

@ -90,4 +90,4 @@ intel_fn11[3]=00000000 00000000 00000003 00000001
64 64
128 (non-authoritative) 128 (non-authoritative)
Haswell (Core i3) Haswell (Core i3)
fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni pclmul dts64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 syscall xd movbe popcnt aes xsave osxsave avx rdtscp lm lahf_lm constant_tsc fma3 f16c rdrand avx2 fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni pclmul dts64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 syscall xd movbe popcnt aes xsave osxsave avx rdtscp lm lahf_lm constant_tsc fma3 f16c rdrand avx2 bmi1 bmi2

View file

@ -0,0 +1,93 @@
basic_cpuid[0]=0000000d 756e6547 6c65746e 49656e69
basic_cpuid[1]=00040651 00100800 7ffafbbf bfebfbff
basic_cpuid[2]=76036301 00f0b5ff 00000000 00c10000
basic_cpuid[3]=00000000 00000000 00000000 00000000
basic_cpuid[4]=1c004121 01c0003f 0000003f 00000000
basic_cpuid[5]=00000040 00000040 00000003 11142120
basic_cpuid[6]=00000077 00000002 00000009 00000000
basic_cpuid[7]=00000000 000027ab 00000000 00000000
basic_cpuid[8]=00000000 00000000 00000000 00000000
basic_cpuid[9]=00000000 00000000 00000000 00000000
basic_cpuid[10]=07300403 00000000 00000000 00000603
basic_cpuid[11]=00000001 00000002 00000100 00000000
basic_cpuid[12]=00000000 00000000 00000000 00000000
basic_cpuid[13]=00000007 00000340 00000340 00000000
basic_cpuid[14]=00000007 00000340 00000340 00000000
basic_cpuid[15]=00000007 00000340 00000340 00000000
basic_cpuid[16]=00000007 00000340 00000340 00000000
basic_cpuid[17]=00000007 00000340 00000340 00000000
basic_cpuid[18]=00000007 00000340 00000340 00000000
basic_cpuid[19]=00000007 00000340 00000340 00000000
basic_cpuid[20]=00000007 00000340 00000340 00000000
basic_cpuid[21]=00000007 00000340 00000340 00000000
basic_cpuid[22]=00000007 00000340 00000340 00000000
basic_cpuid[23]=00000007 00000340 00000340 00000000
basic_cpuid[24]=00000007 00000340 00000340 00000000
basic_cpuid[25]=00000007 00000340 00000340 00000000
basic_cpuid[26]=00000007 00000340 00000340 00000000
basic_cpuid[27]=00000007 00000340 00000340 00000000
basic_cpuid[28]=00000007 00000340 00000340 00000000
basic_cpuid[29]=00000007 00000340 00000340 00000000
basic_cpuid[30]=00000007 00000340 00000340 00000000
basic_cpuid[31]=00000007 00000340 00000340 00000000
ext_cpuid[0]=80000008 00000000 00000000 00000000
ext_cpuid[1]=00000000 00000000 00000021 2c100800
ext_cpuid[2]=65746e49 2952286c 726f4320 4d542865
ext_cpuid[3]=35692029 3532342d 43205538 40205550
ext_cpuid[4]=342e3220 7a484730 00000000 00000000
ext_cpuid[5]=00000000 00000000 00000000 00000000
ext_cpuid[6]=00000000 00000000 01006040 00000000
ext_cpuid[7]=00000000 00000000 00000000 00000100
ext_cpuid[8]=00003027 00000000 00000000 00000000
ext_cpuid[9]=00000007 00000340 00000340 00000000
ext_cpuid[10]=00000007 00000340 00000340 00000000
ext_cpuid[11]=00000007 00000340 00000340 00000000
ext_cpuid[12]=00000007 00000340 00000340 00000000
ext_cpuid[13]=00000007 00000340 00000340 00000000
ext_cpuid[14]=00000007 00000340 00000340 00000000
ext_cpuid[15]=00000007 00000340 00000340 00000000
ext_cpuid[16]=00000007 00000340 00000340 00000000
ext_cpuid[17]=00000007 00000340 00000340 00000000
ext_cpuid[18]=00000007 00000340 00000340 00000000
ext_cpuid[19]=00000007 00000340 00000340 00000000
ext_cpuid[20]=00000007 00000340 00000340 00000000
ext_cpuid[21]=00000007 00000340 00000340 00000000
ext_cpuid[22]=00000007 00000340 00000340 00000000
ext_cpuid[23]=00000007 00000340 00000340 00000000
ext_cpuid[24]=00000007 00000340 00000340 00000000
ext_cpuid[25]=00000007 00000340 00000340 00000000
ext_cpuid[26]=00000007 00000340 00000340 00000000
ext_cpuid[27]=00000007 00000340 00000340 00000000
ext_cpuid[28]=00000007 00000340 00000340 00000000
ext_cpuid[29]=00000007 00000340 00000340 00000000
ext_cpuid[30]=00000007 00000340 00000340 00000000
ext_cpuid[31]=00000007 00000340 00000340 00000000
intel_fn4[0]=1c004121 01c0003f 0000003f 00000000
intel_fn4[1]=1c004122 01c0003f 0000003f 00000000
intel_fn4[2]=1c004143 01c0003f 000001ff 00000000
intel_fn4[3]=1c03c163 02c0003f 00000fff 00000006
intel_fn11[0]=00000001 00000002 00000100 00000000
intel_fn11[1]=00000004 00000004 00000201 00000000
intel_fn11[2]=00000000 00000000 00000002 00000000
intel_fn11[3]=00000000 00000000 00000003 00000000
--------------------------------------------------------------------------------
6
5
1
6
69
2
4
32
32
256
3072
8
8
12
64
64
64
128 (non-authoritative)
Haswell (Core i5)
fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni pclmul dts64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 syscall xd movbe popcnt aes xsave osxsave avx rdtscp lm lahf_lm constant_tsc fma3 f16c rdrand x2apic avx2 bmi1 bmi2

View file

@ -0,0 +1,93 @@
basic_cpuid[0]=0000000d 756e6547 6c65746e 49656e69
basic_cpuid[1]=000306c3 03100800 7fdafbbf bfebfbff
basic_cpuid[2]=76036301 00f0b5ff 00000000 00c10000
basic_cpuid[3]=00000000 00000000 00000000 00000000
basic_cpuid[4]=1c004121 01c0003f 0000003f 00000000
basic_cpuid[5]=00000040 00000040 00000003 00042120
basic_cpuid[6]=00000077 00000002 00000009 00000000
basic_cpuid[7]=00000000 000027ab 00000000 00000000
basic_cpuid[8]=00000000 00000000 00000000 00000000
basic_cpuid[9]=00000000 00000000 00000000 00000000
basic_cpuid[10]=07300403 00000000 00000000 00000603
basic_cpuid[11]=00000001 00000002 00000100 00000003
basic_cpuid[12]=00000000 00000000 00000000 00000000
basic_cpuid[13]=00000007 00000340 00000340 00000000
basic_cpuid[14]=00000007 00000340 00000340 00000000
basic_cpuid[15]=00000007 00000340 00000340 00000000
basic_cpuid[16]=00000007 00000340 00000340 00000000
basic_cpuid[17]=00000007 00000340 00000340 00000000
basic_cpuid[18]=00000007 00000340 00000340 00000000
basic_cpuid[19]=00000007 00000340 00000340 00000000
basic_cpuid[20]=00000007 00000340 00000340 00000000
basic_cpuid[21]=00000007 00000340 00000340 00000000
basic_cpuid[22]=00000007 00000340 00000340 00000000
basic_cpuid[23]=00000007 00000340 00000340 00000000
basic_cpuid[24]=00000007 00000340 00000340 00000000
basic_cpuid[25]=00000007 00000340 00000340 00000000
basic_cpuid[26]=00000007 00000340 00000340 00000000
basic_cpuid[27]=00000007 00000340 00000340 00000000
basic_cpuid[28]=00000007 00000340 00000340 00000000
basic_cpuid[29]=00000007 00000340 00000340 00000000
basic_cpuid[30]=00000007 00000340 00000340 00000000
basic_cpuid[31]=00000007 00000340 00000340 00000000
ext_cpuid[0]=80000008 00000000 00000000 00000000
ext_cpuid[1]=00000000 00000000 00000021 2c100000
ext_cpuid[2]=65746e49 2952286c 726f4320 4d542865
ext_cpuid[3]=37692029 3137342d 20514d30 20555043
ext_cpuid[4]=2e322040 48473035 0000007a 00000000
ext_cpuid[5]=00000000 00000000 00000000 00000000
ext_cpuid[6]=00000000 00000000 01006040 00000000
ext_cpuid[7]=00000000 00000000 00000000 00000100
ext_cpuid[8]=00003027 00000000 00000000 00000000
ext_cpuid[9]=00000007 00000340 00000340 00000000
ext_cpuid[10]=00000007 00000340 00000340 00000000
ext_cpuid[11]=00000007 00000340 00000340 00000000
ext_cpuid[12]=00000007 00000340 00000340 00000000
ext_cpuid[13]=00000007 00000340 00000340 00000000
ext_cpuid[14]=00000007 00000340 00000340 00000000
ext_cpuid[15]=00000007 00000340 00000340 00000000
ext_cpuid[16]=00000007 00000340 00000340 00000000
ext_cpuid[17]=00000007 00000340 00000340 00000000
ext_cpuid[18]=00000007 00000340 00000340 00000000
ext_cpuid[19]=00000007 00000340 00000340 00000000
ext_cpuid[20]=00000007 00000340 00000340 00000000
ext_cpuid[21]=00000007 00000340 00000340 00000000
ext_cpuid[22]=00000007 00000340 00000340 00000000
ext_cpuid[23]=00000007 00000340 00000340 00000000
ext_cpuid[24]=00000007 00000340 00000340 00000000
ext_cpuid[25]=00000007 00000340 00000340 00000000
ext_cpuid[26]=00000007 00000340 00000340 00000000
ext_cpuid[27]=00000007 00000340 00000340 00000000
ext_cpuid[28]=00000007 00000340 00000340 00000000
ext_cpuid[29]=00000007 00000340 00000340 00000000
ext_cpuid[30]=00000007 00000340 00000340 00000000
ext_cpuid[31]=00000007 00000340 00000340 00000000
intel_fn4[0]=1c004121 01c0003f 0000003f 00000000
intel_fn4[1]=1c004122 01c0003f 0000003f 00000000
intel_fn4[2]=1c004143 01c0003f 000001ff 00000000
intel_fn4[3]=1c03c163 02c0003f 00001fff 00000006
intel_fn11[0]=00000001 00000002 00000100 00000003
intel_fn11[1]=00000004 00000008 00000201 00000003
intel_fn11[2]=00000000 00000000 00000002 00000003
intel_fn11[3]=00000000 00000000 00000003 00000003
--------------------------------------------------------------------------------
6
12
3
6
60
4
8
32
32
256
6144
8
8
12
64
64
64
128 (non-authoritative)
Haswell (Core i7)
fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni pclmul dts64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 xd movbe popcnt aes xsave osxsave avx rdtscp lm lahf_lm constant_tsc fma3 f16c rdrand avx2 bmi1 bmi2