From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFX-0006wJ-Ge for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwpFV-0006eo-PP for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:27 -0500 Received: from cantor2.suse.de ([195.135.220.15]:45264 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFV-0006ea-Gn for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:25 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 20 Jan 2013 08:22:44 +0100 Message-Id: <1358666571-1737-22-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 21/28] target-microblaze: Move TCG initialization to MicroBlazeCPU initfn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , =?UTF-8?q?Andreas=20F=C3=A4rber?= Split off TCG initialization from cpu_mb_init() into mb_tcg_init() to call it from the initfn. Ensures that a QOM-created MicroBlazeCPU is usable. Signed-off-by: Andreas F=C3=A4rber --- target-microblaze/cpu.c | 6 ++++++ target-microblaze/cpu.h | 1 + target-microblaze/translate.c | 13 +++++-------- 3 Dateien ge=C3=A4ndert, 12 Zeilen hinzugef=C3=BCgt(+), 8 Zeilen entfern= t(-) diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c index d4d197d..473bd70 100644 --- a/target-microblaze/cpu.c +++ b/target-microblaze/cpu.c @@ -99,10 +99,16 @@ static void mb_cpu_initfn(Object *obj) { MicroBlazeCPU *cpu =3D MICROBLAZE_CPU(obj); CPUMBState *env =3D &cpu->env; + static bool tcg_initialized; =20 cpu_exec_init(env); =20 set_float_rounding_mode(float_round_nearest_even, &env->fp_status); + + if (tcg_enabled() && !tcg_initialized) { + tcg_initialized =3D true; + mb_tcg_init(); + } } =20 static void mb_cpu_class_init(ObjectClass *oc, void *data) diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 5621068..c66193f 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -272,6 +272,7 @@ struct CPUMBState { =20 #include "cpu-qom.h" =20 +void mb_tcg_init(void); MicroBlazeCPU *cpu_mb_init(const char *cpu_model); int cpu_mb_exec(CPUMBState *s); void do_interrupt(CPUMBState *env); diff --git a/target-microblaze/translate.c b/target-microblaze/translate.= c index a84856b..12ea820 100644 --- a/target-microblaze/translate.c +++ b/target-microblaze/translate.c @@ -1965,18 +1965,17 @@ void cpu_dump_state (CPUMBState *env, FILE *f, fp= rintf_function cpu_fprintf, MicroBlazeCPU *cpu_mb_init(const char *cpu_model) { MicroBlazeCPU *cpu; - static int tcg_initialized =3D 0; - int i; =20 cpu =3D MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU)); =20 object_property_set_bool(OBJECT(cpu), true, "realized", NULL); =20 - if (tcg_initialized) { - return cpu; - } + return cpu; +} =20 - tcg_initialized =3D 1; +void mb_tcg_init(void) +{ + int i; =20 cpu_env =3D tcg_global_reg_new_ptr(TCG_AREG0, "env"); =20 @@ -2007,8 +2006,6 @@ MicroBlazeCPU *cpu_mb_init(const char *cpu_model) } #define GEN_HELPER 2 #include "helper.h" - - return cpu; } =20 void restore_state_to_opc(CPUMBState *env, TranslationBlock *tb, int pc_= pos) --=20 1.7.10.4