diff options
author | rubidium <rubidium@openttd.org> | 2014-01-03 13:29:12 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-01-03 13:29:12 +0000 |
commit | e6fc55b07b7adba8c1880f967dfd119f2a7c8faf (patch) | |
tree | c8c10c0e7cdac3ac83c60fb7aba59381aa683506 /src | |
parent | a325c335784004967ff38c6eed34b2bc53b621e8 (diff) | |
download | openttd-e6fc55b07b7adba8c1880f967dfd119f2a7c8faf.tar.xz |
(svn r26219) -Fix: cpuid code still didn't work right in some situations
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/cpu.cpp b/src/cpu.cpp index b1d1c328f..e6a8656c2 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -98,20 +98,11 @@ void ottd_cpuid(int info[4], int type) { /* The easy variant would be just cpuid, however... ebx gets clobbered by PIC. */ __asm__ __volatile__ ( -#if defined(__x86_64__) - "pushq %%rbx \n\t" // save %rbx -#else - "pushl %%ebx \n\t" // save %ebx -#endif - "cpuid \n\t" - "movl %%ebx, %1 \n\t" // write the result into output var -#if defined(__x86_64__) - "popq %%rbx \n\t" // restore %rbx -#else - "popl %%ebx \n\t" // restore %ebc -#endif + "xchgl %%ebx, %1 \n\t" + "cpuid \n\t" + "xchgl %%ebx, %1 \n\t" : "=a" (info[0]), "=r" (info[1]), "=c" (info[2]), "=d" (info[3]) - : "a" (type) + : "0" (type) ); } #else |