comparison src/cpuinfo/SDL_cpuinfo.c @ 3421:7bc83a9e09fd

cpuid doesn't actually change the flags register
author Sam Lantinga <slouken@libsdl.org>
date Fri, 30 Oct 2009 05:02:47 +0000
parents 935f36ec1844
children a4ce84c4f211
comparison
equal deleted inserted replaced
3420:935f36ec1844 3421:7bc83a9e09fd
164 " movl %%edx,%0 \n" 164 " movl %%edx,%0 \n"
165 "1: \n" 165 "1: \n"
166 " popl %%ebx\n" 166 " popl %%ebx\n"
167 : "=m" (features) 167 : "=m" (features)
168 : 168 :
169 : "%eax", "%ecx", "%edx", "cc" 169 : "%eax", "%ecx", "%edx"
170 ); 170 );
171 #elif defined(__GNUC__) && defined(__x86_64__) 171 #elif defined(__GNUC__) && defined(__x86_64__)
172 __asm__ ( 172 __asm__ (
173 " pushq %%rbx\n" 173 " pushq %%rbx\n"
174 " xorl %%eax,%%eax # Set up for CPUID instruction \n" 174 " xorl %%eax,%%eax # Set up for CPUID instruction \n"
181 " movl %%edx,%0 \n" 181 " movl %%edx,%0 \n"
182 "1: \n" 182 "1: \n"
183 " popq %%rbx\n" 183 " popq %%rbx\n"
184 : "=m" (features) 184 : "=m" (features)
185 : 185 :
186 : "%rax", "%rcx", "%rdx", "cc" 186 : "%rax", "%rcx", "%rdx"
187 ); 187 );
188 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) 188 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
189 __asm { 189 __asm {
190 xor eax, eax ; Set up for CPUID instruction 190 xor eax, eax ; Set up for CPUID instruction
191 cpuid ; Get and save vendor ID 191 cpuid ; Get and save vendor ID
236 " movl %%edx,%0 \n" 236 " movl %%edx,%0 \n"
237 "1: \n" 237 "1: \n"
238 " popl %%ebx\n" 238 " popl %%ebx\n"
239 : "=m" (features) 239 : "=m" (features)
240 : 240 :
241 : "%eax", "%ecx", "%edx", "cc" 241 : "%eax", "%ecx", "%edx"
242 ); 242 );
243 #elif defined(__GNUC__) && defined (__x86_64__) 243 #elif defined(__GNUC__) && defined (__x86_64__)
244 __asm__ ( 244 __asm__ (
245 " pushq %%rbx\n" 245 " pushq %%rbx\n"
246 " movl $0x80000000,%%eax # Query for extended functions \n" 246 " movl $0x80000000,%%eax # Query for extended functions \n"
252 " movl %%edx,%0 \n" 252 " movl %%edx,%0 \n"
253 "1: \n" 253 "1: \n"
254 " popq %%rbx\n" 254 " popq %%rbx\n"
255 : "=m" (features) 255 : "=m" (features)
256 : 256 :
257 : "%rax", "%rcx", "%rdx", "cc" 257 : "%rax", "%rcx", "%rdx"
258 ); 258 );
259 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) 259 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
260 __asm { 260 __asm {
261 mov eax,80000000h ; Query for extended functions 261 mov eax,80000000h ; Query for extended functions
262 cpuid ; Get extended function limit 262 cpuid ; Get extended function limit