The simple form of "cpuid" should work on 64-bit platforms; on 32-bit platforms it is safer to use the version that does not modify EBX.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@297 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
7151ec6f4f
commit
1b1f0ecae9
|
@ -23,24 +23,23 @@
|
|||
//#include <config/i386/cpuid.h>
|
||||
#include <xmmintrin.h>
|
||||
|
||||
// if you are on linux and this doesn't build, plz fix :)
|
||||
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||
unsigned int *ecx, unsigned int *edx)
|
||||
{
|
||||
#ifdef __linux__
|
||||
#ifdef _LP64
|
||||
__asm__("cpuid"
|
||||
: "=a" (*eax),
|
||||
"=b" (*ebx),
|
||||
"=c" (*ecx),
|
||||
"=d" (*edx));
|
||||
#else
|
||||
// Note: EBX is reserved on Mac OS X, so it has to be restored at the end
|
||||
// of the asm block.
|
||||
#else
|
||||
// Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to be
|
||||
// restored at the end of the asm block.
|
||||
__asm__(
|
||||
"pushl %%ebx;"
|
||||
"cpuid;"
|
||||
"movl %%ebx,%1;"
|
||||
"popl %%ebx;"
|
||||
"pushl %%ebx;"
|
||||
"cpuid;"
|
||||
"movl %%ebx,%1;"
|
||||
"popl %%ebx;"
|
||||
: "=a" (*eax),
|
||||
"=r" (*ebx),
|
||||
"=c" (*ecx),
|
||||
|
|
Loading…
Reference in New Issue