Fix inifinite loop in the interpreter, fixes ~6 games

Seems that, on IRQ, it is assumed that the PC will change (which happens
most of the time). However if the IRQ is masked it resumes execution.
On masked DMA IRQ the interpreter jumps to alert without incrementing
the instruction pointer (right after).
This commit is contained in:
David Guillen Fandos 2021-08-15 23:02:12 +02:00
parent f5232543f5
commit 745b2ece2c
1 changed files with 9 additions and 4 deletions

13
cpu.c
View File

@ -1004,8 +1004,6 @@ const u32 psr_masks[16] =
} \
\
cpu_alert = write_memory##size(_address, value); \
if(cpu_alert) \
goto alert; \
} \
#define load_aligned32(address, dest) \
@ -1036,8 +1034,6 @@ const u32 psr_masks[16] =
memory_writes_u32++; \
} \
cpu_alert = write_memory32(_address, value); \
if(cpu_alert) \
goto alert; \
} \
#define load_memory_u8(address, dest) \
@ -1649,6 +1645,7 @@ void execute_arm(u32 cycles)
return;
}
cpu_alert = CPU_ALERT_NONE;
pc = reg[REG_PC];
extract_flags();
@ -3222,6 +3219,10 @@ skip_instruction:
cycles_remaining -= cycles_per_instruction;
if (pc == idle_loop_target_pc && cycles_remaining > 0) cycles_remaining = 0;
if(cpu_alert)
goto alert;
} while(cycles_remaining > 0);
collapse_flags();
@ -3728,6 +3729,10 @@ thumb_loop:
cycles_remaining -= cycles_per_instruction;
if (pc == idle_loop_target_pc && cycles_remaining > 0) cycles_remaining = 0;
if(cpu_alert)
goto alert;
} while(cycles_remaining > 0);
collapse_flags();