diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-07-29 06:08:59 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-07-29 06:28:50 -0700 |
commit | c9570bd2f54abb68e4e3c767aca3a54e05d2c7f6 (patch) | |
tree | 2284f956298a2cf04a6bcdef69bebaadd0cfe4dd | |
parent | 86e0996b1a02b3b46185f5fd28b78f0223956008 (diff) | |
download | glibc-c9570bd2f54abb68e4e3c767aca3a54e05d2c7f6.tar.gz glibc-c9570bd2f54abb68e4e3c767aca3a54e05d2c7f6.tar.xz glibc-c9570bd2f54abb68e4e3c767aca3a54e05d2c7f6.zip |
x86: Populate COMMON_CPUID_INDEX_80000001 for Intel CPUs [BZ #23459]
Reviewed-by: Carlos O'Donell <carlos@redhat.com> [BZ #23459] * sysdeps/x86/cpu-features.c (get_extended_indices): New function. (init_cpu_features): Call get_extended_indices for both Intel and AMD CPUs. * sysdeps/x86/cpu-features.h (COMMON_CPUID_INDEX_80000001): Remove "for AMD" comment. (cherry picked from commit be525a69a6630abc83144c0a96474f2e26da7443)
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | sysdeps/x86/cpu-features.c | 27 | ||||
-rw-r--r-- | sysdeps/x86/cpu-features.h | 2 |
4 files changed, 30 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog index 831579524d..7e22bd1dfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2018-07-29 H.J. Lu <hongjiu.lu@intel.com> + [BZ #23459] + * sysdeps/x86/cpu-features.c (get_extended_indices): New + function. + (init_cpu_features): Call get_extended_indices for both Intel + and AMD CPUs. + * sysdeps/x86/cpu-features.h (COMMON_CPUID_INDEX_80000001): + Remove "for AMD" comment. + +2018-07-29 H.J. Lu <hongjiu.lu@intel.com> + [BZ #23456] * sysdeps/x86/cpu-features.h (index_cpu_LZCNT): Set to COMMON_CPUID_INDEX_80000001. diff --git a/NEWS b/NEWS index e0c11b1ea9..61ac02cd69 100644 --- a/NEWS +++ b/NEWS @@ -148,6 +148,7 @@ The following bugs are resolved with this release: [23349] Various glibc headers no longer compatible with <linux/time.h> [23363] stdio-common/tst-printf.c has non-free license [23456] Wrong index_cpu_LZCNT + [23459] COMMON_CPUID_INDEX_80000001 isn't populated for Intel processors Version 2.26 diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index 87aaa8683c..a66d468b20 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -31,6 +31,20 @@ extern void TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *) #endif static void +get_extended_indices (struct cpu_features *cpu_features) +{ + unsigned int eax, ebx, ecx, edx; + __cpuid (0x80000000, eax, ebx, ecx, edx); + if (eax >= 0x80000001) + __cpuid (0x80000001, + cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].eax, + cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].ebx, + cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].ecx, + cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].edx); + +} + +static void get_common_indeces (struct cpu_features *cpu_features, unsigned int *family, unsigned int *model, unsigned int *extended_model, unsigned int *stepping) @@ -205,6 +219,8 @@ init_cpu_features (struct cpu_features *cpu_features) get_common_indeces (cpu_features, &family, &model, &extended_model, &stepping); + get_extended_indices (cpu_features); + if (family == 0x06) { model += extended_model; @@ -324,16 +340,9 @@ init_cpu_features (struct cpu_features *cpu_features) get_common_indeces (cpu_features, &family, &model, &extended_model, &stepping); - ecx = cpu_features->cpuid[COMMON_CPUID_INDEX_1].ecx; + get_extended_indices (cpu_features); - unsigned int eax; - __cpuid (0x80000000, eax, ebx, ecx, edx); - if (eax >= 0x80000001) - __cpuid (0x80000001, - cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].eax, - cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].ebx, - cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].ecx, - cpu_features->cpuid[COMMON_CPUID_INDEX_80000001].edx); + ecx = cpu_features->cpuid[COMMON_CPUID_INDEX_1].ecx; if (HAS_ARCH_FEATURE (AVX_Usable)) { diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h index a6fae06014..e4eb6bf41a 100644 --- a/sysdeps/x86/cpu-features.h +++ b/sysdeps/x86/cpu-features.h @@ -196,7 +196,7 @@ enum { COMMON_CPUID_INDEX_1 = 0, COMMON_CPUID_INDEX_7, - COMMON_CPUID_INDEX_80000001, /* for AMD */ + COMMON_CPUID_INDEX_80000001, /* Keep the following line at the end. */ COMMON_CPUID_INDEX_MAX }; |