qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: andre.przywara@amd.com, "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 3/4] target-i386: Introduce x86_cpuid_version_set_stepping()
Date: Fri, 17 Feb 2012 17:46:03 +0100	[thread overview]
Message-ID: <1329497164-20086-4-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1329497164-20086-1-git-send-email-afaerber@suse.de>

Move the logic for setting the stepping field into a helper function.

To make the function self-contained and to prepare for future
unordered/multiple uses, mask out any previous stepping values first.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpuid.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index e76a31b..7a99fcd 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -613,6 +613,12 @@ static void x86_cpuid_version_set_model(CPUX86State *env, int model)
     env->cpuid_version |= ((model & 0xf) << 4) | ((model >> 4) << 16);
 }
 
+static void x86_cpuid_version_set_stepping(CPUX86State *env, int stepping)
+{
+    env->cpuid_version &= ~0xf;
+    env->cpuid_version |= stepping & 0xf;
+}
+
 static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
 {
     unsigned int i;
@@ -901,7 +907,7 @@ int cpu_x86_register (CPUX86State *env, const char *cpu_model)
     env->cpuid_level = def->level;
     x86_cpuid_version_set_family(env, def->family);
     x86_cpuid_version_set_model(env, def->model);
-    env->cpuid_version |= def->stepping;
+    x86_cpuid_version_set_stepping(env, def->stepping);
     env->cpuid_features = def->features;
     env->cpuid_ext_features = def->ext_features;
     env->cpuid_ext2_features = def->ext2_features;
-- 
1.7.7

  parent reply	other threads:[~2012-02-17 16:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17 16:46 [Qemu-devel] [PATCH 0/4] target-i386: Helpers for CPUID version Andreas Färber
2012-02-17 16:46 ` [Qemu-devel] [PATCH 1/4] target-i386: Introduce x86_cpuid_version_set_family() Andreas Färber
2012-02-17 16:46 ` [Qemu-devel] [PATCH 2/4] target-i386: Introduce x86_cpuid_version_set_model() Andreas Färber
2012-02-17 16:46 ` Andreas Färber [this message]
2012-02-17 16:46 ` [Qemu-devel] [PATCH 4/4] target-i386: Introduce x86_cpuid_set_model_id() Andreas Färber
2012-02-24 15:31 ` [Qemu-devel] [PATCH 0/4] target-i386: Helpers for CPUID version Anthony Liguori

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=1329497164-20086-4-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=andre.przywara@amd.com \
    --cc=qemu-devel@nongnu.org \
    /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).