git: 71f08bfa02a9 - main - x86: add cpu_stdext_feature5

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 22 Sep 2026 15:41:45 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=71f08bfa02a93d5d165ce96abc9077f36e4963b6

commit 71f08bfa02a93d5d165ce96abc9077f36e4963b6
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-09-19 08:02:56 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-22 15:40:40 +0000

    x86: add cpu_stdext_feature5
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D59815
---
 sys/x86/include/specialreg.h |  5 +++++
 sys/x86/include/x86_var.h    |  1 +
 sys/x86/x86/identcpu.c       | 10 ++++++++++
 3 files changed, 16 insertions(+)

diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h
index 7906946862c4..32d672522965 100644
--- a/sys/x86/include/specialreg.h
+++ b/sys/x86/include/specialreg.h
@@ -559,6 +559,11 @@
 #define	CPUID_STDEXT4_NMISRC		0x00100000
 #define	CPUID_STDEXT4_LAM		0x04000000
 
+/*
+ * CPUID instruction 7 Structured Extended Features, leaf 1 ecx info
+ */
+#define	CPUID_STDEXT5_MSR_IMM		0x00000020
+
 /* CPUID_HYBRID_ID leaf 0x1a */
 #define	CPUID_HYBRID_CORE_MASK	0xff000000
 #define	CPUID_HYBRID_SMALL_CORE	0x20000000
diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h
index 1711b13b6af6..ca0ac1e97768 100644
--- a/sys/x86/include/x86_var.h
+++ b/sys/x86/include/x86_var.h
@@ -51,6 +51,7 @@ 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	u_int	cpu_stdext_feature5;
 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 3060b444cb0d..331423f3b198 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -118,6 +118,7 @@ u_int	cpu_stdext_feature2;	/* %ecx */
 u_int	cpu_stdext_feature3;	/* %edx */
 /* leaf 7 %ecx = 1 */
 u_int	cpu_stdext_feature4;	/* %eax */
+u_int	cpu_stdext_feature5;	/* %ecx */
 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) */
@@ -1064,6 +1065,14 @@ printcpuinfo(void)
 				       );
 			}
 
+			if (cpu_stdext_feature5 != 0) {
+				printf("\n  Structured Extended Features5=0x%b",
+				    cpu_stdext_feature5,
+				       "\020"
+				       "\006MSR_IMM"
+				       );
+			}
+
 			if ((cpu_feature2 & CPUID2_XSAVE) != 0) {
 				cpuid_count(0xd, 0x1, regs);
 				if (regs[0] != 0) {
@@ -1616,6 +1625,7 @@ identify_cpu2(void)
 		if (max_eax_l7 >= 1) {
 			cpuid_count(7, 1, regs);
 			cpu_stdext_feature4 = regs[0];
+			cpu_stdext_feature5 = regs[2];
 		}
 	}
 }