aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-02-24 18:48:54 +0000
committerKeir Fraser <keir.fraser@citrix.com>2010-02-24 18:48:54 +0000
commit80b4a3ebc3c6a6a0058452e36fdbc2f7c383d877 (patch)
tree19865e13b586855b97d0f8b8e3a3e8aff61e34e4
parentcd341a3465ecd2aa72a0a0c9c676f68708b399cb (diff)
downloadxen-80b4a3ebc3c6a6a0058452e36fdbc2f7c383d877.tar.gz
xen-80b4a3ebc3c6a6a0058452e36fdbc2f7c383d877.tar.bz2
xen-80b4a3ebc3c6a6a0058452e36fdbc2f7c383d877.zip
libxc: Fix cpuid() inline asm.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
-rw-r--r--tools/libxc/xc_cpuid_x86.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 13b3c78fa0..4df212ebbe 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -43,12 +43,21 @@ static void cpuid(const unsigned int *input, unsigned int *regs)
unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1];
asm (
#ifdef __i386__
- "push %%ebx; cpuid; mov %%ebx,%1; pop %%ebx"
+ "push %%ebx; push %%edx\n\t"
#else
- "push %%rbx; cpuid; mov %%ebx,%1; pop %%rbx"
+ "push %%rbx; push %%rdx\n\t"
#endif
- : "=a" (regs[0]), "=r" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
- : "0" (input[0]), "2" (count) );
+ "cpuid\n\t"
+ "mov %%ebx,4(%4)\n\t"
+ "mov %%edx,12(%4)\n\t"
+#ifdef __i386__
+ "pop %%edx; pop %%ebx\n\t"
+#else
+ "pop %%rdx; pop %%rbx\n\t"
+#endif
+ : "=a" (regs[0]), "=c" (regs[2])
+ : "0" (input[0]), "1" (count), "S" (regs)
+ : "memory" );
}
/* Get the manufacturer brand name of the host processor. */