aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-04-17 14:50:53 +0200
committerAndreas Färber <afaerber@suse.de>2012-04-25 10:51:35 +0200
commit35112e415a771507fd94cca3b1a4ba4f99dd18d1 (patch)
tree934266f5ed3acaa4ea07385a0cc79f5f361f99fe
parent67e30c83497df23bb821d40648aec774910c3ecf (diff)
target-i386: Add property getter for CPU stepping
Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
-rw-r--r--target-i386/cpu.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 7f63afd8f5..2ff5142950 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -675,6 +675,18 @@ static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque,
env->cpuid_version |= ((value & 0xf) << 4) | ((value >> 4) << 16);
}
+static void x86_cpuid_version_get_stepping(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 & 0xf;
+ visit_type_int(v, &value, name, errp);
+}
+
static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v,
void *opaque, const char *name,
Error **errp)
@@ -1570,7 +1582,7 @@ static void x86_cpu_initfn(Object *obj)
x86_cpuid_version_get_model,
x86_cpuid_version_set_model, NULL, NULL, NULL);
object_property_add(obj, "stepping", "int",
- NULL,
+ x86_cpuid_version_get_stepping,
x86_cpuid_version_set_stepping, NULL, NULL, NULL);
object_property_add_str(obj, "model-id",
NULL,