From patchwork Sun Jan 20 07:22:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 213935 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EB7492C0084 for ; Sun, 20 Jan 2013 19:35:35 +1100 (EST) Received: from localhost ([::1]:38877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpH7-0000rO-8W for incoming@patchwork.ozlabs.org; Sun, 20 Jan 2013 02:25:05 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFT-0006k8-8D for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwpFS-0006dX-6V for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:23 -0500 Received: from cantor2.suse.de ([195.135.220.15]:45256 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwpFR-0006dM-OH for qemu-devel@nongnu.org; Sun, 20 Jan 2013 02:23:22 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 4543EA3A4A; Sun, 20 Jan 2013 08:23:21 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 20 Jan 2013 08:22:40 +0100 Message-Id: <1358666571-1737-18-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Peter Maydell , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paul Brook Subject: [Qemu-devel] [RFC qom-cpu v2 17/28] target-arm: Move TCG initialization to ARMCPU initfn X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Ensures that a QOM-created ARMCPU is usable. Signed-off-by: Andreas Färber --- target-arm/cpu.c | 6 ++++++ target-arm/helper.c | 6 ------ 2 Dateien geändert, 6 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 19d5ae4..8615068 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -135,10 +135,16 @@ static inline void set_feature(CPUARMState *env, int feature) static void arm_cpu_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); + static bool inited; cpu_exec_init(&cpu->env); cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free); + + if (tcg_enabled() && !inited) { + inited = true; + arm_translate_init(); + } } static void arm_cpu_finalizefn(Object *obj) diff --git a/target-arm/helper.c b/target-arm/helper.c index f412143..904859b 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1262,7 +1262,6 @@ ARMCPU *cpu_arm_init(const char *cpu_model) { ARMCPU *cpu; CPUARMState *env; - static int inited = 0; if (!object_class_by_name(cpu_model)) { return NULL; @@ -1274,11 +1273,6 @@ ARMCPU *cpu_arm_init(const char *cpu_model) /* TODO this should be set centrally, once possible */ object_property_set_bool(OBJECT(cpu), true, "realized", NULL); - if (tcg_enabled() && !inited) { - inited = 1; - arm_translate_init(); - } - return cpu; }