For CPUID, save EBX on the stack instead of in a register.
This fixes GCC running out of registers when compiling for x86 in release mode. Thanks to kiesel.
This commit is contained in:
parent
d75f45979b
commit
ee5a29e6f2
|
@ -43,29 +43,27 @@ 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__ (
|
||||||
"mov %%rbx,%%rdi;"
|
"pushq %%rbx;"
|
||||||
"cpuid;"
|
"cpuid;"
|
||||||
"movl %%ebx,%1;"
|
"movl %%ebx,%1;"
|
||||||
"mov %%rdi,%%rbx;"
|
"popq %%rbx;"
|
||||||
: "=a" (*eax),
|
: "=a" (*eax),
|
||||||
"=r" (*ebx),
|
"=S" (*ebx),
|
||||||
"=c" (*ecx),
|
"=c" (*ecx),
|
||||||
"=d" (*edx)
|
"=d" (*edx)
|
||||||
: "a" (*eax)
|
: "a" (*eax)
|
||||||
: "rdi", "rbx"
|
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
__asm__(
|
__asm__ (
|
||||||
"movl %%ebx,%%edi;"
|
"pushl %%ebx;"
|
||||||
"cpuid;"
|
"cpuid;"
|
||||||
"movl %%ebx,%1;"
|
"movl %%ebx,%1;"
|
||||||
"movl %%edi,%%ebx;"
|
"popl %%ebx;"
|
||||||
: "=a" (*eax),
|
: "=a" (*eax),
|
||||||
"=r" (*ebx),
|
"=S" (*ebx),
|
||||||
"=c" (*ecx),
|
"=c" (*ecx),
|
||||||
"=d" (*edx)
|
"=d" (*edx)
|
||||||
: "a" (*eax)
|
: "a" (*eax)
|
||||||
: "edi", "ebx"
|
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue