mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r26219) -Fix: cpuid code still didn't work right in some situations
This commit is contained in:
parent
cfbf56d3b2
commit
bd282d2572
17
src/cpu.cpp
17
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. */
|
/* The easy variant would be just cpuid, however... ebx gets clobbered by PIC. */
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
#if defined(__x86_64__)
|
"xchgl %%ebx, %1 \n\t"
|
||||||
"pushq %%rbx \n\t" // save %rbx
|
"cpuid \n\t"
|
||||||
#else
|
"xchgl %%ebx, %1 \n\t"
|
||||||
"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
|
|
||||||
: "=a" (info[0]), "=r" (info[1]), "=c" (info[2]), "=d" (info[3])
|
: "=a" (info[0]), "=r" (info[1]), "=c" (info[2]), "=d" (info[3])
|
||||||
: "a" (type)
|
: "0" (type)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user