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,19 +23,18 @@
|
||||||
//#include <config/i386/cpuid.h>
|
//#include <config/i386/cpuid.h>
|
||||||
#include <xmmintrin.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,
|
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||||
unsigned int *ecx, unsigned int *edx)
|
unsigned int *ecx, unsigned int *edx)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef _LP64
|
||||||
__asm__("cpuid"
|
__asm__("cpuid"
|
||||||
: "=a" (*eax),
|
: "=a" (*eax),
|
||||||
"=b" (*ebx),
|
"=b" (*ebx),
|
||||||
"=c" (*ecx),
|
"=c" (*ecx),
|
||||||
"=d" (*edx));
|
"=d" (*edx));
|
||||||
#else
|
#else
|
||||||
// Note: EBX is reserved on Mac OS X, so it has to be restored at the end
|
// Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to be
|
||||||
// of the asm block.
|
// restored at the end of the asm block.
|
||||||
__asm__(
|
__asm__(
|
||||||
"pushl %%ebx;"
|
"pushl %%ebx;"
|
||||||
"cpuid;"
|
"cpuid;"
|
||||||
|
|
Loading…
Reference in New Issue