From dc7c2b07daaef7313462299182e10eb9164687c8 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 6 Sep 2014 15:45:45 +0000 Subject: [PATCH] Add more bits for the XSAVE features from CPUID 0xd, sub-function 1 %eax report. Print the XSAVE features 0xd/1 in the boot banner. The printcpuinfo() is executed late enough so that XSAVE is already enabled. There is no known to me off the shelf hardware that implements any feature bits except XSAVEOPT, the list is taken from SDM rev. 50. The banner printing will allow us to note the hardware arrival. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/x86/include/specialreg.h | 3 +++ sys/x86/x86/identcpu.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h index bdc16e7fcb74..88129d459bc5 100644 --- a/sys/x86/include/specialreg.h +++ b/sys/x86/include/specialreg.h @@ -296,6 +296,9 @@ * CPUID instruction 0xd Processor Extended State Enumeration Sub-leaf 1 */ #define CPUID_EXTSTATE_XSAVEOPT 0x00000001 +#define CPUID_EXTSTATE_XSAVEC 0x00000002 +#define CPUID_EXTSTATE_XINUSE 0x00000004 +#define CPUID_EXTSTATE_XSAVES 0x00000008 /* * AMD extended function 8000_0007h edx info diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c index e33ab8a2fe71..c8b6ce206813 100644 --- a/sys/x86/x86/identcpu.c +++ b/sys/x86/x86/identcpu.c @@ -932,6 +932,19 @@ printcpuinfo(void) ); } + if ((cpu_feature2 & CPUID2_XSAVE) != 0) { + cpuid_count(0xd, 0x1, regs); + if (regs[0] != 0) { + printf("\n XSAVE Features=0x%b", + regs[0], + "\020" + "\001XSAVEOPT" + "\002XSAVEC" + "\003XINUSE" + "\004XSAVES"); + } + } + if (via_feature_rng != 0 || via_feature_xcrypt != 0) print_via_padlock_info();