1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 01:32:55 +00:00

Add a specific shout-out on prefetch abort, for debugging.

This commit is contained in:
Thomas Harte 2024-03-07 10:23:46 -05:00
parent 38b5624639
commit 7cdceb7b4f

View File

@ -554,18 +554,26 @@ class ConcreteMachine:
// MARK: - TimedMachine. // MARK: - TimedMachine.
void run_for(Cycles cycles) override { void run_for(Cycles cycles) override {
static uint32_t last_pc = 0;
auto instructions = cycles.as<int>(); auto instructions = cycles.as<int>();
while(instructions--) { while(instructions--) {
uint32_t instruction; uint32_t instruction;
if(!executor_.bus.read(executor_.pc(), instruction, executor_.registers().mode(), false)) { if(!executor_.bus.read(executor_.pc(), instruction, executor_.registers().mode(), false)) {
logger.info().append("Prefetch abort at %08x; last good was at %08x", executor_.pc(), last_pc);
executor_.prefetch_abort(); executor_.prefetch_abort();
// TODO: does a double abort cause a reset? // TODO: does a double abort cause a reset?
executor_.bus.read(executor_.pc(), instruction, executor_.registers().mode(), false); executor_.bus.read(executor_.pc(), instruction, executor_.registers().mode(), false);
} else {
last_pc = executor_.pc();
} }
// TODO: pipeline prefetch? // TODO: pipeline prefetch?
// static bool log = false;
// if(log) {
// logger.info().append("%08x: %08x", executor_.pc(), instruction); // logger.info().append("%08x: %08x", executor_.pc(), instruction);
// }
InstructionSet::ARM::execute<arm_model>(instruction, executor_); InstructionSet::ARM::execute<arm_model>(instruction, executor_);
} }
} }