mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(svn r26220) -Fix?: another attempt at getting cpuid to finally work "everywhere"
This commit is contained in:
parent
e6fc55b07b
commit
9947bdb0c4
10
src/cpu.cpp
10
src/cpu.cpp
@ -96,14 +96,22 @@ void ottd_cpuid(int info[4], int type)
|
|||||||
#elif defined(__x86_64__) || defined(__i386)
|
#elif defined(__x86_64__) || defined(__i386)
|
||||||
void ottd_cpuid(int info[4], int type)
|
void ottd_cpuid(int info[4], int type)
|
||||||
{
|
{
|
||||||
|
#if defined(__i386) && defined(__PIC__)
|
||||||
/* 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__ (
|
||||||
"xchgl %%ebx, %1 \n\t"
|
"xchgl %%ebx, %1 \n\t"
|
||||||
"cpuid \n\t"
|
"cpuid \n\t"
|
||||||
"xchgl %%ebx, %1 \n\t"
|
"xchgl %%ebx, %1 \n\t"
|
||||||
: "=a" (info[0]), "=r" (info[1]), "=c" (info[2]), "=d" (info[3])
|
: "=a" (info[0]), "=r" (info[1]), "=c" (info[2]), "=d" (info[3])
|
||||||
: "0" (type)
|
: "a" (type)
|
||||||
);
|
);
|
||||||
|
#else
|
||||||
|
__asm__ __volatile__ (
|
||||||
|
"cpuid \n\t"
|
||||||
|
: "=a" (info[0]), "=b" (info[1]), "=c" (info[2]), "=d" (info[3])
|
||||||
|
: "a" (type)
|
||||||
|
);
|
||||||
|
#endif /* i386 PIC */
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void ottd_cpuid(int info[4], int type)
|
void ottd_cpuid(int info[4], int type)
|
||||||
|
Loading…
Reference in New Issue
Block a user