33#define vendor_is_intel vendor_is(X86_VENDOR_INTEL)
34#define vendor_is_amd vendor_is(X86_VENDOR_AMD)
37#define cpufeat_word(idx) ((idx) / 32)
38#define cpufeat_bit(idx) ((idx) % 32)
39#define cpufeat_mask(idx) (_AC(1, U) << cpufeat_bit(idx))
41#define FEATURESET_1d cpufeat_word(X86_FEATURE_FPU)
42#define FEATURESET_1c cpufeat_word(X86_FEATURE_SSE3)
43#define FEATURESET_e1d cpufeat_word(X86_FEATURE_SYSCALL)
44#define FEATURESET_e1c cpufeat_word(X86_FEATURE_LAHF_LM)
45#define FEATURESET_Da1 cpufeat_word(X86_FEATURE_XSAVEOPT)
46#define FEATURESET_7b0 cpufeat_word(X86_FEATURE_FSGSBASE)
47#define FEATURESET_7c0 cpufeat_word(X86_FEATURE_PREFETCHWT1)
48#define FEATURESET_e7d cpufeat_word(X86_FEATURE_ITSC)
49#define FEATURESET_e8b cpufeat_word(X86_FEATURE_CLZERO)
50#define FEATURESET_7d0 cpufeat_word(X86_FEATURE_RTM_ALWAYS_ABORT)
52#define FSCAPINTS (FEATURESET_7d0 + 1)
56static inline bool cpu_has(
unsigned int feature)
61#define cpu_has_fpu cpu_has(X86_FEATURE_FPU)
62#define cpu_has_vme cpu_has(X86_FEATURE_VME)
63#define cpu_has_de cpu_has(X86_FEATURE_DE)
64#define cpu_has_pse cpu_has(X86_FEATURE_PSE)
65#define cpu_has_tsc cpu_has(X86_FEATURE_TSC)
66#define cpu_has_pae cpu_has(X86_FEATURE_PAE)
67#define cpu_has_mce cpu_has(X86_FEATURE_MCE)
68#define cpu_has_pge cpu_has(X86_FEATURE_PGE)
69#define cpu_has_mca cpu_has(X86_FEATURE_MCA)
70#define cpu_has_pat cpu_has(X86_FEATURE_PAT)
71#define cpu_has_pse36 cpu_has(X86_FEATURE_PSE36)
72#define cpu_has_ds cpu_has(X86_FEATURE_DS)
73#define cpu_has_mmx cpu_has(X86_FEATURE_MMX)
74#define cpu_has_fxsr cpu_has(X86_FEATURE_FXSR)
76#define cpu_has_sse cpu_has(X86_FEATURE_SSE)
77#define cpu_has_sse2 cpu_has(X86_FEATURE_SSE2)
78#define cpu_has_vmx cpu_has(X86_FEATURE_VMX)
79#define cpu_has_smx cpu_has(X86_FEATURE_SMX)
80#define cpu_has_pcid cpu_has(X86_FEATURE_PCID)
81#define cpu_has_x2apic cpu_has(X86_FEATURE_X2APIC)
82#define cpu_has_xsave cpu_has(X86_FEATURE_XSAVE)
83#define cpu_has_avx cpu_has(X86_FEATURE_AVX)
85#define cpu_has_syscall cpu_has(X86_FEATURE_SYSCALL)
86#define cpu_has_nx cpu_has(X86_FEATURE_NX)
87#define cpu_has_page1gb cpu_has(X86_FEATURE_PAGE1GB)
88#define cpu_has_lm cpu_has(X86_FEATURE_LM)
90#define cpu_has_svm cpu_has(X86_FEATURE_SVM)
91#define cpu_has_dbext cpu_has(X86_FEATURE_DBEXT)
93#define cpu_has_fsgsbase cpu_has(X86_FEATURE_FSGSBASE)
94#define cpu_has_hle cpu_has(X86_FEATURE_HLE)
95#define cpu_has_smep cpu_has(X86_FEATURE_SMEP)
96#define cpu_has_rtm cpu_has(X86_FEATURE_RTM)
97#define cpu_has_smap cpu_has(X86_FEATURE_SMAP)
99#define cpu_has_umip cpu_has(X86_FEATURE_UMIP)
100#define cpu_has_pku cpu_has(X86_FEATURE_PKU)
102#define cpu_has_rtm_always_abort cpu_has(X86_FEATURE_RTM_ALWAYS_ABORT)
void(* cpuid_count_fn_t)(uint32_t leaf, uint32_t subleaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
#define cpufeat_word(idx)
#define cpufeat_mask(idx)
uint32_t x86_features[FSCAPINTS]
unsigned int x86_stepping
void(* cpuid_fn_t)(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
static bool cpu_has(unsigned int feature)
static bool vendor_is(enum x86_vendor v)
unsigned int max_extd_leaf
Primatives for number manipulation.
Common declarations for all tests.