changeset 18534:cbcea803efa1

x86_64 only saves ebx, not rbx. Fix some potential compilation problem on amd64. Patch by Zuxy Meng
author gpoirier
date Wed, 17 May 2006 20:15:02 +0000
parents 6b92a27e247c
children 8e92dd0ff93a
files TOOLS/cpuinfo.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/TOOLS/cpuinfo.c	Wed May 17 17:29:06 2006 +0000
+++ b/TOOLS/cpuinfo.c	Wed May 17 20:15:02 2006 +0000
@@ -43,9 +43,17 @@
 cpuid(int func) {
   cpuid_regs_t regs;
 #define CPUID   ".byte 0x0f, 0xa2; "
+#ifdef __x86_64__
+  asm("mov %%rbx, %%rsi\n\t"
+#else
   asm("mov %%ebx, %%esi\n\t" 
+#endif
       CPUID"\n\t"
-      "xchg %%esi, %%ebx"
+#ifdef __x86_64__
+      "xchg %%rsi, %%rbx\n\t"
+#else
+      "xchg %%esi, %%ebx\n\t"
+#endif
       : "=a" (regs.eax), "=S" (regs.ebx), "=c" (regs.ecx), "=d" (regs.edx)
       : "0" (func));
   return regs;