From patchwork Thu May 10 00:13:42 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: 158072 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 8898BB6FB4 for ; Thu, 10 May 2012 10:15:32 +1000 (EST) Received: from localhost ([::1]:41904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSH2Y-0000os-8E for incoming@patchwork.ozlabs.org; Wed, 09 May 2012 20:15:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSH26-0000Ml-Qy for qemu-devel@nongnu.org; Wed, 09 May 2012 20:15:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSH23-0005El-U0 for qemu-devel@nongnu.org; Wed, 09 May 2012 20:15:02 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35519 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSH23-0005EH-OB for qemu-devel@nongnu.org; Wed, 09 May 2012 20:14:59 -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 A9D4497719 for ; Thu, 10 May 2012 02:14:58 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 10 May 2012 02:13:42 +0200 Message-Id: <1336608892-30501-5-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1336608892-30501-1-git-send-email-afaerber@suse.de> References: <1336608892-30501-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: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH next v2 04/74] target-i386: Let cpu_x86_init() return X86CPU 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 Turn cpu_init macro into a static inline function returning CPUX86State for backwards compatibility. Signed-off-by: Andreas Färber --- target-i386/cpu.h | 12 ++++++++++-- target-i386/helper.c | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 4bff61d..adc569c 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -785,7 +785,7 @@ typedef struct CPUX86State { #include "cpu-qom.h" -CPUX86State *cpu_x86_init(const char *cpu_model); +X86CPU *cpu_x86_init(const char *cpu_model); int cpu_x86_exec(CPUX86State *s); void x86_cpu_list (FILE *f, fprintf_function cpu_fprintf, const char *optarg); void x86_cpudef_setup(void); @@ -958,7 +958,15 @@ uint64_t cpu_get_tsc(CPUX86State *env); #define TARGET_VIRT_ADDR_SPACE_BITS 32 #endif -#define cpu_init cpu_x86_init +static inline CPUX86State *cpu_init(const char *cpu_model) +{ + X86CPU *cpu = cpu_x86_init(cpu_model); + if (cpu == NULL) { + return NULL; + } + return &cpu->env; +} + #define cpu_exec cpu_x86_exec #define cpu_gen_code cpu_x86_gen_code #define cpu_signal_handler cpu_x86_signal_handler diff --git a/target-i386/helper.c b/target-i386/helper.c index fe181be..4577cae 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1157,7 +1157,7 @@ int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector, return 1; } -CPUX86State *cpu_x86_init(const char *cpu_model) +X86CPU *cpu_x86_init(const char *cpu_model) { X86CPU *cpu; CPUX86State *env; @@ -1183,7 +1183,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model) qemu_init_vcpu(env); - return env; + return cpu; } #if !defined(CONFIG_USER_ONLY)