Fix a crash at startup with Dolphin on Linux compiled in debug mode

Use the clobber list instead of the stack to save rbx when executing the cpuid
instruction with inline assembly. This avoids breaking GCC assumptions about
the stack pointer location.
This commit is contained in:
Pierre Bourdon 2012-01-01 20:45:15 +01:00
parent 0d9e87da18
commit 59e93bff78
1 changed files with 2 additions and 4 deletions

View File

@ -43,27 +43,25 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
// 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__ (
"pushq %%rbx;"
"cpuid;"
"movl %%ebx,%1;"
"popq %%rbx;"
: "=a" (*eax),
"=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
: "rbx"
);
#else
__asm__ (
"pushl %%ebx;"
"cpuid;"
"movl %%ebx,%1;"
"popl %%ebx;"
: "=a" (*eax),
"=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
: "ebx"
);
#endif
}