From patchwork Tue Jun 5 01:21:59 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: 162953 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 09944B6F62 for ; Tue, 5 Jun 2012 13:00:55 +1000 (EST) Received: from localhost ([::1]:37196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiWq-0004zp-Mw for incoming@patchwork.ozlabs.org; Mon, 04 Jun 2012 21:25:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiV6-0002sB-83 for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:24:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbiV4-0008H9-Ch for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:23:59 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52709 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbiV4-0008Gi-2M for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:23:58 -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 000248738D for ; Tue, 5 Jun 2012 03:23:56 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Tue, 5 Jun 2012 03:21:59 +0200 Message-Id: <1338859366-20689-28-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: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 27/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 Reviewed-by: Igor Mammedov --- 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 aeff20b..bcf663e 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -787,7 +787,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); @@ -960,7 +960,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 e182025..8df109f 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) x86_cpu_realize(OBJECT(cpu), NULL); - return env; + return cpu; } #if !defined(CONFIG_USER_ONLY)