Patchwork [RFC,qom-cpu,13/15] target-sparc: Introduce QOM realizefn for SPARCCPU

login
register
mail settings
Submitter Andreas Färber
Date Jan. 16, 2013, 5:32 a.m.
Message ID <1358314380-9400-14-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/212401/
State New
Headers show

Comments

Andreas Färber - Jan. 16, 2013, 5:32 a.m.
Introduce realizefn and set realized = true in cpu_sparc_init().

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-sparc/cpu.c |   13 ++++++++++++-
 1 Datei geändert, 12 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

Patch

diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
index f404aa8..b38fe0d 100644
--- a/target-sparc/cpu.c
+++ b/target-sparc/cpu.c
@@ -122,7 +122,8 @@  SPARCCPU *cpu_sparc_init(const char *cpu_model)
         object_delete(OBJECT(cpu));
         return NULL;
     }
-    qemu_init_vcpu(env);
+
+    object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
     return cpu;
 }
@@ -851,6 +852,13 @@  void cpu_dump_state(CPUSPARCState *env, FILE *f, fprintf_function cpu_fprintf,
     cpu_fprintf(f, "\n");
 }
 
+static void sparc_cpu_realizefn(DeviceState *dev, Error **errp)
+{
+    SPARCCPU *cpu = SPARC_CPU(dev);
+
+    qemu_init_vcpu(&cpu->env);
+}
+
 static void sparc_cpu_initfn(Object *obj)
 {
     SPARCCPU *cpu = SPARC_CPU(obj);
@@ -871,6 +879,9 @@  static void sparc_cpu_class_init(ObjectClass *oc, void *data)
 {
     SPARCCPUClass *scc = SPARC_CPU_CLASS(oc);
     CPUClass *cc = CPU_CLASS(oc);
+    DeviceClass *dc = DEVICE_CLASS(oc);
+
+    dc->realize = sparc_cpu_realizefn;
 
     scc->parent_reset = cc->reset;
     cc->reset = sparc_cpu_reset;