[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 05/21] cpuid: moved host_cpuid function and remov
From: |
Andre Przywara |
Subject: |
[Qemu-devel] [PATCH v2 05/21] cpuid: moved host_cpuid function and remove prototype |
Date: |
Fri, 18 Sep 2009 13:47:58 +0200 |
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 bdc8fe0..fca4ba6 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -318,8 +318,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)
{
@@ -551,41 +583,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
-}
-
void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
uint32_t *eax, uint32_t *ebx,
uint32_t *ecx, uint32_t *edx)
--
1.6.1.3
- [Qemu-devel] [PATCH v2 10/21] cpuid: simplify CPUID flag search function, (continued)
- [Qemu-devel] [PATCH v2 10/21] cpuid: simplify CPUID flag search function, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 09/21] cpuid: remove unnecessary kvm_trim function, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 13/21] cpuid: add TCG feature bit trimming, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 08/21] cpuid: list all known x86 CPUID feature flags, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 15/21] cpuid: Adjust feature bit constants, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 16/21] cpuid: Update qemu64/32 CPU models, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 14/21] cpuid: decrease L2 cache for Intel and add comments, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 01/21] cpuid: move CPUID functions into separate file, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 20/21] cpuid: Add kvm32 CPU model, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 12/21] cpuid: Fix multicore setup on Intel, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 05/21] cpuid: moved host_cpuid function and remove prototype,
Andre Przywara <=
- [Qemu-devel] [PATCH v2 17/21] cpuid: Fix CPU models to use new feature set names, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 03/21] cpuid: replace magic number with named constant, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 19/21] cpuid: Add athlon64 CPU model, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 21/21] cpuid: Always expose 32 and 64-bit CPUs, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 18/21] cpuid: Fix 486 CPU model, Andre Przywara, 2009/09/18
- [Qemu-devel] [PATCH v2 11/21] cpuid: propagate further CPUID leafs when -cpu host, Andre Przywara, 2009/09/18