From patchwork Sat Feb 16 15:45:41 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: 220998 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 DF07D2C0080 for ; Sun, 17 Feb 2013 04:23:44 +1100 (EST) Received: from localhost ([::1]:57277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6lUF-0002Sv-2R for incoming@patchwork.ozlabs.org; Sat, 16 Feb 2013 12:23:43 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6k1k-0005Ip-Jd for qemu-devel@nongnu.org; Sat, 16 Feb 2013 10:50:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6k1R-0002a1-P3 for qemu-devel@nongnu.org; Sat, 16 Feb 2013 10:50:01 -0500 Received: from cantor2.suse.de ([195.135.220.15]:40455 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6k1R-0002Zm-Fz for qemu-devel@nongnu.org; Sat, 16 Feb 2013 10:49:53 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E97C6A4EB7 for ; Sat, 16 Feb 2013 16:49:52 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sat, 16 Feb 2013 16:45:41 +0100 Message-Id: <1361029542-8412-47-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1361029542-8412-1-git-send-email-afaerber@suse.de> References: <1361029542-8412-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: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 46/47] target-i386: Move cpu_x86_init() 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 Consolidate CPU functions in cpu.c. Allows to make cpu_x86_register() static. No functional changes. Reviewed-by: Eduardo Habkost Reviewed-by: Igor Mammedov Signed-off-by: Andreas Färber --- target-i386/cpu.c | 26 +++++++++++++++++++++++++- target-i386/cpu.h | 1 - target-i386/helper.c | 24 ------------------------ 3 Dateien geändert, 25 Zeilen hinzugefügt(+), 26 Zeilen entfernt(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 635f334..462d6c9 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1516,7 +1516,7 @@ static void filter_features_for_kvm(X86CPU *cpu) } #endif -int cpu_x86_register(X86CPU *cpu, const char *cpu_model) +static int cpu_x86_register(X86CPU *cpu, const char *cpu_model) { CPUX86State *env = &cpu->env; x86_def_t def1, *def = &def1; @@ -1576,6 +1576,30 @@ out: return 0; } +X86CPU *cpu_x86_init(const char *cpu_model) +{ + X86CPU *cpu; + CPUX86State *env; + Error *error = NULL; + + cpu = X86_CPU(object_new(TYPE_X86_CPU)); + env = &cpu->env; + env->cpu_model_str = cpu_model; + + if (cpu_x86_register(cpu, cpu_model) < 0) { + object_unref(OBJECT(cpu)); + return NULL; + } + + object_property_set_bool(OBJECT(cpu), true, "realized", &error); + if (error) { + error_free(error); + object_unref(OBJECT(cpu)); + return NULL; + } + return cpu; +} + #if !defined(CONFIG_USER_ONLY) void cpu_clear_apic_feature(CPUX86State *env) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 9e6e1a6..7577e4f 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -1002,7 +1002,6 @@ int cpu_x86_signal_handler(int host_signum, void *pinfo, void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); -int cpu_x86_register(X86CPU *cpu, const char *cpu_model); void cpu_clear_apic_feature(CPUX86State *env); void host_cpuid(uint32_t function, uint32_t count, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); diff --git a/target-i386/helper.c b/target-i386/helper.c index 1a872fa..4bf9db7 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1267,30 +1267,6 @@ int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector, return 1; } -X86CPU *cpu_x86_init(const char *cpu_model) -{ - X86CPU *cpu; - CPUX86State *env; - Error *error = NULL; - - cpu = X86_CPU(object_new(TYPE_X86_CPU)); - env = &cpu->env; - env->cpu_model_str = cpu_model; - - if (cpu_x86_register(cpu, cpu_model) < 0) { - object_unref(OBJECT(cpu)); - return NULL; - } - - object_property_set_bool(OBJECT(cpu), true, "realized", &error); - if (error) { - error_free(error); - object_unref(OBJECT(cpu)); - return NULL; - } - return cpu; -} - #if !defined(CONFIG_USER_ONLY) void do_cpu_init(X86CPU *cpu) {