aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-05-18 00:01:58 +0200
committerAndreas Färber <afaerber@suse.de>2013-07-23 02:41:33 +0200
commit6f152e9bc80aed81ea89aa8ad345cd71326b71fb (patch)
treec37228c522e5939cd3786ba244d543013fa77d3b /linux-user
parent22169d415a1d1706f66a4fd50a3573d3f296b24f (diff)
linux-user: Use X86CPU property to retrieve CPUID family
Avoids duplicating the calculation. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/cpu-uname.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/linux-user/cpu-uname.c b/linux-user/cpu-uname.c
index 59cd6477d5..cc713e6553 100644
--- a/linux-user/cpu-uname.c
+++ b/linux-user/cpu-uname.c
@@ -55,12 +55,14 @@ const char *cpu_to_uname_machine(void *cpu_env)
return "x86-64";
#elif defined(TARGET_I386)
/* see arch/x86/kernel/cpu/bugs.c: check_bugs(), 386, 486, 586, 686 */
- uint32_t cpuid_version = ((CPUX86State *)cpu_env)->cpuid_version;
- int family = ((cpuid_version >> 8) & 0x0f) + ((cpuid_version >> 20) & 0xff);
- if (family == 4)
+ CPUState *cpu = ENV_GET_CPU((CPUX86State *)cpu_env);
+ int family = object_property_get_int(OBJECT(cpu), "family", NULL);
+ if (family == 4) {
return "i486";
- if (family == 5)
+ }
+ if (family == 5) {
return "i586";
+ }
return "i686";
#else
/* default is #define-d in each arch/ subdir */