From: Keir Fraser Date: Wed, 21 May 2008 15:55:11 +0000 (+0100) Subject: libxc, x86: Fix CPUID inline asm for x86/64. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14210^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2ce4e98c302d9836cbed22450cd6939a61f52c61;p=xen.git libxc, x86: Fix CPUID inline asm for x86/64. Must save all 64 bits of RBX, not just the EBX sub-part. Based on bug diagnosis and patch by Juergen Keil Signed-off-by: Keir Fraser --- diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index 2317b4d38d..febf97c607 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -105,11 +105,14 @@ static void intel_xc_cpuid_policy( static void cpuid(const unsigned int *input, unsigned int *regs) { unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1]; - unsigned int bx_temp; - asm ( "mov %%ebx,%4; cpuid; mov %%ebx,%1; mov %4,%%ebx" - : "=a" (regs[0]), "=r" (regs[1]), - "=c" (regs[2]), "=d" (regs[3]), "=m" (bx_temp) - : "0" (input[0]), "2" (count) ); + asm ( +#ifdef __i386__ + "push %%ebx; cpuid; mov %%ebx,%1; pop %%ebx" +#else + "push %%rbx; cpuid; mov %%ebx,%1; pop %%rbx" +#endif + : "=a" (regs[0]), "=r" (regs[1]), "=c" (regs[2]), "=d" (regs[3]) + : "0" (input[0]), "2" (count) ); } /* Get the manufacturer brand name of the host processor. */