ia64/xen-unstable

changeset 17695:e64c3a8c60e1

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 <jk@tools.de>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed May 21 16:55:11 2008 +0100 (2008-05-21)
parents 36d9c5943b46
children 3ed3d0688fa8
files tools/libxc/xc_cpuid_x86.c
line diff
     1.1 --- a/tools/libxc/xc_cpuid_x86.c	Wed May 21 11:23:03 2008 +0100
     1.2 +++ b/tools/libxc/xc_cpuid_x86.c	Wed May 21 16:55:11 2008 +0100
     1.3 @@ -105,11 +105,14 @@ static void intel_xc_cpuid_policy(
     1.4  static void cpuid(const unsigned int *input, unsigned int *regs)
     1.5  {
     1.6      unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1];
     1.7 -    unsigned int bx_temp;
     1.8 -    asm ( "mov %%ebx,%4; cpuid; mov %%ebx,%1; mov %4,%%ebx"
     1.9 -          : "=a" (regs[0]), "=r" (regs[1]),
    1.10 -          "=c" (regs[2]), "=d" (regs[3]), "=m" (bx_temp)
    1.11 -          : "0" (input[0]), "2" (count) );
    1.12 +    asm (
    1.13 +#ifdef __i386__
    1.14 +        "push %%ebx; cpuid; mov %%ebx,%1; pop %%ebx"
    1.15 +#else
    1.16 +        "push %%rbx; cpuid; mov %%ebx,%1; pop %%rbx"
    1.17 +#endif
    1.18 +        : "=a" (regs[0]), "=r" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
    1.19 +        : "0" (input[0]), "2" (count) );
    1.20  }
    1.21  
    1.22  /* Get the manufacturer brand name of the host processor. */