From 4efb1ed9cadd503a0a083429cdcad3c7c63bf3ac Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sat, 3 Oct 2009 13:36:19 +0000 Subject: [PATCH] Added some DebugBreak generation (INT3 / 0xcc) to the PsxRec, for catching null pxsRegs.pc assignments from the recompiler (enabled in DEBUG builds only). These are usually more context-useful breakpoints than the assert() check in psxRecompile. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1948 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/x86/iR3000A.cpp | 23 +++++++++++++++++------ pcsx2/x86/iR3000Atables.cpp | 14 ++++++++++++++ pcsx2/x86/ix86-32/iR5900-32.cpp | 2 +- pcsx2_suite_2008.sln | 2 +- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index b93b90f6cc..2dd2e7acc8 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -681,7 +681,6 @@ static __forceinline s32 recExecuteBlock( s32 eeCycles ) // Returns the offset to the next instruction after any cleared memory static __forceinline u32 psxRecClearMem(u32 pc) { - BASEBLOCKEX* pexblock; BASEBLOCK* pblock; pblock = PSX_GETBLOCK(pc); @@ -696,8 +695,7 @@ static __forceinline u32 psxRecClearMem(u32 pc) jASSUME(blockidx != -1); - // Variable assignment in the middle of the while statements condition? - while (pexblock = recBlocks[blockidx - 1]) { + while (BASEBLOCKEX* pexblock = recBlocks[blockidx - 1]) { if (pexblock->startpc + pexblock->size * 4 <= lowerextent) break; @@ -705,8 +703,7 @@ static __forceinline u32 psxRecClearMem(u32 pc) blockidx--; } - // Same here. - while (pexblock = recBlocks[blockidx]) { + while (BASEBLOCKEX* pexblock = recBlocks[blockidx]) { if (pexblock->startpc >= upperextent) break; @@ -716,7 +713,8 @@ static __forceinline u32 psxRecClearMem(u32 pc) } #ifdef PCSX2_DEVBUILD - for (int i = 0; pexblock = recBlocks[i]; i++) + blockidx=0; + while(BASEBLOCKEX* pexblock = recBlocks[blockidx++]) if (pc >= pexblock->startpc && pc < pexblock->startpc + pexblock->size * 4) { Console::Error("Impossible block clearing failure"); jASSUME(0); @@ -749,11 +747,24 @@ void psxSetBranchReg(u32 reg) assert( x86regs[ESI].type == X86TYPE_PCWRITEBACK ); MOV32RtoM((uptr)&psxRegs.pc, ESI); x86regs[ESI].inuse = 0; + #ifdef PCSX2_DEBUG + xOR( esi, esi ); + #endif } else { MOV32MtoR(EAX, (uptr)&g_recWriteback); MOV32RtoM((uptr)&psxRegs.pc, EAX); + + #ifdef PCSX2_DEBUG + xOR( eax, eax ); + #endif } + + #ifdef PCSX2_DEBUG + xForwardJNZ8 skipAssert; + xWrite8( 0xcc ); + skipAssert.SetTarget(); + #endif } _psxFlushCall(FLUSH_EVERYTHING); diff --git a/pcsx2/x86/iR3000Atables.cpp b/pcsx2/x86/iR3000Atables.cpp index 2e1060c0f5..b8cd86dad2 100644 --- a/pcsx2/x86/iR3000Atables.cpp +++ b/pcsx2/x86/iR3000Atables.cpp @@ -22,6 +22,8 @@ #include "IopMem.h" #include "IopDma.h" +using namespace x86Emitter; + extern int g_psxWriteOk; extern u32 g_psxMaxRecMem; @@ -1243,11 +1245,23 @@ void rpsxJALR() assert( x86regs[ESI].type == X86TYPE_PCWRITEBACK ); MOV32RtoM((uptr)&psxRegs.pc, ESI); x86regs[ESI].inuse = 0; + #ifdef PCSX2_DEBUG + xOR( esi, esi ); + #endif + } else { MOV32MtoR(EAX, (uptr)&g_recWriteback); MOV32RtoM((uptr)&psxRegs.pc, EAX); + #ifdef PCSX2_DEBUG + xOR( eax, eax ); + #endif } + #ifdef PCSX2_DEBUG + xForwardJNZ8 skipAssert; + xWrite8( 0xcc ); + skipAssert.SetTarget(); + #endif psxSetBranchReg(0xffffffff); } diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index d28d4b0521..75e0c55c4d 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -491,7 +491,7 @@ void recEventTest() // dont' remove this check unless doing an official release if( g_globalXMMSaved || g_globalMMXSaved) { - DevCon::Error("Pcsx2 Foopah! Frozen regs have not been restored!!!"); + DevCon::Error("PCSX2 Foopah! Frozen regs have not been restored!!!"); DevCon::Error("g_globalXMMSaved = %d,g_globalMMXSaved = %d", g_globalXMMSaved, g_globalMMXSaved); } assert( !g_globalXMMSaved && !g_globalMMXSaved); diff --git a/pcsx2_suite_2008.sln b/pcsx2_suite_2008.sln index eff88c6ff4..0535b237ec 100644 --- a/pcsx2_suite_2008.sln +++ b/pcsx2_suite_2008.sln @@ -696,6 +696,6 @@ Global {677B7D11-D5E1-40B3-88B1-9A4DF83D2213} = {2D6F0A62-A247-4CCF-947F-FCD54BE16103} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - AMDCaProjectFile = E:\devpcsx2\fail\wx\CodeAnalyst\pcsx2_suite_2008.caw + AMDCaProjectFile = E:\devpcsx2\nommx\CodeAnalyst\pcsx2_suite_2008.caw EndGlobalSection EndGlobal