debuggers.hg

changeset 21022:f8692cc67d67

libxc: Fix cpuid() inline asm.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 24 18:48:54 2010 +0000 (2010-02-24)
parents 9c0793e75f54
children e4851c5b7d00
files tools/libxc/xc_cpuid_x86.c
line diff
     1.1 --- a/tools/libxc/xc_cpuid_x86.c	Wed Feb 24 11:03:56 2010 +0000
     1.2 +++ b/tools/libxc/xc_cpuid_x86.c	Wed Feb 24 18:48:54 2010 +0000
     1.3 @@ -43,12 +43,21 @@ static void cpuid(const unsigned int *in
     1.4      unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1];
     1.5      asm (
     1.6  #ifdef __i386__
     1.7 -        "push %%ebx; cpuid; mov %%ebx,%1; pop %%ebx"
     1.8 +        "push %%ebx; push %%edx\n\t"
     1.9  #else
    1.10 -        "push %%rbx; cpuid; mov %%ebx,%1; pop %%rbx"
    1.11 +        "push %%rbx; push %%rdx\n\t"
    1.12  #endif
    1.13 -        : "=a" (regs[0]), "=r" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
    1.14 -        : "0" (input[0]), "2" (count) );
    1.15 +        "cpuid\n\t"
    1.16 +        "mov %%ebx,4(%4)\n\t"
    1.17 +        "mov %%edx,12(%4)\n\t"
    1.18 +#ifdef __i386__
    1.19 +        "pop %%edx; pop %%ebx\n\t"
    1.20 +#else
    1.21 +        "pop %%rdx; pop %%rbx\n\t"
    1.22 +#endif
    1.23 +        : "=a" (regs[0]), "=c" (regs[2])
    1.24 +        : "0" (input[0]), "1" (count), "S" (regs)
    1.25 +        : "memory" );
    1.26  }
    1.27  
    1.28  /* Get the manufacturer brand name of the host processor. */