From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ux9XH-0006yL-Id for qemu-devel@nongnu.org; Thu, 11 Jul 2013 01:35:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ux9XG-0005da-5Y for qemu-devel@nongnu.org; Thu, 11 Jul 2013 01:35:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ux9XF-0005dR-Um for qemu-devel@nongnu.org; Thu, 11 Jul 2013 01:35:22 -0400 Date: Thu, 11 Jul 2013 07:35:10 +0200 From: Igor Mammedov Message-ID: <20130711073510.7515de3e@nial.usersys.redhat.com> In-Reply-To: <1373473577-1088-1-git-send-email-afaerber@suse.de> References: <1373473577-1088-1-git-send-email-afaerber@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] linux-user: Use X86CPU property to retrieve CPUID family List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?ISO-8859-1?B?RuRyYmVy?= Cc: Riku Voipio , qemu-devel@nongnu.org On Wed, 10 Jul 2013 18:26:17 +0200 Andreas F=E4rber wrote: > Avoids duplicating the calculation. >=20 > Signed-off-by: Andreas F=E4rber > --- > Have this lying around for a while already, apparently not sent out yet. >=20 > linux-user/cpu-uname.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) >=20 > diff --git a/linux-user/cpu-uname.c b/linux-user/cpu-uname.c > index 59cd647..cc713e6 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 =3D ((CPUX86State *)cpu_env)->cpuid_version; > - int family =3D ((cpuid_version >> 8) & 0x0f) + ((cpuid_version >> 20= ) & 0xff); > - if (family =3D=3D 4) > + CPUState *cpu =3D ENV_GET_CPU((CPUX86State *)cpu_env); > + int family =3D object_property_get_int(OBJECT(cpu), "family", NULL); > + if (family =3D=3D 4) { > return "i486"; > - if (family =3D=3D 5) > + } > + if (family =3D=3D 5) { > return "i586"; > + } > return "i686"; > #else > /* default is #define-d in each arch/ subdir */ Reviewed-By: Igor Mammedov