Message ID | 1334704279-11708-10-git-send-email-afaerber@suse.de |
---|---|
State | New |
Headers | show |
On Wed, Apr 18, 2012 at 01:11:13AM +0200, Andreas Färber wrote: > Signed-off-by: Andreas Färber <afaerber@suse.de> > --- > target-i386/cpu.c | 14 +++++++++++++- > 1 files changed, 13 insertions(+), 1 deletions(-) > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 21041b5..2beb3ab 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -640,6 +640,18 @@ static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque, > } > } > > +static void x86_cpuid_version_get_model(Object *obj, Visitor *v, void *opaque, > + const char *name, Error **errp) > +{ > + X86CPU *cpu = X86_CPU(obj); > + CPUX86State *env = &cpu->env; > + int64_t value; > + > + value = (env->cpuid_version >> 4) & 0xf; > + value |= (env->cpuid_version >> 16) & 0xf; I think this needs to be: value |= ((env->cpuid_version >> 16) & 0xf) << 4; > + visit_type_int(v, &value, name, errp); > +} > + > static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque, > const char *name, Error **errp) > { > @@ -1556,7 +1568,7 @@ static void x86_cpu_initfn(Object *obj) > x86_cpuid_version_get_family, > x86_cpuid_version_set_family, NULL, NULL, NULL); > object_property_add(obj, "model", "int", > - NULL, > + x86_cpuid_version_get_model, > x86_cpuid_version_set_model, NULL, NULL, NULL); > object_property_add(obj, "stepping", "int", > NULL, > -- > 1.7.7 > >
Am 20.04.2012 02:14, schrieb Michael Roth: > On Wed, Apr 18, 2012 at 01:11:13AM +0200, Andreas Färber wrote: >> Signed-off-by: Andreas Färber <afaerber@suse.de> >> --- >> target-i386/cpu.c | 14 +++++++++++++- >> 1 files changed, 13 insertions(+), 1 deletions(-) >> >> diff --git a/target-i386/cpu.c b/target-i386/cpu.c >> index 21041b5..2beb3ab 100644 >> --- a/target-i386/cpu.c >> +++ b/target-i386/cpu.c >> @@ -640,6 +640,18 @@ static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque, >> } >> } >> >> +static void x86_cpuid_version_get_model(Object *obj, Visitor *v, void *opaque, >> + const char *name, Error **errp) >> +{ >> + X86CPU *cpu = X86_CPU(obj); >> + CPUX86State *env = &cpu->env; >> + int64_t value; >> + >> + value = (env->cpuid_version >> 4) & 0xf; >> + value |= (env->cpuid_version >> 16) & 0xf; > > I think this needs to be: > > value |= ((env->cpuid_version >> 16) & 0xf) << 4; You're right! Thanks for catching this. /-F
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 21041b5..2beb3ab 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -640,6 +640,18 @@ static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque, } } +static void x86_cpuid_version_get_model(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + CPUX86State *env = &cpu->env; + int64_t value; + + value = (env->cpuid_version >> 4) & 0xf; + value |= (env->cpuid_version >> 16) & 0xf; + visit_type_int(v, &value, name, errp); +} + static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { @@ -1556,7 +1568,7 @@ static void x86_cpu_initfn(Object *obj) x86_cpuid_version_get_family, x86_cpuid_version_set_family, NULL, NULL, NULL); object_property_add(obj, "model", "int", - NULL, + x86_cpuid_version_get_model, x86_cpuid_version_set_model, NULL, NULL, NULL); object_property_add(obj, "stepping", "int", NULL,
Signed-off-by: Andreas Färber <afaerber@suse.de> --- target-i386/cpu.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)