From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFd-0007Bx-7J for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwpFc-0006gn-0b for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:33 -0500 Received: from cantor2.suse.de ([195.135.220.15]:45289 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFb-0006ge-OO for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:31 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 20 Jan 2013 08:22:50 +0100 Message-Id: <1358666571-1737-28-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 27/28] target-unicore32: Move TCG initialization to UniCore32CPU initfn 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?= Normalize the "inited" logic and add a tcg_enabled() check to suppress it for qtest. Ensures that a QOM-created UniCore32CPU is usable. Signed-off-by: Andreas F=C3=A4rber --- target-unicore32/cpu.c | 6 ++++++ target-unicore32/helper.c | 6 ------ 2 Dateien ge=C3=A4ndert, 6 Zeilen hinzugef=C3=BCgt(+), 6 Zeilen entfernt= (-) diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c index bf33326..7f8dc15 100644 --- a/target-unicore32/cpu.c +++ b/target-unicore32/cpu.c @@ -75,6 +75,7 @@ static void uc32_cpu_initfn(Object *obj) { UniCore32CPU *cpu =3D UNICORE32_CPU(obj); CPUUniCore32State *env =3D &cpu->env; + static bool inited; =20 cpu_exec_init(env); env->cpu_model_str =3D object_get_typename(obj); @@ -88,6 +89,11 @@ static void uc32_cpu_initfn(Object *obj) #endif =20 tlb_flush(env, 1); + + if (tcg_enabled() && !inited) { + inited =3D true; + uc32_translate_init(); + } } =20 static void uc32_cpu_class_init(ObjectClass *oc, void *data) diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c index 173579a..357cc8b 100644 --- a/target-unicore32/helper.c +++ b/target-unicore32/helper.c @@ -29,7 +29,6 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model) { UniCore32CPU *cpu; CPUUniCore32State *env; - static int inited =3D 1; =20 if (object_class_by_name(cpu_model) =3D=3D NULL) { return NULL; @@ -37,11 +36,6 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model= ) cpu =3D UNICORE32_CPU(object_new(cpu_model)); env =3D &cpu->env; =20 - if (inited) { - inited =3D 0; - uc32_translate_init(); - } - object_property_set_bool(OBJECT(cpu), true, "realized", NULL); =20 return env; --=20 1.7.10.4