aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86/cpu-features.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-02-04 10:39:34 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-02-07 08:01:14 -0800
commit5ab25c88758810269607a066fcac399e29863510 (patch)
treefff85c2b2b481b413d71872bd5753f870557d89a /sysdeps/x86/cpu-features.c
parentc3479fb7939898ec22c655c383454d6e8b982a67 (diff)
downloadglibc-5ab25c88758810269607a066fcac399e29863510.tar
glibc-5ab25c88758810269607a066fcac399e29863510.tar.gz
glibc-5ab25c88758810269607a066fcac399e29863510.tar.bz2
glibc-5ab25c88758810269607a066fcac399e29863510.zip
x86: Add PTWRITE feature detection [BZ #27346]
1. Add CPUID_INDEX_14_ECX_0 for CPUID leaf 0x14 to detect PTWRITE feature in EBX of CPUID leaf 0x14 with ECX == 0. 2. Add PTWRITE detection to CPU feature tests. 3. Add 2 static CPU feature tests.
Diffstat (limited to 'sysdeps/x86/cpu-features.c')
-rw-r--r--sysdeps/x86/cpu-features.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index 7996ed0cd2..d7248cbb45 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -97,6 +97,7 @@ update_usable (struct cpu_features *cpu_features)
CPU_FEATURE_SET_USABLE (cpu_features, FZLRM);
CPU_FEATURE_SET_USABLE (cpu_features, FSRS);
CPU_FEATURE_SET_USABLE (cpu_features, FSRCS);
+ CPU_FEATURE_SET_USABLE (cpu_features, PTWRITE);
/* Can we call xgetbv? */
if (CPU_FEATURES_CPU_P (cpu_features, OSXSAVE))
@@ -359,6 +360,13 @@ get_common_indices (struct cpu_features *cpu_features,
cpu_features->features[CPUID_INDEX_D_ECX_1].cpuid.ecx,
cpu_features->features[CPUID_INDEX_D_ECX_1].cpuid.edx);
+ if (cpu_features->basic.max_cpuid >= 0x14)
+ __cpuid_count (0x14, 0,
+ cpu_features->features[CPUID_INDEX_14_ECX_0].cpuid.eax,
+ cpu_features->features[CPUID_INDEX_14_ECX_0].cpuid.ebx,
+ cpu_features->features[CPUID_INDEX_14_ECX_0].cpuid.ecx,
+ cpu_features->features[CPUID_INDEX_14_ECX_0].cpuid.edx);
+
if (cpu_features->basic.max_cpuid >= 0x19)
__cpuid_count (0x19, 0,
cpu_features->features[CPUID_INDEX_19].cpuid.eax,