Fixes for more crash bugs introduced in the prev revision; potential fix for Linux/GTK errors.

Details:
 * Intel's FXSAVE requires an aligned buffer (wasn't explicitly documented in the programmer's guide).
 * I moved the wxMenu() objects in the wxApp constructor to OnInit(), which should be post-GTK initialization.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2115 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-11-02 13:42:28 +00:00
parent 0bb589964f
commit 71ba32f3b9
5 changed files with 18 additions and 17 deletions

View File

@ -340,8 +340,8 @@ namespace x86Emitter
extern void xEMMS();
extern void xSTMXCSR( const ModSib32& dest );
extern void xLDMXCSR( const ModSib32& src );
extern void xFXSAVE( const ModSib32& dest );
extern void xFXRSTOR( const ModSib32& src );
extern void xFXSAVE( const ModSibBase& dest );
extern void xFXRSTOR( const ModSibBase& src );
extern void xMOVDZX( const xRegisterSSE& to, const xRegister32& from );
extern void xMOVDZX( const xRegisterSSE& to, const ModSibBase& src );

View File

@ -402,20 +402,18 @@ void cpudetectInit()
////////////////////////////////////////////////////////////////////////////////////////////
// Establish MXCSR Mask...
if( x86caps.hasStreamingSIMDExtensions )
MXCSR_Mask.bitmask = 0xFFBF;
if( x86caps.hasFastStreamingSIMDExtensionsSaveRestore )
{
xSetPtr( recSSE );
xFXSAVE( ptr32[ecx] );
xFXSAVE( recSSE + 1024 ); // just save it to an unused portion of recSSE
xRET();
u32 _fxsave[512/4];
memzero( _fxsave );
((void (__fastcall *)(u32*))&recSSE[0])( _fxsave );
CallAddress( recSSE );
if( _fxsave[28/4] == 0 )
MXCSR_Mask.bitmask = 0xFFBF;
else
MXCSR_Mask.bitmask = _fxsave[28/4];
u32 result = ((u32*)&recSSE[1024])[28];
if( result != 0 )
MXCSR_Mask.bitmask = result;
}
////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -515,7 +515,7 @@ __emitinline void xLDMXCSR( const ModSib32& src )
// Save x87 FPU, MMX Technology, and SSE State to buffer
// Target buffer must be at least 512 bytes in length to hold the result.
__emitinline void xFXSAVE( const ModSib32& dest )
__emitinline void xFXSAVE( const ModSibBase& dest )
{
SimdPrefix( 0, 0xae );
EmitSibMagic( 0, dest );
@ -523,7 +523,7 @@ __emitinline void xFXSAVE( const ModSib32& dest )
// Restore x87 FPU, MMX , XMM, and MXCSR State.
// Source buffer should be 512 bytes in length.
__emitinline void xFXRSTOR( const ModSib32& src )
__emitinline void xFXRSTOR( const ModSibBase& src )
{
SimdPrefix( 0, 0xae );
EmitSibMagic( 0, src );

View File

@ -50,6 +50,7 @@ void Pcsx2App::OpenWizardConsole()
if( !IsDebugBuild ) return;
g_Conf->ProgLogBox.Visible = true;
m_ProgramLogBox = new ConsoleLogFrame( NULL, L"PCSX2 Program Log", g_Conf->ProgLogBox );
EnableAllLogging();
}
// User mode settings can't be stored in the CWD for two reasons:
@ -265,6 +266,8 @@ bool Pcsx2App::OnInit()
InitDefaultGlobalAccelerators();
delete wxLog::SetActiveTarget( new pxLogConsole() );
m_RecentIsoMenu = new wxMenu();
m_RecentIsoMenu->Append( MenuId_IsoBrowse, _("Browse..."), _("Browse for an Iso that is not in your recent history.") );
m_RecentIsoList = new RecentIsoList( m_RecentIsoMenu );
ReadUserModeSettings();
@ -397,12 +400,10 @@ Pcsx2App::Pcsx2App() :
, m_ConfigImagesAreLoaded( false )
, m_ToolbarImages( NULL )
, m_Bitmap_Logo( NULL )
, m_RecentIsoMenu( new wxMenu() )
, m_RecentIsoMenu( NULL )
{
SetAppName( L"pcsx2" );
BuildCommandHash();
m_RecentIsoMenu->Append( MenuId_IsoBrowse, _("Browse..."), _("Browse for an Iso that is not in your recent history.") );
}
Pcsx2App::~Pcsx2App()

View File

@ -182,7 +182,7 @@ bool IsBIOS(const wxString& filename, wxString& description)
romdir rd;
wxFileName Bios( g_Conf->Folders.Bios + filename );
wxFile fp( Bios.GetFullPath().c_str() );
wxFile fp( Bios.GetFullPath() );
if( !fp.IsOpened() ) return FALSE;
@ -210,6 +210,8 @@ bool IsBIOS(const wxString& filename, wxString& description)
fp.Seek( fileOffset );
if( fp.Read( &aROMVER, 14 ) == 0 ) break;
fp.Seek( filepos ); //go back
aROMVER[14] = 0;
const char zonefail[2] = { aROMVER[4], '\0' }; // the default "zone" (unknown code)
const char* zone = zonefail;