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 // 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. // restored at the end of the asm block.
__asm__ ( __asm__ (
"pushq %%rbx;"
"cpuid;" "cpuid;"
"movl %%ebx,%1;" "movl %%ebx,%1;"
"popq %%rbx;"
: "=a" (*eax), : "=a" (*eax),
"=S" (*ebx), "=S" (*ebx),
"=c" (*ecx), "=c" (*ecx),
"=d" (*edx) "=d" (*edx)
: "a" (*eax) : "a" (*eax)
: "rbx"
); );
#else #else
__asm__ ( __asm__ (
"pushl %%ebx;"
"cpuid;" "cpuid;"
"movl %%ebx,%1;" "movl %%ebx,%1;"
"popl %%ebx;"
: "=a" (*eax), : "=a" (*eax),
"=S" (*ebx), "=S" (*ebx),
"=c" (*ecx), "=c" (*ecx),
"=d" (*edx) "=d" (*edx)
: "a" (*eax) : "a" (*eax)
: "ebx"
); );
#endif #endif
} }