summaryrefslogtreecommitdiffstats
path: root/target-i386
diff options
context:
space:
mode:
authorAndreas Färber2012-02-17 17:46:03 +0100
committerAnthony Liguori2012-02-24 16:06:58 +0100
commit38c3dc462297e2daa3a4a2c61ea9cbf50651f62a (patch)
treef9603e44852f17824d2535ee675441a6c7210456 /target-i386
parenttarget-i386: Introduce x86_cpuid_version_set_model() (diff)
downloadqemu-38c3dc462297e2daa3a4a2c61ea9cbf50651f62a.tar.gz
qemu-38c3dc462297e2daa3a4a2c61ea9cbf50651f62a.tar.xz
qemu-38c3dc462297e2daa3a4a2c61ea9cbf50651f62a.zip
target-i386: Introduce x86_cpuid_version_set_stepping()
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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpuid.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index c528cd94dd..38c1d226ca 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;