mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 21:35:28 +00:00
Fixed CPU detection on Mac OS X.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@225 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
2f55ee30be
commit
7962ab4713
@ -26,17 +26,23 @@
|
|||||||
// if you are on linux and this doesn't build, plz fix :)
|
// if you are on linux and this doesn't build, plz fix :)
|
||||||
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
|
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||||
unsigned int *ecx, unsigned int *edx)
|
unsigned int *ecx, unsigned int *edx)
|
||||||
{
|
{
|
||||||
__asm__("cpuid"
|
// Note: EBX is reserved on Mac OS X, so it has to be restored at the end
|
||||||
: "=a" (*eax),
|
// of the asm block.
|
||||||
"=b" (*ebx),
|
__asm__(
|
||||||
"=c" (*ecx),
|
"pushl %%ebx;"
|
||||||
"=d" (*edx));
|
"cpuid;"
|
||||||
|
"movl %%ebx,%1;"
|
||||||
|
"popl %%ebx;"
|
||||||
|
: "=a" (*eax),
|
||||||
|
"=r" (*ebx),
|
||||||
|
"=c" (*ecx),
|
||||||
|
"=d" (*edx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void __cpuid(int info[4], int x)
|
void __cpuid(int info[4], int x)
|
||||||
{
|
{
|
||||||
int eax = x, ebx = 0, ecx = 0, edx = 0;
|
unsigned int eax = x, ebx = 0, ecx = 0, edx = 0;
|
||||||
do_cpuid(&eax, &ebx, &ecx, &edx);
|
do_cpuid(&eax, &ebx, &ecx, &edx);
|
||||||
info[0] = eax;
|
info[0] = eax;
|
||||||
info[1] = ebx;
|
info[1] = ebx;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user