From patchwork Sun Jan 11 10:41:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 1764 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0BAc2cp018652 for ; Sun, 11 Jan 2009 02:38:03 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750997AbZAKKlx (ORCPT ); Sun, 11 Jan 2009 05:41:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751088AbZAKKlx (ORCPT ); Sun, 11 Jan 2009 05:41:53 -0500 Received: from hera.kernel.org ([140.211.167.34]:41990 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750997AbZAKKlw (ORCPT ); Sun, 11 Jan 2009 05:41:52 -0500 Received: from hera.kernel.org (IDENT:U2FsdGVkX1/DesHyg48r/GWig16uKzM8jVuIo+szEEw@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n0BAfaja017941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 11 Jan 2009 10:41:36 GMT Received: (from amit@localhost) by hera.kernel.org (8.14.2/8.13.1/Submit) id n0BAfZmX017940; Sun, 11 Jan 2009 10:41:35 GMT From: Amit Shah To: avi@redhat.com Cc: kvm@vger.kernel.org, Amit Shah Subject: [PATCH] KVM: qemu: CPUID takes ecx as input value for some functions Date: Sun, 11 Jan 2009 10:41:35 +0000 Message-Id: <1231670495-17916-1-git-send-email-amit.shah@redhat.com> X-Mailer: git-send-email 1.6.0.2 X-Virus-Scanned: ClamAV 0.93.3/8850/Sat Jan 10 23:20:01 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Sun, 11 Jan 2009 10:41:38 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The CPUID instruction takes the value of ECX as an input parameter in addition to the value of EAX for function 4. Make sure we pass the value to the instruction. Signed-off-by: Amit Shah --- qemu/target-i386/helper.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/qemu/target-i386/helper.c b/qemu/target-i386/helper.c index cda0390..e468366 100644 --- a/qemu/target-i386/helper.c +++ b/qemu/target-i386/helper.c @@ -1387,7 +1387,7 @@ static void host_cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, asm volatile("cpuid" : "=a"(vec[0]), "=b"(vec[1]), "=c"(vec[2]), "=d"(vec[3]) - : "0"(function) : "cc"); + : "0"(function), "c"(*ecx) : "cc"); #else asm volatile("pusha \n\t" "cpuid \n\t" @@ -1396,7 +1396,7 @@ static void host_cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, "mov %%ecx, 8(%1) \n\t" "mov %%edx, 12(%1) \n\t" "popa" - : : "a"(function), "S"(vec) + : : "a"(function), "c"(*ecx), "S"(vec) : "memory", "cc"); #endif @@ -1483,7 +1483,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, *edx = 0; break; } - break; case 5: /* mwait info: needed for Core compatibility */ @@ -1526,9 +1525,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, *edx = env->cpuid_ext2_features; if (kvm_enabled()) { - uint32_t h_eax, h_edx; + uint32_t h_eax, h_edx, h_ecx; - host_cpuid(0x80000001, &h_eax, NULL, NULL, &h_edx); + host_cpuid(0x80000001, &h_eax, NULL, &h_ecx, &h_edx); /* disable CPU features that the host does not support */