changeset 3587:2080e8d75ac6

Implemented 64-bit version of cpuid code
author Sam Lantinga <slouken@libsdl.org>
date Thu, 17 Dec 2009 04:01:29 +0000
parents b6758aee0dd4
children c5fe76962106
files src/cpuinfo/SDL_cpuinfo.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpuinfo/SDL_cpuinfo.c	Thu Dec 17 03:04:04 2009 +0000
+++ b/src/cpuinfo/SDL_cpuinfo.c	Thu Dec 17 04:01:29 2009 +0000
@@ -157,7 +157,7 @@
     return has_CPUID;
 }
 
-#if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
+#if defined(__GNUC__) && defined(i386)
 #define cpuid(func, a, b, c, d) \
     __asm__ __volatile__ ( \
 "        pushl %%ebx        \n" \
@@ -165,6 +165,14 @@
 "        movl %%ebx, %%esi  \n" \
 "        popl %%ebx         \n" : \
             "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func))
+#elif defined(__GNUC__) && defined(__x86_64__)
+#define cpuid(func, a, b, c, d) \
+    __asm__ __volatile__ ( \
+"        pushq %%rbx        \n" \
+"        cpuid              \n" \
+"        movq %%rbx, %%rsi  \n" \
+"        popq %%rbx         \n" : \
+            "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func))
 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
 #define cpuid(func, a, b, c, d) \
     __asm { \