void host_cpuid(uint32_t function, uint32_t count,
uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
{
-#if defined(CONFIG_KVM)
uint32_t vec[4];
#ifdef __x86_64__
: "=a"(vec[0]), "=b"(vec[1]),
"=c"(vec[2]), "=d"(vec[3])
: "0"(function), "c"(count) : "cc");
-#else
+#elif defined(__i386__)
asm volatile("pusha \n\t"
"cpuid \n\t"
"mov %%eax, 0(%2) \n\t"
"popa"
: : "a"(function), "c"(count), "S"(vec)
: "memory", "cc");
+#else
+ abort();
#endif
if (eax)
*ecx = vec[2];
if (edx)
*edx = vec[3];
-#endif
}
#define iswhite(c) ((c) && ((c) <= ' ' || '~' < (c)))
}
}
-#ifdef CONFIG_KVM
static int cpu_x86_fill_model_id(char *str)
{
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
}
return 0;
}
-#endif
/* Fill a x86_def_t struct with information about the host CPU, and
* the CPU features supported by the host hardware + host kernel
*/
static void kvm_cpu_fill_host(x86_def_t *x86_cpu_def)
{
-#ifdef CONFIG_KVM
KVMState *s = kvm_state;
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
kvm_arch_get_supported_cpuid(s, wi->cpuid_eax, wi->cpuid_ecx,
wi->cpuid_reg);
}
-
-#endif /* CONFIG_KVM */
}
static int unavailable_host_feature(FeatureWordInfo *f, uint32_t mask)
return cpu_list;
}
-#ifdef CONFIG_KVM
static void filter_features_for_kvm(X86CPU *cpu)
{
CPUX86State *env = &cpu->env;
cpu->filtered_features[w] = requested_features & ~env->features[w];
}
}
-#endif
static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp)
{
"Host's CPU doesn't support requested features");
goto out;
}
-#ifdef CONFIG_KVM
filter_features_for_kvm(cpu);
-#endif
}
#ifndef CONFIG_USER_ONLY