Mercurial > sdl-ios-xcode
comparison src/cpuinfo/SDL_cpuinfo.c @ 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 | 1a4456a01995 |
comparison
equal
deleted
inserted
replaced
3586:b6758aee0dd4 | 3587:2080e8d75ac6 |
---|---|
155 #endif | 155 #endif |
156 /* *INDENT-ON* */ | 156 /* *INDENT-ON* */ |
157 return has_CPUID; | 157 return has_CPUID; |
158 } | 158 } |
159 | 159 |
160 #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__)) | 160 #if defined(__GNUC__) && defined(i386) |
161 #define cpuid(func, a, b, c, d) \ | 161 #define cpuid(func, a, b, c, d) \ |
162 __asm__ __volatile__ ( \ | 162 __asm__ __volatile__ ( \ |
163 " pushl %%ebx \n" \ | 163 " pushl %%ebx \n" \ |
164 " cpuid \n" \ | 164 " cpuid \n" \ |
165 " movl %%ebx, %%esi \n" \ | 165 " movl %%ebx, %%esi \n" \ |
166 " popl %%ebx \n" : \ | 166 " popl %%ebx \n" : \ |
167 "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func)) | |
168 #elif defined(__GNUC__) && defined(__x86_64__) | |
169 #define cpuid(func, a, b, c, d) \ | |
170 __asm__ __volatile__ ( \ | |
171 " pushq %%rbx \n" \ | |
172 " cpuid \n" \ | |
173 " movq %%rbx, %%rsi \n" \ | |
174 " popq %%rbx \n" : \ | |
167 "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func)) | 175 "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (func)) |
168 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) | 176 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) |
169 #define cpuid(func, a, b, c, d) \ | 177 #define cpuid(func, a, b, c, d) \ |
170 __asm { \ | 178 __asm { \ |
171 __asm mov eax, func \ | 179 __asm mov eax, func \ |