Received: from eggs.gnu.org ([208.118.235.92]:49659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFR-0006gT-TB for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwpFQ-0006cs-2m for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:21 -0500 Received: from cantor2.suse.de ([195.135.220.15]:45252 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFP-0006ck-PY for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:20 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 20 Jan 2013 08:22:38 +0100 Message-Id: <1358666571-1737-16-git-send-email-afaerber@suse.de> In-Reply-To: <1358666571-1737-1-git-send-email-afaerber@suse.de> References: <1358666571-1737-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [RFC qom-cpu v2 15/28] target-unicore32: Introduce QOM realizefn for UniCore32CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Guan Xuetao , =?UTF-8?q?Andreas=20F=C3=A4rber?= Introduce a realizefn and set realized =3D true in uc32_cpu_init(). Acked-by: Guan Xuetao [AF: Invoke the parent's realizefn] Signed-off-by: Andreas F=C3=A4rber --- target-unicore32/cpu-qom.h | 3 +++ target-unicore32/cpu.c | 20 ++++++++++++++++++++ target-unicore32/helper.c | 3 ++- 3 Dateien ge=C3=A4ndert, 25 Zeilen hinzugef=C3=BCgt(+), 1 Zeile entfernt= (-) diff --git a/target-unicore32/cpu-qom.h b/target-unicore32/cpu-qom.h index fe40b2d..625c614 100644 --- a/target-unicore32/cpu-qom.h +++ b/target-unicore32/cpu-qom.h @@ -25,6 +25,7 @@ =20 /** * UniCore32CPUClass: + * @parent_realize: The parent class' realize handler. * * A UniCore32 CPU model. */ @@ -32,6 +33,8 @@ typedef struct UniCore32CPUClass { /*< private >*/ CPUClass parent_class; /*< public >*/ + + DeviceRealize parent_realize; } UniCore32CPUClass; =20 /** diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c index 884c101..bf33326 100644 --- a/target-unicore32/cpu.c +++ b/target-unicore32/cpu.c @@ -61,6 +61,16 @@ static const UniCore32CPUInfo uc32_cpus[] =3D { { .name =3D "any", .instance_init =3D uc32_any_cpu_initfn }, }; =20 +static void uc32_cpu_realizefn(DeviceState *dev, Error **errp) +{ + UniCore32CPU *cpu =3D UNICORE32_CPU(dev); + UniCore32CPUClass *ucc =3D UNICORE32_CPU_GET_CLASS(dev); + + qemu_init_vcpu(&cpu->env); + + ucc->parent_realize(dev, errp); +} + static void uc32_cpu_initfn(Object *obj) { UniCore32CPU *cpu =3D UNICORE32_CPU(obj); @@ -80,6 +90,15 @@ static void uc32_cpu_initfn(Object *obj) tlb_flush(env, 1); } =20 +static void uc32_cpu_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + UniCore32CPUClass *ucc =3D UNICORE32_CPU_CLASS(oc); + + ucc->parent_realize =3D dc->realize; + dc->realize =3D uc32_cpu_realizefn; +} + static void uc32_register_cpu_type(const UniCore32CPUInfo *info) { TypeInfo type_info =3D { @@ -98,6 +117,7 @@ static const TypeInfo uc32_cpu_type_info =3D { .instance_init =3D uc32_cpu_initfn, .abstract =3D true, .class_size =3D sizeof(UniCore32CPUClass), + .class_init =3D uc32_cpu_class_init, }; =20 static void uc32_cpu_register_types(void) diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c index 5359538..173579a 100644 --- a/target-unicore32/helper.c +++ b/target-unicore32/helper.c @@ -42,7 +42,8 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model) uc32_translate_init(); } =20 - qemu_init_vcpu(env); + object_property_set_bool(OBJECT(cpu), true, "realized", NULL); + return env; } =20 --=20 1.7.10.4