Nasty hack: Fix cpu detection on 32 bit Linux, by tricking the optimizer into thinking it needs the values of reg[2] & [3]; which, in fact, it does.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@265 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
arcum42 2008-11-01 11:34:13 +00:00 committed by Gregory Hainaut
parent d8bd81f00d
commit 5edca82eb3
1 changed files with 7 additions and 0 deletions

View File

@ -211,6 +211,9 @@ void cpudetectInit( void )
//AMD 64 STUFF //AMD 64 STUFF
u32 x86_64_8BITBRANDID; u32 x86_64_8BITBRANDID;
u32 x86_64_12BITBRANDID; u32 x86_64_12BITBRANDID;
int num;
char str[50];
memset( cpuinfo.x86ID, 0, sizeof( cpuinfo.x86ID ) ); memset( cpuinfo.x86ID, 0, sizeof( cpuinfo.x86ID ) );
cpuinfo.x86Family = 0; cpuinfo.x86Family = 0;
cpuinfo.x86Model = 0; cpuinfo.x86Model = 0;
@ -225,6 +228,10 @@ void cpudetectInit( void )
((u32*)cpuinfo.x86ID)[ 0 ] = regs[ 1 ]; ((u32*)cpuinfo.x86ID)[ 0 ] = regs[ 1 ];
((u32*)cpuinfo.x86ID)[ 1 ] = regs[ 3 ]; ((u32*)cpuinfo.x86ID)[ 1 ] = regs[ 3 ];
((u32*)cpuinfo.x86ID)[ 2 ] = regs[ 2 ]; ((u32*)cpuinfo.x86ID)[ 2 ] = regs[ 2 ];
// Hack - prevents reg[2] & reg[3] from being optimized out of existance!
num = sprintf(str, "\tx86Flags = %8.8x %8.8x\n", regs[3], regs[2]);
if ( cmds >= 0x00000001 ) if ( cmds >= 0x00000001 )
{ {
if ( iCpuId( 0x00000001, regs ) != -1 ) if ( iCpuId( 0x00000001, regs ) != -1 )