]> xenbits.xensource.com Git - people/liuw/xtf.git/commitdiff
Provide cpu_has_* helper predicates for common features
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 31 May 2016 17:17:14 +0000 (17:17 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 31 May 2016 17:17:14 +0000 (18:17 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
include/arch/x86/cpuid.h

index 04c40e06ecfab2f8fc2ece5bd8afb6ad97cae3cd..35e6f233bb63c01933fe5afb3eb3d55ed0a5e3b5 100644 (file)
@@ -54,6 +54,37 @@ static inline bool cpu_has(unsigned int feature)
     return x86_features[cpufeat_word(feature)] & cpufeat_mask(feature);
 }
 
+#define cpu_has_vme             cpu_has(X86_FEATURE_VME)
+#define cpu_has_de              cpu_has(X86_FEATURE_DE)
+#define cpu_has_pse             cpu_has(X86_FEATURE_PSE)
+#define cpu_has_tsc             cpu_has(X86_FEATURE_TSC)
+#define cpu_has_pae             cpu_has(X86_FEATURE_PAE)
+#define cpu_has_mce             cpu_has(X86_FEATURE_MCE)
+#define cpu_has_pge             cpu_has(X86_FEATURE_PGE)
+#define cpu_has_mca             cpu_has(X86_FEATURE_MCA)
+#define cpu_has_pat             cpu_has(X86_FEATURE_PAT)
+#define cpu_has_pse36           cpu_has(X86_FEATURE_PSE36)
+#define cpu_has_fxsr            cpu_has(X86_FEATURE_FXSR)
+
+#define cpu_has_sse             cpu_has(X86_FEATURE_SSE)
+#define cpu_has_sse2            cpu_has(X86_FEATURE_SSE2)
+#define cpu_has_vmx             cpu_has(X86_FEATURE_VMX)
+#define cpu_has_smx             cpu_has(X86_FEATURE_SMX)
+#define cpu_has_pcid            cpu_has(X86_FEATURE_PCID)
+#define cpu_has_xsave           cpu_has(X86_FEATURE_XSAVE)
+
+#define cpu_has_syscall         cpu_has(X86_FEATURE_SYSCALL)
+#define cpu_has_nx              cpu_has(X86_FEATURE_NX)
+#define cpu_has_page1gb         cpu_has(X86_FEATURE_PAGE1GB)
+#define cpu_has_lm              cpu_has(X86_FEATURE_LM)
+
+#define cpu_has_fsgsbase        cpu_has(X86_FEATURE_FSGSBASE)
+#define cpu_has_smep            cpu_has(X86_FEATURE_SMEP)
+#define cpu_has_smap            cpu_has(X86_FEATURE_SMAP)
+
+#define cpu_has_umip            cpu_has(X86_FEATURE_UMIP)
+#define cpu_has_pku             cpu_has(X86_FEATURE_PKU)
+
 #endif /* XTF_X86_CPUID_H */
 
 /*