From: Igor Mammedov <imammedo@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Riku Voipio <riku.voipio@iki.fi>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] linux-user: Use X86CPU property to retrieve CPUID family
Date: Thu, 11 Jul 2013 07:35:10 +0200 [thread overview]
Message-ID: <20130711073510.7515de3e@nial.usersys.redhat.com> (raw)
In-Reply-To: <1373473577-1088-1-git-send-email-afaerber@suse.de>
On Wed, 10 Jul 2013 18:26:17 +0200
Andreas Färber <afaerber@suse.de> wrote:
> Avoids duplicating the calculation.
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
> Have this lying around for a while already, apparently not sent out yet.
>
> linux-user/cpu-uname.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> 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 = ((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 */
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
next prev parent reply other threads:[~2013-07-11 5:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-10 16:26 [Qemu-devel] [PATCH] linux-user: Use X86CPU property to retrieve CPUID family Andreas Färber
2013-07-11 5:35 ` Igor Mammedov [this message]
2013-07-22 23:06 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130711073510.7515de3e@nial.usersys.redhat.com \
--to=imammedo@redhat.com \
--cc=afaerber@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).