aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-04-17 14:42:22 +0200
committerAndreas Färber <afaerber@suse.de>2012-04-25 10:51:35 +0200
commit95b8519d163e4154f468288103d62937bce7598d (patch)
treed44251b4ce095589e0006561f4c5ec6d4ed59f6e /target-i386
parent938d4c2521149a13fc4dc77e68e31953d2ec5e66 (diff)
downloadqemu-95b8519d163e4154f468288103d62937bce7598d.zip
qemu-95b8519d163e4154f468288103d62937bce7598d.tar.gz
qemu-95b8519d163e4154f468288103d62937bce7598d.tar.bz2
target-i386: Add property getter for CPU family
Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpu.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index bb57345..90c1373 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -599,6 +599,20 @@ static int check_features_against_host(x86_def_t *guest_def)
return rv;
}
+static void x86_cpuid_version_get_family(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 >> 8) & 0xf;
+ if (value == 0xf) {
+ value += (env->cpuid_version >> 20) & 0xff;
+ }
+ visit_type_int(v, &value, name, errp);
+}
+
static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)
{
@@ -1538,7 +1552,7 @@ static void x86_cpu_initfn(Object *obj)
cpu_exec_init(env);
object_property_add(obj, "family", "int",
- NULL,
+ x86_cpuid_version_get_family,
x86_cpuid_version_set_family, NULL, NULL, NULL);
object_property_add(obj, "model", "int",
NULL,