Hi Amit,
On 26.12.2008, at 07:02, Amit Shah wrote:
host_cpuid is now available in target-i386/helper.c.
Remove the duplicated code now in kvm-specific code.
Signed-off-by: Amit Shah <[email protected]>
---
qemu/qemu-kvm-x86.c | 70
---------------------------------------------------
1 files changed, 0 insertions(+), 70 deletions(-)
diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index aa36be8..1bf86e1 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -451,39 +451,6 @@ void kvm_arch_save_regs(CPUState *env)
}
}
-static void host_cpuid(uint32_t function, uint32_t *eax, uint32_t
*ebx,
- uint32_t *ecx, uint32_t *edx)
-{
- uint32_t vec[4];
-
-#ifdef __x86_64__
- asm volatile("cpuid"
- : "=a"(vec[0]), "=b"(vec[1]),
- "=c"(vec[2]), "=d"(vec[3])
- : "0"(function) : "cc");
-#else
- asm volatile("pusha \n\t"
- "cpuid \n\t"
- "mov %%eax, 0(%1) \n\t"
- "mov %%ebx, 4(%1) \n\t"
- "mov %%ecx, 8(%1) \n\t"
- "mov %%edx, 12(%1) \n\t"
- "popa"
- : : "a"(function), "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];
-}
-
-
static void do_cpuid_ent(struct kvm_cpuid_entry *e, uint32_t function,
CPUState *env)
{
@@ -494,43 +461,6 @@ static void do_cpuid_ent(struct kvm_cpuid_entry
*e, uint32_t function,
e->ebx = env->regs[R_EBX];
e->ecx = env->regs[R_ECX];
e->edx = env->regs[R_EDX];
That looks a lot better, but I think we could easily do more!
do_cpuid_ent is only called twice like this:
do_cpuid_ent(&cpuid_ent[cpuid_nent++], i, ©);
We can replace that with:
e->eax = i;
struct kvm_cpuid_entry *e = &cpuid_ent[cpuid_nent++];
cpu_x86_cpuid(©, &e->eax, &e->ebx, &e->ecx, &e->edx);
The same could be done for qemu_kvm_cpuid_on_env. Then we can get rid
of qemu-kvm-helper.c too :-).
Alex
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html