1 #ifndef XTF_X86_CPUID_H 2 #define XTF_X86_CPUID_H 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) 51 #define FSCAPINTS (FEATURESET_e8b + 1) 55 static inline bool cpu_has(
unsigned int feature)
60 #define cpu_has_fpu cpu_has(X86_FEATURE_FPU) 61 #define cpu_has_vme cpu_has(X86_FEATURE_VME) 62 #define cpu_has_de cpu_has(X86_FEATURE_DE) 63 #define cpu_has_pse cpu_has(X86_FEATURE_PSE) 64 #define cpu_has_tsc cpu_has(X86_FEATURE_TSC) 65 #define cpu_has_pae cpu_has(X86_FEATURE_PAE) 66 #define cpu_has_mce cpu_has(X86_FEATURE_MCE) 67 #define cpu_has_pge cpu_has(X86_FEATURE_PGE) 68 #define cpu_has_mca cpu_has(X86_FEATURE_MCA) 69 #define cpu_has_pat cpu_has(X86_FEATURE_PAT) 70 #define cpu_has_pse36 cpu_has(X86_FEATURE_PSE36) 71 #define cpu_has_ds cpu_has(X86_FEATURE_DS) 72 #define cpu_has_mmx cpu_has(X86_FEATURE_MMX) 73 #define cpu_has_fxsr cpu_has(X86_FEATURE_FXSR) 75 #define cpu_has_sse cpu_has(X86_FEATURE_SSE) 76 #define cpu_has_sse2 cpu_has(X86_FEATURE_SSE2) 77 #define cpu_has_vmx cpu_has(X86_FEATURE_VMX) 78 #define cpu_has_smx cpu_has(X86_FEATURE_SMX) 79 #define cpu_has_pcid cpu_has(X86_FEATURE_PCID) 80 #define cpu_has_x2apic cpu_has(X86_FEATURE_X2APIC) 81 #define cpu_has_xsave cpu_has(X86_FEATURE_XSAVE) 82 #define cpu_has_avx cpu_has(X86_FEATURE_AVX) 84 #define cpu_has_syscall cpu_has(X86_FEATURE_SYSCALL) 85 #define cpu_has_nx cpu_has(X86_FEATURE_NX) 86 #define cpu_has_page1gb cpu_has(X86_FEATURE_PAGE1GB) 87 #define cpu_has_lm cpu_has(X86_FEATURE_LM) 89 #define cpu_has_svm cpu_has(X86_FEATURE_SVM) 91 #define cpu_has_fsgsbase cpu_has(X86_FEATURE_FSGSBASE) 92 #define cpu_has_hle cpu_has(X86_FEATURE_HLE) 93 #define cpu_has_smep cpu_has(X86_FEATURE_SMEP) 94 #define cpu_has_rtm cpu_has(X86_FEATURE_RTM) 95 #define cpu_has_smap cpu_has(X86_FEATURE_SMAP) 97 #define cpu_has_umip cpu_has(X86_FEATURE_UMIP) 98 #define cpu_has_pku cpu_has(X86_FEATURE_PKU) static bool vendor_is(enum x86_vendor v)
static bool cpu_has(unsigned int feature)
Common declarations for all tests.
#define cpufeat_word(idx)
uint32_t x86_features[FSCAPINTS]
void(* cpuid_fn_t)(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
Primatives for number manipulation.
#define cpufeat_mask(idx)
unsigned int x86_stepping
void(* cpuid_count_fn_t)(uint32_t leaf, uint32_t subleaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
unsigned int max_extd_leaf