From patchwork Tue Jun 5 01:21:44 2012 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: 162965 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 44FCAB6F62 for ; Tue, 5 Jun 2012 13:14:01 +1000 (EST) Received: from localhost ([::1]:34722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiVX-0003a9-Oz for incoming@patchwork.ozlabs.org; Mon, 04 Jun 2012 21:24:27 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiUr-00028H-G0 for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:23:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbiUp-0008Ae-HU for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:23:45 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52675 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiUp-00089b-8X for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:23:43 -0400 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 28331914CD; Tue, 5 Jun 2012 03:23:42 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Tue, 5 Jun 2012 03:21:44 +0200 Message-Id: <1338859366-20689-13-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1338859366-20689-1-git-send-email-afaerber@suse.de> References: <1338859366-20689-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Max Filippov , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 12/74] target-xtensa: Let cpu_xtensa_init() return XtensaCPU 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 Make the include paths for cpu-qom.h consistent to allow using XtensaCPU in cpu.h. Turn cpu_init macro into a static inline function returning CPUXtensaState for backwards compatibility. Signed-off-by: Andreas Färber Acked-by: Max Filippov --- target-xtensa/cpu.c | 2 +- target-xtensa/cpu.h | 16 +++++++++++++--- target-xtensa/helper.c | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c index 97deacb..9d01983 100644 --- a/target-xtensa/cpu.c +++ b/target-xtensa/cpu.c @@ -28,7 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "cpu-qom.h" +#include "cpu.h" #include "qemu-common.h" diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h index 6d0ea7c..81f7833 100644 --- a/target-xtensa/cpu.h +++ b/target-xtensa/cpu.h @@ -344,13 +344,24 @@ typedef struct CPUXtensaState { CPU_COMMON } CPUXtensaState; -#define cpu_init cpu_xtensa_init +#include "cpu-qom.h" + #define cpu_exec cpu_xtensa_exec #define cpu_gen_code cpu_xtensa_gen_code #define cpu_signal_handler cpu_xtensa_signal_handler #define cpu_list xtensa_cpu_list -CPUXtensaState *cpu_xtensa_init(const char *cpu_model); +XtensaCPU *cpu_xtensa_init(const char *cpu_model); + +static inline CPUXtensaState *cpu_init(const char *cpu_model) +{ + XtensaCPU *cpu = cpu_xtensa_init(cpu_model); + if (cpu == NULL) { + return NULL; + } + return &cpu->env; +} + void xtensa_translate_init(void); int cpu_xtensa_exec(CPUXtensaState *s); void xtensa_register_core(XtensaConfigList *node); @@ -471,7 +482,6 @@ static inline void cpu_get_tb_cpu_state(CPUXtensaState *env, target_ulong *pc, } #include "cpu-all.h" -#include "cpu-qom.h" #include "exec-all.h" static inline int cpu_has_work(CPUXtensaState *env) diff --git a/target-xtensa/helper.c b/target-xtensa/helper.c index 2094227..e6cb3fe 100644 --- a/target-xtensa/helper.c +++ b/target-xtensa/helper.c @@ -80,7 +80,7 @@ static void breakpoint_handler(CPUXtensaState *env) } } -CPUXtensaState *cpu_xtensa_init(const char *cpu_model) +XtensaCPU *cpu_xtensa_init(const char *cpu_model) { static int tcg_inited; static int debug_handler_inited; @@ -116,7 +116,7 @@ CPUXtensaState *cpu_xtensa_init(const char *cpu_model) xtensa_irq_init(env); qemu_init_vcpu(env); - return env; + return cpu; }