From patchwork Tue Jun 5 01:21:54 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: 162940 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 35DCBB6F62 for ; Tue, 5 Jun 2012 12:45:34 +1000 (EST) Received: from localhost ([::1]:34729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiVb-0003aZ-8Z for incoming@patchwork.ozlabs.org; Mon, 04 Jun 2012 21:24:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiV2-0002h9-MH for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:23:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbiUz-0008Ff-Ck for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:23:56 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52702 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiUz-0008FI-3k for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:23:53 -0400 Received: from relay2.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 0940B914CD; Tue, 5 Jun 2012 03:23:52 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Tue, 5 Jun 2012 03:21:54 +0200 Message-Id: <1338859366-20689-23-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: "Edgar E. Iglesias" , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 22/74] target-microblaze: Let cpu_mb_init() return MicroBlazeCPU 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 Since qemu_init_vcpu() is no-op for CONFIG_USER_ONLY drop the env variable that is now unused there. Turn cpu_init macro into a static inline function returning CPUMBState for backwards compatibility. Signed-off-by: Andreas Färber Acked-by: Edgar E. Iglesias --- target-microblaze/cpu.h | 12 ++++++++++-- target-microblaze/translate.c | 13 ++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index b0ba9fe..4968c24 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -272,7 +272,7 @@ struct CPUMBState { #include "cpu-qom.h" -CPUMBState *cpu_mb_init(const char *cpu_model); +MicroBlazeCPU *cpu_mb_init(const char *cpu_model); int cpu_mb_exec(CPUMBState *s); void cpu_mb_close(CPUMBState *s); void do_interrupt(CPUMBState *env); @@ -295,7 +295,15 @@ enum { #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 -#define cpu_init cpu_mb_init +static inline CPUMBState *cpu_init(const char *cpu_model) +{ + MicroBlazeCPU *cpu = cpu_mb_init(cpu_model); + if (cpu == NULL) { + return NULL; + } + return &cpu->env; +} + #define cpu_exec cpu_mb_exec #define cpu_gen_code cpu_mb_gen_code #define cpu_signal_handler cpu_mb_signal_handler diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c index f0ebd59..3c2936f 100644 --- a/target-microblaze/translate.c +++ b/target-microblaze/translate.c @@ -1951,21 +1951,20 @@ void cpu_dump_state (CPUMBState *env, FILE *f, fprintf_function cpu_fprintf, cpu_fprintf(f, "\n\n"); } -CPUMBState *cpu_mb_init (const char *cpu_model) +MicroBlazeCPU *cpu_mb_init(const char *cpu_model) { MicroBlazeCPU *cpu; - CPUMBState *env; static int tcg_initialized = 0; int i; cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU)); - env = &cpu->env; cpu_reset(CPU(cpu)); - qemu_init_vcpu(env); + qemu_init_vcpu(&cpu->env); - if (tcg_initialized) - return env; + if (tcg_initialized) { + return cpu; + } tcg_initialized = 1; @@ -1999,7 +1998,7 @@ CPUMBState *cpu_mb_init (const char *cpu_model) #define GEN_HELPER 2 #include "helper.h" - return env; + return cpu; } void cpu_state_reset(CPUMBState *env)