[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/13] x86/cpuid: moved host_cpuid function and remo
From: |
Andre Przywara |
Subject: |
[Qemu-devel] [PATCH 04/13] x86/cpuid: moved host_cpuid function and remove prototype |
Date: |
Thu, 11 Mar 2010 14:38:58 +0100 |
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 <address@hidden>
---
target-i386/cpuid.c | 71 ++++++++++++++++++++++++--------------------------
1 files changed, 34 insertions(+), 37 deletions(-)
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 1bceb4b..fa36942 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -92,8 +92,40 @@ typedef struct model_features_t {
int check_cpuid = 0;
int enforce_cpuid = 0;
-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
+}
#define iswhite(c) ((c) && ((c) <= ' ' || '~' < (c)))
@@ -896,41 +928,6 @@ void x86_cpudef_setup(void)
#endif
}
-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)
{
--
1.6.4
- [Qemu-devel] [PATCH 00/13] x86/cpuid: cleanups and fixes, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 03/13] x86/cpuid: fix missing feature set bits, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 06/13] x86/cpuid: add "host" to the list of supported CPU models, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 08/13] x86/cpuid: propagate further CPUID leafs when -cpu host, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 12/13] x86/cpuid: fix CPUID levels, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 09/13] x86/cpuid: add TCG feature bit trimming, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 04/13] x86/cpuid: moved host_cpuid function and remove prototype,
Andre Przywara <=
- [Qemu-devel] [PATCH 13/13] x86/cpuid: Update qemu64/32 CPU models, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 10/13] x86/cpuid: Always expose 32 and 64-bit CPUs, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 02/13] x86/cpuid: replace magic number with named constant, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 07/13] x86/cpuid: remove unnecessary kvm_trim function, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 01/13] x86/cpuid: move CPUID functions into separate file, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 05/13] x86/cpuid: add missing CPUID feature flag names, Andre Przywara, 2010/03/11
- [Qemu-devel] [PATCH 11/13] x86/cpuid: Add kvm32 CPU model, Andre Przywara, 2010/03/11
- Re: [Qemu-devel] [PATCH 00/13] x86/cpuid: cleanups and fixes, Aurelien Jarno, 2010/03/13