git: 3637d81e8f68 - stable/14 - x86: add cpu_stdext_feature4
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 03 May 2025 15:20:08 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=3637d81e8f6875c7f777ca3cf14a2fc3e601db60
commit 3637d81e8f6875c7f777ca3cf14a2fc3e601db60
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-10-24 02:28:05 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-05-03 15:19:41 +0000
x86: add cpu_stdext_feature4
(cherry picked from commit 011a3493610cc69e9337c857d4947b0bbc462c0a)
---
sys/x86/include/x86_var.h | 1 +
sys/x86/x86/identcpu.c | 21 ++++++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h
index 6609871bf89e..0ff336c9c1f0 100644
--- a/sys/x86/include/x86_var.h
+++ b/sys/x86/include/x86_var.h
@@ -50,6 +50,7 @@ extern u_int cpu_clflush_line_size;
extern u_int cpu_stdext_feature;
extern u_int cpu_stdext_feature2;
extern u_int cpu_stdext_feature3;
+extern u_int cpu_stdext_feature4;
extern uint64_t cpu_ia32_arch_caps;
extern u_int cpu_high;
extern u_int cpu_id;
diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c
index 000f99c683e7..3ae3d17f8028 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -107,9 +107,12 @@ char cpu_vendor[20]; /* CPU Origin code */
u_int cpu_vendor_id; /* CPU vendor ID */
u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */
u_int cpu_clflush_line_size = 32;
+/* leaf 7 %ecx = 0 */
u_int cpu_stdext_feature; /* %ebx */
u_int cpu_stdext_feature2; /* %ecx */
u_int cpu_stdext_feature3; /* %edx */
+/* leaf 7 %ecx = 1 */
+u_int cpu_stdext_feature4; /* %eax */
uint64_t cpu_ia32_arch_caps;
u_int cpu_max_ext_state_size;
u_int cpu_mon_mwait_flags; /* MONITOR/MWAIT flags (CPUID.05H.ECX) */
@@ -1039,6 +1042,16 @@ printcpuinfo(void)
"\040SSBD"
);
}
+#define STDEXT4_MASK (CPUID_STDEXT4_LASS | CPUID_STDEXT4_LAM)
+ if ((cpu_stdext_feature4 & STDEXT4_MASK) != 0) {
+ printf("\n Structured Extended Features4=0x%b",
+ cpu_stdext_feature4 & STDEXT4_MASK,
+ "\020"
+ "\007LASS"
+ "\033LAM"
+ );
+ }
+#undef STDEXT4_MASK
if ((cpu_feature2 & CPUID2_XSAVE) != 0) {
cpuid_count(0xd, 0x1, regs);
@@ -1534,7 +1547,7 @@ identify_cpu1(void)
void
identify_cpu2(void)
{
- u_int regs[4], cpu_stdext_disable;
+ u_int regs[4], cpu_stdext_disable, max_eax_l7;
if (cpu_high >= 6) {
cpuid_count(6, 0, regs);
@@ -1547,6 +1560,7 @@ identify_cpu2(void)
if (cpu_high >= 7) {
cpuid_count(7, 0, regs);
cpu_stdext_feature = regs[1];
+ max_eax_l7 = regs[0];
/*
* Some hypervisors failed to filter out unsupported
@@ -1563,6 +1577,11 @@ identify_cpu2(void)
if ((cpu_stdext_feature3 & CPUID_STDEXT3_ARCH_CAP) != 0)
cpu_ia32_arch_caps = rdmsr(MSR_IA32_ARCH_CAP);
+
+ if (max_eax_l7 >= 1) {
+ cpuid_count(7, 1, regs);
+ cpu_stdext_feature4 = regs[0];
+ }
}
}