Received: from eggs.gnu.org ([208.118.235.92]:49831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFe-0007EK-1h 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-0006h1-RI for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:33 -0500 Received: from cantor2.suse.de ([195.135.220.15]:45290 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFc-0006gt-In for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:32 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 20 Jan 2013 08:22:51 +0100 Message-Id: <1358666571-1737-29-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 28/28] target-xtensa: Move TCG initialization to XtensaCPU initfn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Max Filippov , =?UTF-8?q?Andreas=20F=C3=A4rber?= Combine this with breakpoint handler registration, guarding both with tcg_enabled() to suppress also TCG init for qtest. Rename the handler to xtensa_breakpoint_handler() since it needs to become global. Signed-off-by: Andreas F=C3=A4rber --- target-xtensa/cpu.c | 7 +++++++ target-xtensa/cpu.h | 1 + target-xtensa/helper.c | 14 +------------- 3 Dateien ge=C3=A4ndert, 9 Zeilen hinzugef=C3=BCgt(+), 13 Zeilen entfern= t(-) diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c index ec99ae9..6dccefb 100644 --- a/target-xtensa/cpu.c +++ b/target-xtensa/cpu.c @@ -70,8 +70,15 @@ static void xtensa_cpu_initfn(Object *obj) { XtensaCPU *cpu =3D XTENSA_CPU(obj); CPUXtensaState *env =3D &cpu->env; + static bool tcg_inited; =20 cpu_exec_init(env); + + if (tcg_enabled() && !tcg_inited) { + tcg_inited =3D true; + xtensa_translate_init(); + cpu_set_debug_excp_handler(xtensa_breakpoint_handler); + } } =20 static void xtensa_cpu_class_init(ObjectClass *oc, void *data) diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h index 5acf78c..dece224 100644 --- a/target-xtensa/cpu.h +++ b/target-xtensa/cpu.h @@ -385,6 +385,7 @@ static inline CPUXtensaState *cpu_init(const char *cp= u_model) } =20 void xtensa_translate_init(void); +void xtensa_breakpoint_handler(CPUXtensaState *env); int cpu_xtensa_exec(CPUXtensaState *s); void xtensa_register_core(XtensaConfigList *node); void do_interrupt(CPUXtensaState *s); diff --git a/target-xtensa/helper.c b/target-xtensa/helper.c index 14bcc7e..a8a6493 100644 --- a/target-xtensa/helper.c +++ b/target-xtensa/helper.c @@ -54,7 +54,7 @@ static uint32_t check_hw_breakpoints(CPUXtensaState *en= v) return 0; } =20 -static void breakpoint_handler(CPUXtensaState *env) +void xtensa_breakpoint_handler(CPUXtensaState *env) { if (env->watchpoint_hit) { if (env->watchpoint_hit->flags & BP_CPU) { @@ -72,8 +72,6 @@ static void breakpoint_handler(CPUXtensaState *env) =20 XtensaCPU *cpu_xtensa_init(const char *cpu_model) { - static int tcg_inited; - static int debug_handler_inited; XtensaCPU *cpu; CPUXtensaState *env; const XtensaConfig *config =3D NULL; @@ -93,16 +91,6 @@ XtensaCPU *cpu_xtensa_init(const char *cpu_model) env =3D &cpu->env; env->config =3D config; =20 - if (!tcg_inited) { - tcg_inited =3D 1; - xtensa_translate_init(); - } - - if (!debug_handler_inited && tcg_enabled()) { - debug_handler_inited =3D 1; - cpu_set_debug_excp_handler(breakpoint_handler); - } - xtensa_irq_init(env); =20 object_property_set_bool(OBJECT(cpu), true, "realized", NULL); --=20 1.7.10.4