diff options
author | Andreas Färber <afaerber@suse.de> | 2012-02-17 17:46:02 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-02-24 09:06:58 -0600 |
commit | b0704cbd3f261003cac243ab88eaad42210a1b4d (patch) | |
tree | a874fa30fd0ff8c5fdc6f2b4c5c0307a64b61a05 /target-i386/cpuid.c | |
parent | ed5e1ec3fc00911a2231de8e4c7717aa63a116ab (diff) |
target-i386: Introduce x86_cpuid_version_set_model()
Move the logic for setting the model and extended model fields
into a helper function.
To make the function self-contained and to prepare for future
unordered/multiple uses, mask out any previous model 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/cpuid.c')
-rw-r--r-- | 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 47e2881103..c528cd94dd 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -607,6 +607,12 @@ static void x86_cpuid_version_set_family(CPUX86State *env, int family) } } +static void x86_cpuid_version_set_model(CPUX86State *env, int model) +{ + env->cpuid_version &= ~0xf00f0; + env->cpuid_version |= ((model & 0xf) << 4) | ((model >> 4) << 16); +} + static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) { unsigned int i; @@ -894,7 +900,7 @@ int cpu_x86_register (CPUX86State *env, const char *cpu_model) env->cpuid_vendor_override = def->vendor_override; env->cpuid_level = def->level; x86_cpuid_version_set_family(env, def->family); - env->cpuid_version |= ((def->model & 0xf) << 4) | ((def->model >> 4) << 16); + x86_cpuid_version_set_model(env, def->model); env->cpuid_version |= def->stepping; env->cpuid_features = def->features; env->cpuid_ext_features = def->ext_features; |