From: Alexander Graf <[EMAIL PROTECTED]> since qemu-kvm.c is no longer compiled with global register variables, we can switch to a simpler assembly sequence.
Signed-off-by: Alexander Graf <[EMAIL PROTECTED]> Signed-off-by: Avi Kivity <[EMAIL PROTECTED]> diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c index 37354fb..3af8625 100644 --- a/qemu/qemu-kvm-x86.c +++ b/qemu/qemu-kvm-x86.c @@ -427,36 +427,19 @@ static void host_cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, { uint32_t vec[4]; - vec[0] = function; - asm volatile ( #ifdef __x86_64__ - "sub $128, %%rsp \n\t" /* skip red zone */ - "push %0; push %%rsi \n\t" - "push %%rax; push %%rbx; push %%rcx; push %%rdx \n\t" - "mov 8*5(%%rsp), %%rsi \n\t" - "mov (%%rsi), %%eax \n\t" - "cpuid \n\t" - "mov %%eax, (%%rsi) \n\t" - "mov %%ebx, 4(%%rsi) \n\t" - "mov %%ecx, 8(%%rsi) \n\t" - "mov %%edx, 12(%%rsi) \n\t" - "pop %%rdx; pop %%rcx; pop %%rbx; pop %%rax \n\t" - "pop %%rsi; pop %0 \n\t" - "add $128, %%rsp" + asm volatile("cpuid" + : "=a"(vec[0]), "=b"(vec[1]), "=c"(vec[2]), "=d"(vec[3]) + : "0"(function)); #else - "push %0; push %%esi \n\t" - "push %%eax; push %%ebx; push %%ecx; push %%edx \n\t" - "mov 4*5(%%esp), %%esi \n\t" - "mov (%%esi), %%eax \n\t" - "cpuid \n\t" - "mov %%eax, (%%esi) \n\t" - "mov %%ebx, 4(%%esi) \n\t" - "mov %%ecx, 8(%%esi) \n\t" - "mov %%edx, 12(%%esi) \n\t" - "pop %%edx; pop %%ecx; pop %%ebx; pop %%eax \n\t" - "pop %%esi; pop %0 \n\t" + asm volatile("movl %%ebx, %%esi \n\t" + "cpuid \n\t" + "movl %%ebx, %1 \n\t" + "movl %%esi, %%ebx" + : "=a"(vec[0]), "=r"(vec[1]), "=c"(vec[2]), "=d"(vec[3]) + : "0"(function) + : "esi"); #endif - : : "rm"(vec) : "memory"); if (eax) *eax = vec[0]; if (ebx) ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-commits mailing list kvm-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-commits