diff options
Diffstat (limited to 'sysdeps/x86')
-rw-r--r-- | sysdeps/x86/Makefile | 7 | ||||
-rw-r--r-- | sysdeps/x86/bits/platform/x86.h | 11 | ||||
-rw-r--r-- | sysdeps/x86/cpu-features.c | 8 | ||||
-rw-r--r-- | sysdeps/x86/include/cpu-features.h | 17 | ||||
-rw-r--r-- | sysdeps/x86/tst-cpu-features-cpuinfo-static.c | 1 | ||||
-rw-r--r-- | sysdeps/x86/tst-cpu-features-cpuinfo.c | 1 | ||||
-rw-r--r-- | sysdeps/x86/tst-cpu-features-supports-static.c | 1 | ||||
-rw-r--r-- | sysdeps/x86/tst-cpu-features-supports.c | 1 | ||||
-rw-r--r-- | sysdeps/x86/tst-get-cpu-features.c | 2 |
9 files changed, 44 insertions, 5 deletions
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index dd82674342..e1f9379fd8 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -8,8 +8,11 @@ sysdep-dl-routines += dl-get-cpu-features sysdep_headers += sys/platform/x86.h tests += tst-get-cpu-features tst-get-cpu-features-static \ - tst-cpu-features-cpuinfo tst-cpu-features-supports -tests-static += tst-get-cpu-features-static + tst-cpu-features-cpuinfo tst-cpu-features-cpuinfo-static \ + tst-cpu-features-supports tst-cpu-features-supports-static +tests-static += tst-get-cpu-features-static \ + tst-cpu-features-cpuinfo-static \ + tst-cpu-features-supports-static ifeq (yes,$(have-ifunc)) tests += \ tst-ifunc-isa-1 \ diff --git a/sysdeps/x86/bits/platform/x86.h b/sysdeps/x86/bits/platform/x86.h index 8f423ae721..c4850fc3cb 100644 --- a/sysdeps/x86/bits/platform/x86.h +++ b/sysdeps/x86/bits/platform/x86.h @@ -29,7 +29,8 @@ enum CPUID_INDEX_80000007, CPUID_INDEX_80000008, CPUID_INDEX_7_ECX_1, - CPUID_INDEX_19 + CPUID_INDEX_19, + CPUID_INDEX_14_ECX_0 }; struct cpuid_feature @@ -295,5 +296,11 @@ enum + cpuid_register_index_ebx * 8 * sizeof (unsigned int)), x86_cpu_AESKLE = x86_cpu_index_19_ebx, - x86_cpu_WIDE_KL = x86_cpu_index_19_ebx + 2 + x86_cpu_WIDE_KL = x86_cpu_index_19_ebx + 2, + + x86_cpu_index_14_ecx_0_ebx + = (CPUID_INDEX_14_ECX_0 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_ebx * 8 * sizeof (unsigned int)), + + x86_cpu_PTWRITE = x86_cpu_index_14_ecx_0_ebx + 4 }; 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, diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h index 475e877294..dabe6b9d86 100644 --- a/sysdeps/x86/include/cpu-features.h +++ b/sysdeps/x86/include/cpu-features.h @@ -29,7 +29,7 @@ enum { - CPUID_INDEX_MAX = CPUID_INDEX_19 + 1 + CPUID_INDEX_MAX = CPUID_INDEX_14_ECX_0 + 1 }; enum @@ -307,6 +307,11 @@ enum #define bit_cpu_AESKLE (1u << 0) #define bit_cpu_WIDE_KL (1u << 2) +/* CPUID_INDEX_14_ECX_0. */ + +/* EBX. */ +#define bit_cpu_PTWRITE (1u << 4) + /* CPUID_INDEX_1. */ /* ECX. */ @@ -532,6 +537,11 @@ enum #define index_cpu_AESKLE CPUID_INDEX_19 #define index_cpu_WIDE_KL CPUID_INDEX_19 +/* CPUID_INDEX_14_ECX_0. */ + +/* EBX. */ +#define index_cpu_PTWRITE CPUID_INDEX_14_ECX_0 + /* CPUID_INDEX_1. */ /* ECX. */ @@ -757,6 +767,11 @@ enum #define reg_AESKLE ebx #define reg_WIDE_KL ebx +/* CPUID_INDEX_14_ECX_0. */ + +/* EBX. */ +#define reg_PTWRITE ebx + /* PREFERRED_FEATURE_INDEX_1. */ #define bit_arch_I586 (1u << 0) #define bit_arch_I686 (1u << 1) diff --git a/sysdeps/x86/tst-cpu-features-cpuinfo-static.c b/sysdeps/x86/tst-cpu-features-cpuinfo-static.c new file mode 100644 index 0000000000..993a1a95f7 --- /dev/null +++ b/sysdeps/x86/tst-cpu-features-cpuinfo-static.c @@ -0,0 +1 @@ +#include "tst-cpu-features-cpuinfo.c" diff --git a/sysdeps/x86/tst-cpu-features-cpuinfo.c b/sysdeps/x86/tst-cpu-features-cpuinfo.c index 3c2fa7d9b6..75e7eb9352 100644 --- a/sysdeps/x86/tst-cpu-features-cpuinfo.c +++ b/sysdeps/x86/tst-cpu-features-cpuinfo.c @@ -199,6 +199,7 @@ do_test (int argc, char **argv) fails += CHECK_PROC (popcnt, POPCNT); fails += CHECK_PROC (3dnowprefetch, PREFETCHW); fails += CHECK_PROC (prefetchwt1, PREFETCHWT1); + fails += CHECK_PROC (ptwrite, PTWRITE); fails += CHECK_PROC (pse, PSE); fails += CHECK_PROC (pse36, PSE_36); fails += CHECK_PROC (psn, PSN); diff --git a/sysdeps/x86/tst-cpu-features-supports-static.c b/sysdeps/x86/tst-cpu-features-supports-static.c new file mode 100644 index 0000000000..38f4046bb8 --- /dev/null +++ b/sysdeps/x86/tst-cpu-features-supports-static.c @@ -0,0 +1 @@ +#include "tst-cpu-features-supports.c" diff --git a/sysdeps/x86/tst-cpu-features-supports.c b/sysdeps/x86/tst-cpu-features-supports.c index 79d803eb29..ce78a7d8bc 100644 --- a/sysdeps/x86/tst-cpu-features-supports.c +++ b/sysdeps/x86/tst-cpu-features-supports.c @@ -149,6 +149,7 @@ do_test (int argc, char **argv) fails += CHECK_SUPPORTS (popcnt, POPCNT); #if __GNUC_PREREQ (11, 0) fails += CHECK_SUPPORTS (prefetchwt1, PREFETCHWT1); + fails += CHECK_SUPPORTS (ptwrite, PTWRITE); fails += CHECK_SUPPORTS (rdpid, RDPID); fails += CHECK_SUPPORTS (rdrnd, RDRAND); fails += CHECK_SUPPORTS (rdseed, RDSEED); diff --git a/sysdeps/x86/tst-get-cpu-features.c b/sysdeps/x86/tst-get-cpu-features.c index b5e7f6e7b0..583e1e6d49 100644 --- a/sysdeps/x86/tst-get-cpu-features.c +++ b/sysdeps/x86/tst-get-cpu-features.c @@ -203,6 +203,7 @@ do_test (void) CHECK_CPU_FEATURE (LAM); CHECK_CPU_FEATURE (AESKLE); CHECK_CPU_FEATURE (WIDE_KL); + CHECK_CPU_FEATURE (PTWRITE); printf ("Usable CPU features:\n"); CHECK_CPU_FEATURE_USABLE (SSE3); @@ -364,6 +365,7 @@ do_test (void) CHECK_CPU_FEATURE_USABLE (FSRCS); CHECK_CPU_FEATURE_USABLE (AESKLE); CHECK_CPU_FEATURE_USABLE (WIDE_KL); + CHECK_CPU_FEATURE_USABLE (PTWRITE); return 0; } |