From patchwork Tue Feb 2 10:08:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 44273 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0E83EB7D23 for ; Tue, 2 Feb 2010 21:40:01 +1100 (EST) Received: from localhost ([127.0.0.1]:43615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcG9T-00061m-61 for incoming@patchwork.ozlabs.org; Tue, 02 Feb 2010 05:38:35 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NcFgj-0002oe-Pd for qemu-devel@nongnu.org; Tue, 02 Feb 2010 05:08:53 -0500 Received: from [199.232.76.173] (port=38611 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcFgh-0002nY-Po for qemu-devel@nongnu.org; Tue, 02 Feb 2010 05:08:51 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NcFgf-0006zG-GU for qemu-devel@nongnu.org; Tue, 02 Feb 2010 05:08:49 -0500 Received: from tx2ehsobe004.messaging.microsoft.com ([65.55.88.14]:49466 helo=TX2EHSOBE007.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.60) (envelope-from ) id 1NcFga-0006vT-LO for qemu-devel@nongnu.org; Tue, 02 Feb 2010 05:08:44 -0500 Received: from mail115-tx2-R.bigfish.com (10.9.14.237) by TX2EHSOBE007.bigfish.com (10.9.40.27) with Microsoft SMTP Server id 8.1.340.0; Tue, 2 Feb 2010 10:08:39 +0000 Received: from mail115-tx2 (localhost [127.0.0.1]) by mail115-tx2-R.bigfish.com (Postfix) with ESMTP id 2A1F511A0797; Tue, 2 Feb 2010 10:08:39 +0000 (UTC) X-SpamScore: -2 X-BigFish: VPS-2(zzab9bh936eMzz1202hzzz32i6bh43j62h) Received: from mail115-tx2 (localhost.localdomain [127.0.0.1]) by mail115-tx2 (MessageSwitch) id 1265105312849317_16061; Tue, 2 Feb 2010 10:08:32 +0000 (UTC) Received: from TX2EHSMHS038.bigfish.com (unknown [10.9.14.253]) by mail115-tx2.bigfish.com (Postfix) with ESMTP id 916387280EC; Tue, 2 Feb 2010 10:08:23 +0000 (UTC) Received: from ausb3extmailp01.amd.com (163.181.251.8) by TX2EHSMHS038.bigfish.com (10.9.99.138) with Microsoft SMTP Server (TLS) id 14.0.482.39; Tue, 2 Feb 2010 10:08:22 +0000 Received: from ausb3twp01.amd.com ([163.181.250.37]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id o12AA11o015731; Tue, 2 Feb 2010 04:10:05 -0600 X-WSS-ID: 0KX7LHU-01-GSW-02 X-M-MSG: Received: from sausexbh1.amd.com (sausexbh1.amd.com [163.181.22.101]) by ausb3twp01.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2CEAB102875A; Tue, 2 Feb 2010 04:08:18 -0600 (CST) Received: from sausexmb1.amd.com ([163.181.3.156]) by sausexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 2 Feb 2010 04:08:21 -0600 Received: from seurexmb1.amd.com ([165.204.9.130]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 2 Feb 2010 04:08:21 -0600 Received: from gwo.osrc.amd.com ([165.204.16.204]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 2 Feb 2010 11:08:19 +0100 Received: from localhost.localdomain (tronje.osrc.amd.com [165.204.15.48]) by gwo.osrc.amd.com (Postfix) with ESMTP id 734B149C107; Tue, 2 Feb 2010 10:08:38 +0000 (GMT) From: Andre Przywara To: qemu-devel@nongnu.org Date: Tue, 2 Feb 2010 11:08:11 +0100 Message-ID: <1265105301-3455-4-git-send-email-andre.przywara@amd.com> X-Mailer: git-send-email 1.6.4 In-Reply-To: <1265105301-3455-1-git-send-email-andre.przywara@amd.com> References: <1265105301-3455-1-git-send-email-andre.przywara@amd.com> X-OriginalArrivalTime: 02 Feb 2010 10:08:19.0603 (UTC) FILETIME=[A51B6E30:01CAA3EF] MIME-Version: 1.0 X-Reverse-DNS: unknown X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ Cc: john.cooper@redhat.com, Andre Przywara Subject: [Qemu-devel] [PATCH 03/13] cpuid: moved host_cpuid function and remove prototype X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org the host_cpuid function was located at the end of the file and had a prototype before it's first use. Move it up and remove the prototype. Signed-off-by: Andre Przywara Acked-by: Aurelien Jarno --- target-i386/cpuid.c | 70 ++++++++++++++++++++++++-------------------------- 1 files changed, 34 insertions(+), 36 deletions(-) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index 0a17020..cc080f4 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -338,8 +338,40 @@ static x86_def_t x86_defs[] = { }, }; -static void host_cpuid(uint32_t function, uint32_t count, uint32_t *eax, - uint32_t *ebx, uint32_t *ecx, uint32_t *edx); +static void host_cpuid(uint32_t function, uint32_t count, + uint32_t *eax, uint32_t *ebx, + uint32_t *ecx, uint32_t *edx) +{ +#if defined(CONFIG_KVM) + uint32_t vec[4]; + +#ifdef __x86_64__ + asm volatile("cpuid" + : "=a"(vec[0]), "=b"(vec[1]), + "=c"(vec[2]), "=d"(vec[3]) + : "0"(function), "c"(count) : "cc"); +#else + asm volatile("pusha \n\t" + "cpuid \n\t" + "mov %%eax, 0(%2) \n\t" + "mov %%ebx, 4(%2) \n\t" + "mov %%ecx, 8(%2) \n\t" + "mov %%edx, 12(%2) \n\t" + "popa" + : : "a"(function), "c"(count), "S"(vec) + : "memory", "cc"); +#endif + + if (eax) + *eax = vec[0]; + if (ebx) + *ebx = vec[1]; + if (ecx) + *ecx = vec[2]; + if (edx) + *edx = vec[3]; +#endif +} static int cpu_x86_fill_model_id(char *str) { @@ -578,40 +610,6 @@ int cpu_x86_register (CPUX86State *env, const char *cpu_model) return 0; } -static void host_cpuid(uint32_t function, uint32_t count, - uint32_t *eax, uint32_t *ebx, - uint32_t *ecx, uint32_t *edx) -{ -#if defined(CONFIG_KVM) - uint32_t vec[4]; - -#ifdef __x86_64__ - asm volatile("cpuid" - : "=a"(vec[0]), "=b"(vec[1]), - "=c"(vec[2]), "=d"(vec[3]) - : "0"(function), "c"(count) : "cc"); -#else - asm volatile("pusha \n\t" - "cpuid \n\t" - "mov %%eax, 0(%2) \n\t" - "mov %%ebx, 4(%2) \n\t" - "mov %%ecx, 8(%2) \n\t" - "mov %%edx, 12(%2) \n\t" - "popa" - : : "a"(function), "c"(count), "S"(vec) - : "memory", "cc"); -#endif - - if (eax) - *eax = vec[0]; - if (ebx) - *ebx = vec[1]; - if (ecx) - *ecx = vec[2]; - if (edx) - *edx = vec[3]; -#endif -} static void get_cpuid_vendor(CPUX86State *env, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)