CPU/CachedInterpreter: Fix infinite loop when block compile fails

This commit is contained in:
Connor McLaughlin 2021-04-14 19:02:11 +10:00
parent 58f5c99100
commit dd5277321b
2 changed files with 3 additions and 1 deletions

View file

@ -194,6 +194,7 @@ static void ExecuteImpl()
if (!block) if (!block)
{ {
InterpretUncachedBlock<pgxp_mode>(); InterpretUncachedBlock<pgxp_mode>();
next_block_key = GetNextBlockKey();
continue; continue;
} }

View file

@ -1918,7 +1918,8 @@ template<PGXPMode pgxp_mode>
void InterpretUncachedBlock() void InterpretUncachedBlock()
{ {
g_state.regs.npc = g_state.regs.pc; g_state.regs.npc = g_state.regs.pc;
FetchInstruction(); if (!FetchInstruction())
return;
// At this point, pc contains the last address executed (in the previous block). The instruction has not been fetched // At this point, pc contains the last address executed (in the previous block). The instruction has not been fetched
// yet. pc shouldn't be updated until the fetch occurs, that way the exception occurs in the delay slot. // yet. pc shouldn't be updated until the fetch occurs, that way the exception occurs in the delay slot.