Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Implemented 64-bit version of cpuid code
  • Loading branch information
slouken committed Dec 17, 2009
1 parent a6bfcec commit fa90aa1246b48571f2361114d24aac1f30492912
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/cpuinfo/SDL_cpuinfo.c
@@ -157,14 +157,22 @@ CPUid by definition. But it's nice to be able to prove it. :) */
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" \
" cpuid \n" \
" 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 { \

0 comments on commit fa90aa1

Please sign in to comment.