public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: qemu: CPUID takes ecx as input value for some functions
@ 2009-01-11 10:41 Amit Shah
  2009-01-11 10:46 ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Amit Shah @ 2009-01-11 10:41 UTC (permalink / raw)
  To: avi; +Cc: kvm, Amit Shah

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 <amit.shah@redhat.com>
---
 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 */
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-11 11:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-11 10:41 [PATCH] KVM: qemu: CPUID takes ecx as input value for some functions Amit Shah
2009-01-11 10:46 ` Avi Kivity
2009-01-11 10:57   ` Amit Shah
2009-01-11 11:23     ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox