1 /* SPDX-License-Identifier: GPL-2.0-only */
6 /* Standard macro to see if a specific flag is changeable */
7 static inline int flag_is_changeable_p(uint32_t flag
)
22 : "=&r" (f1
), "=&r" (f2
)
24 return ((f1
^f2
) & flag
) != 0;
27 /* Probe for the CPUID instruction */
28 int cpu_have_cpuid(void)
30 return flag_is_changeable_p(X86_EFLAGS_ID
);
35 int cpu_have_cpuid(void)
41 unsigned int cpu_cpuid_extended_level(void)
43 return cpuid_eax(0x80000000);
46 int cpu_phys_address_size(void)
48 if (!(cpu_have_cpuid()))
51 if (cpu_cpuid_extended_level() >= 0x80000008)
52 return cpuid_eax(0x80000008) & 0xff;
54 if (cpuid_edx(1) & (CPUID_FEATURE_PAE
| CPUID_FEATURE_PSE36
))
60 * Get processor id using cpuid eax=1
61 * return value in EAX register
63 uint32_t cpu_get_cpuid(void)
69 * Get processor feature flag using cpuid eax=1
70 * return value in ECX register
72 uint32_t cpu_get_feature_flags_ecx(void)
78 * Get processor feature flag using cpuid eax=1
79 * return value in EDX register
81 uint32_t cpu_get_feature_flags_edx(void)