Common: Change cpuid code again
Looks like compilers tend to use EBX for parameters if not told otherwise and don't bother to update SP in leaf functions, so PUSH/POP kill local variables. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7151 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
94176c02a8
commit
e81ccd7f33
|
@ -38,28 +38,30 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
|
|||
#ifdef _LP64
|
||||
// Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to
|
||||
// restored at the end of the asm block.
|
||||
__asm__(
|
||||
"push %%rbx;"
|
||||
__asm__ (
|
||||
"mov %%rbx,%%rdi;"
|
||||
"cpuid;"
|
||||
"movl %%ebx,%1;"
|
||||
"pop %%rbx;"
|
||||
"mov %%rdi,%%rbx;"
|
||||
: "=a" (*eax),
|
||||
"=r" (*ebx),
|
||||
"=g" (*ebx),
|
||||
"=c" (*ecx),
|
||||
"=d" (*edx)
|
||||
: "a" (*eax)
|
||||
: "rdi", "rbx"
|
||||
);
|
||||
#else
|
||||
__asm__(
|
||||
"pushl %%ebx;"
|
||||
"movl %%ebx,%%edi;"
|
||||
"cpuid;"
|
||||
"movl %%ebx,%1;"
|
||||
"popl %%ebx;"
|
||||
"movl %%edi,%%ebx;"
|
||||
: "=a" (*eax),
|
||||
"=r" (*ebx),
|
||||
"=g" (*ebx),
|
||||
"=c" (*ecx),
|
||||
"=d" (*edx)
|
||||
: "a" (*eax)
|
||||
: "edi", "ebx"
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue