@item
@code{PSN} -- Processor Serial Number.
+@item
+@code{PTWRITE} -- PTWRITE instruction.
+
@item
@code{RDPID} -- RDPID instruction.
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 \
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
+ 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
};
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))
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,
enum
{
- CPUID_INDEX_MAX = CPUID_INDEX_19 + 1
+ CPUID_INDEX_MAX = CPUID_INDEX_14_ECX_0 + 1
};
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. */
#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. */
#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)
--- /dev/null
+#include "tst-cpu-features-cpuinfo.c"
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);
--- /dev/null
+#include "tst-cpu-features-supports.c"
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);
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);
CHECK_CPU_FEATURE_USABLE (FSRCS);
CHECK_CPU_FEATURE_USABLE (AESKLE);
CHECK_CPU_FEATURE_USABLE (WIDE_KL);
+ CHECK_CPU_FEATURE_USABLE (PTWRITE);
return 0;
}