More fixes to MXCSR code. (Warning: prev revisions may have corrupted your ini files badly -- if you have startup/boot crashing problems, wipe it)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2116 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-11-02 16:26:35 +00:00
parent 71ba32f3b9
commit 2468551994
3 changed files with 10 additions and 11 deletions

View File

@ -358,8 +358,6 @@ void cpudetectInit()
bool ssse3_result = _test_instruction( funcSSSE3 ); bool ssse3_result = _test_instruction( funcSSSE3 );
bool sse41_result = _test_instruction( funcSSE41 ); bool sse41_result = _test_instruction( funcSSE41 );
HostSys::Munmap( recSSE, 0x1000 );
// Test for and log any irregularities here. // Test for and log any irregularities here.
// We take the instruction test result over cpuid since (in theory) it should be a // We take the instruction test result over cpuid since (in theory) it should be a
// more reliable gauge of the cpu's actual ability. But since a difference in bit // more reliable gauge of the cpu's actual ability. But since a difference in bit
@ -405,13 +403,16 @@ void cpudetectInit()
MXCSR_Mask.bitmask = 0xFFBF; MXCSR_Mask.bitmask = 0xFFBF;
if( x86caps.hasFastStreamingSIMDExtensionsSaveRestore ) if( x86caps.hasFastStreamingSIMDExtensionsSaveRestore )
{ {
// the fxsave buffer should be 16-byte aligned. I just save it to an unused portion of
// recSSE, since it has plenty of room to spare.
xSetPtr( recSSE ); xSetPtr( recSSE );
xFXSAVE( recSSE + 1024 ); // just save it to an unused portion of recSSE xFXSAVE( recSSE + 1024 );
xRET(); xRET();
CallAddress( recSSE ); CallAddress( recSSE );
u32 result = ((u32*)&recSSE[1024])[28]; u32 result = (u32&)recSSE[1024+28]; // bytes 28->32 are the MXCSR_Mask.
if( result != 0 ) if( result != 0 )
MXCSR_Mask.bitmask = result; MXCSR_Mask.bitmask = result;
} }

View File

@ -526,7 +526,7 @@ __emitinline void xFXSAVE( const ModSibBase& dest )
__emitinline void xFXRSTOR( const ModSibBase& src ) __emitinline void xFXRSTOR( const ModSibBase& src )
{ {
SimdPrefix( 0, 0xae ); SimdPrefix( 0, 0xae );
EmitSibMagic( 0, src ); EmitSibMagic( 1, src );
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////

View File

@ -1106,7 +1106,7 @@ static __aligned16 SSE_MXCSR roundmode_nearest, roundmode_neg;
void recDIV_S_xmm(int info) void recDIV_S_xmm(int info)
{ {
int roundmodeFlag = 0; bool roundmodeFlag = false;
int t0reg = _allocTempXMMreg(XMMT_FPS, -1); int t0reg = _allocTempXMMreg(XMMT_FPS, -1);
//if (t0reg == -1) {Console.Error("FPU: DIV Allocation Error!");} //if (t0reg == -1) {Console.Error("FPU: DIV Allocation Error!");}
//Console.WriteLn("DIV"); //Console.WriteLn("DIV");
@ -1128,7 +1128,7 @@ void recDIV_S_xmm(int info)
roundmode_nearest.SetRoundMode( SSEround_Nearest ); roundmode_nearest.SetRoundMode( SSEround_Nearest );
xLDMXCSR( roundmode_nearest ); xLDMXCSR( roundmode_nearest );
} }
roundmodeFlag = 1; roundmodeFlag = true;
} }
switch(info & (PROCESS_EE_S|PROCESS_EE_T) ) { switch(info & (PROCESS_EE_S|PROCESS_EE_T) ) {
@ -1175,9 +1175,7 @@ void recDIV_S_xmm(int info)
else recDIVhelper2(EEREC_D, t0reg); else recDIVhelper2(EEREC_D, t0reg);
break; break;
} }
if (roundmodeFlag == 1) { // Set roundmode back if it was changed if (roundmodeFlag) xLDMXCSR (g_sseMXCSR);
xLDMXCSR (g_sseMXCSR);
}
_freeXMMreg(t0reg); _freeXMMreg(t0reg);
} }