From 45651ef7bca760ab818515b2d1556cd79aab42ea Mon Sep 17 00:00:00 2001 From: Veselin Georgiev Date: Sun, 22 Jun 2014 21:00:18 +0300 Subject: [PATCH] Merge 141243f from http://github.com/eloaders/libcpuid This adds support for x2apic detection. This is not a direct merge, since - the feature is spelled as 'x2apic' instead of 'x2APIC', for consistency with other flags; - tests are added - the id of the feature is moved to the end of the cpu_feature_t enum, for binary compatibility. --- libcpuid/cpuid_main.c | 2 ++ libcpuid/libcpuid.h | 1 + tests/tests_stash.txt | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libcpuid/cpuid_main.c b/libcpuid/cpuid_main.c index 7ace74b..3f6bdb5 100644 --- a/libcpuid/cpuid_main.c +++ b/libcpuid/cpuid_main.c @@ -172,6 +172,7 @@ static void load_features_common(struct cpu_raw_data_t* raw, struct cpu_id_t* da { 9, CPU_FEATURE_SSSE3 }, { 13, CPU_FEATURE_CX16 }, { 19, CPU_FEATURE_SSE4_1 }, + { 21, CPU_FEATURE_X2APIC }, { 23, CPU_FEATURE_POPCNT }, { 29, CPU_FEATURE_F16C }, }; @@ -505,6 +506,7 @@ const char* cpu_feature_str(cpu_feature_t feature) { CPU_FEATURE_SSE4_2, "sse4_2" }, { CPU_FEATURE_SYSCALL, "syscall" }, { CPU_FEATURE_XD, "xd" }, + { CPU_FEATURE_X2APIC , "x2apic"}, { CPU_FEATURE_MOVBE, "movbe" }, { CPU_FEATURE_POPCNT, "popcnt" }, { CPU_FEATURE_AES, "aes" }, diff --git a/libcpuid/libcpuid.h b/libcpuid/libcpuid.h index c42406d..4075768 100644 --- a/libcpuid/libcpuid.h +++ b/libcpuid/libcpuid.h @@ -349,6 +349,7 @@ typedef enum { CPU_FEATURE_TBM, /*!< Trailing bit manipulation instruction support */ CPU_FEATURE_F16C, /*!< 16-bit FP convert instruction support */ CPU_FEATURE_RDRAND, /*!< RdRand instruction */ + CPU_FEATURE_X2APIC, /*!< x2APIC, APIC_BASE.EXTD, MSRs 0000_0800h...0000_0BFFh 64-bit ICR (+030h but not +031h), no DFR (+00Eh), SELF_IPI (+040h) also see standard level 0000_000Bh */ /* termination: */ NUM_CPU_FEATURES, } cpu_feature_t; diff --git a/tests/tests_stash.txt b/tests/tests_stash.txt index 94b6e18..5fb3a6a 100644 --- a/tests/tests_stash.txt +++ b/tests/tests_stash.txt @@ -5410,7 +5410,7 @@ intel_fn11[3]=00000000 00000000 00000003 00000000 64 128 (non-authoritative) Xeon (Sandy Bridge) -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 smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 xd popcnt aes xsave osxsave avx lm lahf_lm +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 smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 xd popcnt aes xsave osxsave avx lm lahf_lm x2apic -------------------------------------------------------------------------------- basic_cpuid[0]=0000000d 756e6547 6c65746e 49656e69 basic_cpuid[1]=000206d7 00200800 1fbee3bf bfebfbff @@ -5504,7 +5504,7 @@ intel_fn11[3]=00000000 00000000 00000003 00000000 64 128 (non-authoritative) Sandy Bridge-E (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 dca sse4_1 sse4_2 popcnt aes xsave osxsave avx lm lahf_lm +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 dca sse4_1 sse4_2 popcnt aes xsave osxsave avx lm lahf_lm x2apic -------------------------------------------------------------------------------- basic_cpuid[0]=0000000d 756e6547 6c65746e 49656e69 basic_cpuid[1]=000306a9 00100800 7f9ae3bf bfebfbff