1 /* Public domain. */ 2 3 #ifndef _LINUXKPI_ASM_CPUFEATURE_H 4 #define _LINUXKPI_ASM_CPUFEATURE_H 5 6 #if defined(__amd64__) || defined(__i386__) 7 8 #include <sys/types.h> 9 #include <machine/md_var.h> 10 11 #define X86_FEATURE_CLFLUSH 1 12 #define X86_FEATURE_XMM4_1 2 13 #define X86_FEATURE_PAT 3 14 #define X86_FEATURE_HYPERVISOR 4 15 16 static inline bool static_cpu_has(uint16_t f)17static_cpu_has(uint16_t f) 18 { 19 switch (f) { 20 case X86_FEATURE_CLFLUSH: 21 return ((cpu_feature & CPUID_CLFSH) != 0); 22 case X86_FEATURE_XMM4_1: 23 return ((cpu_feature2 & CPUID2_SSE41) != 0); 24 case X86_FEATURE_PAT: 25 return ((cpu_feature & CPUID_PAT) != 0); 26 case X86_FEATURE_HYPERVISOR: 27 return ((cpu_feature2 & CPUID2_HV) != 0); 28 default: 29 return (false); 30 } 31 } 32 33 #define boot_cpu_has(x) static_cpu_has(x) 34 35 #endif 36 37 #endif 38