]> xenbits.xensource.com Git - people/aperard/qemu-dm.git/commitdiff
target-i386: Split out CPU creation and features parsing
authorIgor Mammedov <imammedo@redhat.com>
Thu, 11 Apr 2013 14:51:40 +0000 (16:51 +0200)
committerAnthony PERARD <anthony.perard@citrix.com>
Mon, 8 Jul 2013 20:51:11 +0000 (21:51 +0100)
Move CPU creation and features parsing into a separate cpu_x86_create()
function, so that board would be able to set board-specific CPU
properties before CPU is realized.

Keep cpu_x86_init() for compatibility with the code that uses cpu_init()
and doesn't need to modify CPU properties.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 7f833247df4b68719413b5dccc5f84944f442cb3)

target-i386/cpu.h
target-i386/helper.c

index 90ef1ff1e25d145bd6f92332a02bc37c4abb41b7..126364a0b87038dc7babc424500a252a68b0000a 100644 (file)
@@ -861,6 +861,7 @@ typedef struct CPUX86State {
 #include "cpu-qom.h"
 
 X86CPU *cpu_x86_init(const char *cpu_model);
+X86CPU *cpu_x86_create(const char *cpu_model, Error **errp);
 int cpu_x86_exec(CPUX86State *s);
 void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf);
 void x86_cpudef_setup(void);
index 5a98226c801dc3c8bcca554051eaa3eeeb1fc0b1..5bf784f2c9231c54fc09b4a7e1965cd8ec4652b8 100644 (file)
@@ -1240,11 +1240,10 @@ int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector,
     return 1;
 }
 
-X86CPU *cpu_x86_init(const char *cpu_model)
+X86CPU *cpu_x86_create(const char *cpu_model, Error **errp)
 {
     X86CPU *cpu;
     CPUX86State *env;
-    Error *error = NULL;
 
     cpu = X86_CPU(object_new(TYPE_X86_CPU));
     env = &cpu->env;
@@ -1254,8 +1253,21 @@ X86CPU *cpu_x86_init(const char *cpu_model)
         object_delete(OBJECT(cpu));
         return NULL;
     }
+    return cpu;
+}
+
+X86CPU *cpu_x86_init(const char *cpu_model)
+{
+    X86CPU *cpu;
+    Error *error = NULL;
+
+    cpu = cpu_x86_create(cpu_model, &error);
+    if (error) {
+        goto out;
+    }
 
     object_property_set_bool(OBJECT(cpu), true, "realized", &error);
+out:
     if (error) {
         error_free(error);
         object_delete(OBJECT(cpu));