Interpreter: Idle skipping support

This commit is contained in:
degasus committed 2015-06-30 20:11:23 +02:00
1 parent 12fe42b2a3
commit 717d4bfbcc
6 files changed
+25 -10

No files matched your search

@@ -23,6 +23,11 @@ void Interpreter::bx(UGeckoInstruction _inst)
#endif*/
m_EndBlock = true;
if (NPC == PC && SConfig::GetInstance().bSkipIdle)
{
CoreTiming::Idle();
}
}
// bcx - ugly, straight from PPC manual equations :)
@@ -50,6 +55,23 @@ void Interpreter::bcx(UGeckoInstruction _inst)
}
m_EndBlock = true;
// this code trys to detect the most common idle loop:
// lwz r0, XXXX(r13)
// cmpXwi r0,0
// beq -8
if (NPC == PC - 8 && _inst.hex == 0x4182fff8 /* beq */ && SConfig::GetInstance().bSkipIdle)
{
if (PowerPC::HostRead_U32(PC - 8) >> 16 == 0x800D /* lwz */ )
{
u32 last_inst = PowerPC::HostRead_U32(PC - 4);
if (last_inst == 0x28000000 /* cmplwi */ || (last_inst == 0x2C000000 /* cmpwi */ && SConfig::GetInstance().bWii))
{
CoreTiming::Idle();
}
}
}
}
void Interpreter::bcctrx(UGeckoInstruction _inst)