Mercurial > sdl-ios-xcode
comparison src/cpuinfo/SDL_cpuinfo.c @ 3515:d94e331e85fa
Missing pop over a jump
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 03 Dec 2009 04:33:05 +0000 |
parents | 4cf8a1423d57 |
children | 3427271a2d75 |
comparison
equal
deleted
inserted
replaced
3514:f0b7bc1fe12d | 3515:d94e331e85fa |
---|---|
154 #if defined(__GNUC__) && defined(i386) | 154 #if defined(__GNUC__) && defined(i386) |
155 __asm__ ( | 155 __asm__ ( |
156 " xorl %%eax,%%eax # Set up for CPUID instruction \n" | 156 " xorl %%eax,%%eax # Set up for CPUID instruction \n" |
157 " pushl %%ebx \n" | 157 " pushl %%ebx \n" |
158 " cpuid # Get and save vendor ID \n" | 158 " cpuid # Get and save vendor ID \n" |
159 " popl %%ebx \n" | |
159 " cmpl $1,%%eax # Make sure 1 is valid input for CPUID\n" | 160 " cmpl $1,%%eax # Make sure 1 is valid input for CPUID\n" |
160 " jl 1f # We dont have the CPUID instruction\n" | 161 " jl 1f # We dont have the CPUID instruction\n" |
161 " xorl %%eax,%%eax \n" | 162 " xorl %%eax,%%eax \n" |
162 " incl %%eax \n" | 163 " incl %%eax \n" |
164 " pushl %%ebx \n" | |
163 " cpuid # Get family/model/stepping/features\n" | 165 " cpuid # Get family/model/stepping/features\n" |
164 " popl %%ebx \n" | 166 " popl %%ebx \n" |
165 " movl %%edx,%0 \n" | 167 " movl %%edx,%0 \n" |
166 "1: \n" | 168 "1: \n" |
167 : "=m" (features) | 169 : "=m" (features) |
169 : "%eax", "%ecx", "%edx" | 171 : "%eax", "%ecx", "%edx" |
170 ); | 172 ); |
171 #elif defined(__GNUC__) && defined(__x86_64__) | 173 #elif defined(__GNUC__) && defined(__x86_64__) |
172 __asm__ ( | 174 __asm__ ( |
173 " xorl %%eax,%%eax # Set up for CPUID instruction \n" | 175 " xorl %%eax,%%eax # Set up for CPUID instruction \n" |
174 " pushq %%rbx\n" | 176 " pushq %%rbx \n" |
175 " cpuid # Get and save vendor ID \n" | 177 " cpuid # Get and save vendor ID \n" |
178 " popq %%rbx \n" | |
176 " cmpl $1,%%eax # Make sure 1 is valid input for CPUID\n" | 179 " cmpl $1,%%eax # Make sure 1 is valid input for CPUID\n" |
177 " jl 1f # We dont have the CPUID instruction\n" | 180 " jl 1f # We dont have the CPUID instruction\n" |
178 " xorl %%eax,%%eax \n" | 181 " xorl %%eax,%%eax \n" |
179 " incl %%eax \n" | 182 " incl %%eax \n" |
183 " pushq %%rbx \n" | |
180 " cpuid # Get family/model/stepping/features\n" | 184 " cpuid # Get family/model/stepping/features\n" |
181 " popq %%rbx\n" | 185 " popq %%rbx \n" |
182 " movl %%edx,%0 \n" | 186 " movl %%edx,%0 \n" |
183 "1: \n" | 187 "1: \n" |
184 : "=m" (features) | 188 : "=m" (features) |
185 : | 189 : |
186 : "%rax", "%rcx", "%rdx" | 190 : "%rax", "%rcx", "%rdx" |
188 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) | 192 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) |
189 __asm { | 193 __asm { |
190 xor eax, eax ; Set up for CPUID instruction | 194 xor eax, eax ; Set up for CPUID instruction |
191 push ebx | 195 push ebx |
192 cpuid ; Get and save vendor ID | 196 cpuid ; Get and save vendor ID |
197 pop ebx | |
193 cmp eax, 1 ; Make sure 1 is valid input for CPUID | 198 cmp eax, 1 ; Make sure 1 is valid input for CPUID |
194 jl done ; We dont have the CPUID instruction | 199 jl done ; We dont have the CPUID instruction |
195 xor eax, eax | 200 xor eax, eax |
196 inc eax | 201 inc eax |
202 push ebx | |
197 cpuid ; Get family/model/stepping/features | 203 cpuid ; Get family/model/stepping/features |
198 pop ebx | 204 pop ebx |
199 mov features, edx | 205 mov features, edx |
200 done: | 206 done: |
201 } | 207 } |
202 #elif defined(__sun) && (defined(__i386) || defined(__amd64)) | 208 #elif defined(__sun) && (defined(__i386) || defined(__amd64)) |
203 __asm( | 209 __asm( |
204 " xorl %eax,%eax \n" | 210 " xorl %eax,%eax \n" |
205 " pushl %ebx \n" | 211 " pushl %ebx \n" |
206 " cpuid \n" | 212 " cpuid \n" |
213 " popl %ebx \n" | |
207 " cmpl $1,%eax \n" | 214 " cmpl $1,%eax \n" |
208 " jl 1f \n" | 215 " jl 1f \n" |
209 " xorl %eax,%eax \n" | 216 " xorl %eax,%eax \n" |
210 " incl %eax \n" | 217 " incl %eax \n" |
218 " pushl %ebx \n" | |
211 " cpuid \n" | 219 " cpuid \n" |
212 " popl %ebx \n" | 220 " popl %ebx \n" |
213 #ifdef __i386 | 221 #ifdef __i386 |
214 " movl %edx,-8(%ebp) \n" | 222 " movl %edx,-8(%ebp) \n" |
215 #else | 223 #else |
229 #if defined(__GNUC__) && defined(i386) | 237 #if defined(__GNUC__) && defined(i386) |
230 __asm__ ( | 238 __asm__ ( |
231 " movl $0x80000000,%%eax # Query for extended functions \n" | 239 " movl $0x80000000,%%eax # Query for extended functions \n" |
232 " pushl %%ebx \n" | 240 " pushl %%ebx \n" |
233 " cpuid # Get extended function limit \n" | 241 " cpuid # Get extended function limit \n" |
242 " popl %%ebx \n" | |
234 " cmpl $0x80000001,%%eax \n" | 243 " cmpl $0x80000001,%%eax \n" |
235 " jl 1f # Nope, we dont have function 800000001h\n" | 244 " jl 1f # Nope, we dont have function 800000001h\n" |
236 " movl $0x80000001,%%eax # Setup extended function 800000001h\n" | 245 " movl $0x80000001,%%eax # Setup extended function 800000001h\n" |
246 " pushl %%ebx \n" | |
237 " cpuid # and get the information \n" | 247 " cpuid # and get the information \n" |
238 " popl %%ebx \n" | 248 " popl %%ebx \n" |
239 " movl %%edx,%0 \n" | 249 " movl %%edx,%0 \n" |
240 "1: \n" | 250 "1: \n" |
241 : "=m" (features) | 251 : "=m" (features) |
245 #elif defined(__GNUC__) && defined (__x86_64__) | 255 #elif defined(__GNUC__) && defined (__x86_64__) |
246 __asm__ ( | 256 __asm__ ( |
247 " movl $0x80000000,%%eax # Query for extended functions \n" | 257 " movl $0x80000000,%%eax # Query for extended functions \n" |
248 " pushq %%rbx \n" | 258 " pushq %%rbx \n" |
249 " cpuid # Get extended function limit \n" | 259 " cpuid # Get extended function limit \n" |
260 " popq %%rbx \n" | |
250 " cmpl $0x80000001,%%eax \n" | 261 " cmpl $0x80000001,%%eax \n" |
251 " jl 1f # Nope, we dont have function 800000001h\n" | 262 " jl 1f # Nope, we dont have function 800000001h\n" |
252 " movl $0x80000001,%%eax # Setup extended function 800000001h\n" | 263 " movl $0x80000001,%%eax # Setup extended function 800000001h\n" |
264 " pushq %%rbx \n" | |
253 " cpuid # and get the information \n" | 265 " cpuid # and get the information \n" |
254 " popq %%rbx \n" | 266 " popq %%rbx \n" |
255 " movl %%edx,%0 \n" | 267 " movl %%edx,%0 \n" |
256 "1: \n" | 268 "1: \n" |
257 : "=m" (features) | 269 : "=m" (features) |
261 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) | 273 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) |
262 __asm { | 274 __asm { |
263 mov eax,80000000h ; Query for extended functions | 275 mov eax,80000000h ; Query for extended functions |
264 push ebx | 276 push ebx |
265 cpuid ; Get extended function limit | 277 cpuid ; Get extended function limit |
278 pop ebx | |
266 cmp eax,80000001h | 279 cmp eax,80000001h |
267 jl done ; Nope, we dont have function 800000001h | 280 jl done ; Nope, we dont have function 800000001h |
268 mov eax,80000001h ; Setup extended function 800000001h | 281 mov eax,80000001h ; Setup extended function 800000001h |
282 push ebx | |
269 cpuid ; and get the information | 283 cpuid ; and get the information |
270 pop ebx | 284 pop ebx |
271 mov features,edx | 285 mov features,edx |
272 done: | 286 done: |
273 } | 287 } |
274 #elif defined(__sun) && ( defined(__i386) || defined(__amd64) ) | 288 #elif defined(__sun) && ( defined(__i386) || defined(__amd64) ) |
275 __asm ( | 289 __asm ( |
276 " movl $0x80000000,%eax \n" | 290 " movl $0x80000000,%eax \n" |
277 " pushl %ebx \n" | 291 " pushl %ebx \n" |
278 " cpuid \n" | 292 " cpuid \n" |
293 " popl %ebx \n" | |
279 " cmpl $0x80000001,%eax \n" | 294 " cmpl $0x80000001,%eax \n" |
280 " jl 1f \n" | 295 " jl 1f \n" |
281 " movl $0x80000001,%eax \n" | 296 " movl $0x80000001,%eax \n" |
297 " pushl %ebx \n" | |
282 " cpuid \n" | 298 " cpuid \n" |
283 " popl %ebx \n" | 299 " popl %ebx \n" |
284 #ifdef __i386 | 300 #ifdef __i386 |
285 " movl %edx,-8(%ebp) \n" | 301 " movl %edx,-8(%ebp) \n" |
286 #else | 302 #else |