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:
parent
0d9e87da18
commit
59e93bff78
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue