/* Interrogate CPU extended features via CPUID. */
mov $0x80000000,%eax
cpuid
+ shld $16,%eax,%ecx
xor %edx,%edx
+ cmp $0x8000,%cx # any function @ 0x8000xxxx?
+ jne 1f
cmp $0x80000000,%eax # any function > 0x80000000?
jbe 1f
mov $0x80000001,%eax
/* AMD-defined flags: level 0x80000001 */
c->extended_cpuid_level = cpuid_eax(0x80000000);
- cpuid(0x80000001, &tmp, &tmp,
- &c->x86_capability[cpufeat_word(X86_FEATURE_LAHF_LM)],
- &c->x86_capability[cpufeat_word(X86_FEATURE_SYSCALL)]);
+ if ((c->extended_cpuid_level >> 16) != 0x8000)
+ c->extended_cpuid_level = 0;
+ if (c->extended_cpuid_level > 0x80000000)
+ cpuid(0x80000001, &tmp, &tmp,
+ &c->x86_capability[cpufeat_word(X86_FEATURE_LAHF_LM)],
+ &c->x86_capability[cpufeat_word(X86_FEATURE_SYSCALL)]);
if (c == &boot_cpu_data)
bootsym(cpuid_ext_features) =
c->x86_capability[cpufeat_word(X86_FEATURE_NX)];
static void __init efi_arch_cpu(void)
{
- if ( cpuid_eax(0x80000000) > 0x80000000 )
+ uint32_t eax = cpuid_eax(0x80000000);
+
+ if ( (eax >> 16) == 0x8000 && eax > 0x80000000 )
{
cpuid_ext_features = cpuid_edx(0x80000001);
boot_cpu_data.x86_capability[cpufeat_word(X86_FEATURE_SYSCALL)]
ASSERT(v->domain == current->domain);
hvm_cpuid(0x80000000, &level, NULL, NULL, NULL);
- if ( level >= 0x80000001 )
+ if ( (level >> 16) == 0x8000 && level > 0x80000000 )
{
unsigned int dummy;
{
phys_addr = 36;
hvm_cpuid(0x80000000, &eax, NULL, NULL, NULL);
- if ( eax >= 0x80000008 )
+ if ( (eax >> 16) == 0x8000 && eax >= 0x80000008 )
{
hvm_cpuid(0x80000008, &eax, NULL, NULL, NULL);
phys_addr = (uint8_t)eax;