aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-11-27 11:13:01 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-28 08:42:56 -0600
commita1fd24af4d4d5f96283ba48e7b1e83ffe3b72273 (patch)
tree3bc33a3ab3b10757470120e555a273a45bc47cd7
parentbc75c9e50d308b2ec6623a40179c5cdc84b63dae (diff)
downloadqemu-arm-a1fd24af4d4d5f96283ba48e7b1e83ffe3b72273.tar.gz
Revert "i386: derive '-cpu host' from KVM_GET_SUPPORTED_CPUID"
This reverts commit 66e3dd9282141b5ae75637c9676002cf3ceeb988. From Avi, "Anthony, I think we should revert that commit and refactor cpuid for 1.1. The logic is spread over too many places which makes it hard to reason about." Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--target-i386/cpuid.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 21e589675c..9fc9769edd 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -107,14 +107,33 @@ 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 = kvm_arch_get_supported_cpuid(kvm_state, function, count, R_EAX);
+ *eax = vec[0];
if (ebx)
- *ebx = kvm_arch_get_supported_cpuid(kvm_state, function, count, R_EBX);
+ *ebx = vec[1];
if (ecx)
- *ecx = kvm_arch_get_supported_cpuid(kvm_state, function, count, R_ECX);
+ *ecx = vec[2];
if (edx)
- *edx = kvm_arch_get_supported_cpuid(kvm_state, function, count, R_EDX);
+ *edx = vec[3];
#endif
}