Commit 6f152e9b authored by Andreas Färber's avatar Andreas Färber
Browse files

linux-user: Use X86CPU property to retrieve CPUID family



Avoids duplicating the calculation.

Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
parent 22169d41
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -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 */