util: Fix cpuid invocation for x86_64.
authorJosé Fonseca <jfonseca@vmware.com>
Sun, 4 Oct 2009 11:49:31 +0000 (12:49 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sun, 4 Oct 2009 21:03:15 +0000 (22:03 +0100)
src/gallium/auxiliary/util/u_cpu_detect.c

index ecfb96138d6e0de374d9e95b4899c10fa10845b6..e26214cb918d34458ad439b7c5fbf0220bbfac5c 100644 (file)
@@ -336,22 +336,34 @@ cpuid(unsigned int ax, unsigned int *p)
 {
    int ret = -1;
 
-#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
-#if defined(PIPE_CC_GCC)
-   __asm __volatile
-      ("movl %%ebx, %%esi\n\t"
-       "cpuid\n\t"
-       "xchgl %%ebx, %%esi"
-       : "=a" (p[0]), "=S" (p[1]),
-       "=c" (p[2]), "=d" (p[3])
-       : "0" (ax));
-
+#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
+   __asm __volatile (
+     "movl %%ebx, %%esi\n\t"
+     "cpuid\n\t"
+     "xchgl %%ebx, %%esi"
+     : "=a" (p[0]),
+       "=S" (p[1]),
+       "=c" (p[2]),
+       "=d" (p[3])
+     : "0" (ax)
+   );
+   ret = 0;
+#elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)
+   __asm __volatile (
+     "movq %%rbx, %%rsi\n\t"
+     "cpuid\n\t"
+     "xchgq %%rbx, %%rsi"
+     : "=a" (p[0]),
+       "=S" (p[1]),
+       "=c" (p[2]),
+       "=d" (p[3])
+     : "0" (ax)
+   );
    ret = 0;
 #elif defined(PIPE_CC_MSVC)
    __cpuid(ax, p);
 
    ret = 0;
-#endif
 #endif
 
    return ret;