Fixed the LI and LIS PPC instructions in the JIT. This fixes MGS:TS Konami logo hang.

Made the JIT sanity checks more informative.
Sanity checks are now only performed in the DEBUG and DEBUGFAST builds.  This gives a tiny speed-up for everyone else.

Fixes issue 2187.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5378 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau 2010-04-17 03:00:35 +00:00
parent 060eed80c1
commit 3b35cb12f2
5 changed files with 21 additions and 12 deletions

View File

@ -23,7 +23,7 @@
#include "Common.h"
// Enable memory checks in the Debug/DebugFast builds, but NOT in release
#if _DEBUG || DEBUGFAST
#if defined(_DEBUG) || defined(DEBUGFAST)
#define ENABLE_MEM_CHECK
#endif

View File

@ -567,8 +567,15 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
if (!ops[i].skip)
Jit64Tables::CompileInstruction(ops[i].inst);
gpr.SanityCheck();
fpr.SanityCheck();
#if defined(_DEBUG) || defined(DEBUGFAST)
if (gpr.SanityCheck() || fpr.SanityCheck())
{
char ppcInst[256];
DisassembleGekko(ops[i].inst.hex, em_address, ppcInst, 256);
NOTICE_LOG(DYNA_REC, "Unflushed reg: %s", ppcInst);
}
#endif
if (js.cancel)
break;
}

View File

@ -163,21 +163,22 @@ void RegCache::FlushR(X64Reg reg)
}
}
void RegCache::SanityCheck() const
int RegCache::SanityCheck() const
{
for (int i = 0; i < 32; i++) {
if (regs[i].away) {
if (regs[i].location.IsSimpleReg()) {
Gen::X64Reg simple = regs[i].location.GetSimpleReg();
if (xlocks[simple]) {
PanicAlert("%08x : PPC Reg %i is in locked x64 register %i", /*js.compilerPC*/ 0, i, regs[i].location.GetSimpleReg());
}
if (xregs[simple].ppcReg != i) {
PanicAlert("%08x : Xreg/ppcreg mismatch");
}
if (xlocks[simple])
return 1;
if (xregs[simple].ppcReg != i)
return 2;
}
else if (regs[i].location.IsImm())
return 3;
}
}
return 0;
}
void RegCache::DiscardRegContentsIfCached(int preg)
@ -397,7 +398,7 @@ void RegCache::Flush(FlushMode mode)
}
else
{
_assert_msg_(DYNA_REC,0,"Jit64 - Flush unhandled case, reg %i", i);
_assert_msg_(DYNA_REC,0,"Jit64 - Flush unhandled case, reg %i PC: %08x", i, PC);
}
}
}

View File

@ -95,7 +95,7 @@ public:
}
virtual void Flush(FlushMode mode);
virtual void Flush(PPCAnalyst::CodeOp *op) {Flush(FLUSH_ALL);}
void SanityCheck() const;
int SanityCheck() const;
void KillImmediate(int preg);
//TODO - instead of doload, use "read", "write"

View File

@ -71,6 +71,7 @@ void Jit64::regimmop(int d, int a, bool binary, u32 value, Operation doop, void
{
// a == 0, which for these instructions imply value = 0
gpr.SetImmediate32(d, value);
gpr.StoreFromX64(d);
}
else
{