aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.cc
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2022-10-06 17:40:41 -0700
committerAndrew Waterman <andrew@sifive.com>2022-10-06 19:30:40 -0700
commit7b8114f707a7b2de9fd2d393b9d019180de83025 (patch)
treedc4c83a2ab0e7050758214025c15991f9e78a5eb /riscv/mmu.cc
parentfd50768df9ec4d9f80c6a37d89734d9e27443f6b (diff)
downloadspike-7b8114f707a7b2de9fd2d393b9d019180de83025.zip
spike-7b8114f707a7b2de9fd2d393b9d019180de83025.tar.gz
spike-7b8114f707a7b2de9fd2d393b9d019180de83025.tar.bz2
Don't use reexecution as the means to implement trigger-after
The scheme was based on the notion that memory accesses are idempotent up until the point the trigger would've been hit, which isn't true in the case of side-effecting loads and data-value triggers. Instead, check the trigger on the next instruction fetch. To keep the perf overhead minimal, perform this check on the I$ refill path, and ensure that path is taken by flushing the I$.
Diffstat (limited to 'riscv/mmu.cc')
-rw-r--r--riscv/mmu.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc
index b8690ec..fdad05f 100644
--- a/riscv/mmu.cc
+++ b/riscv/mmu.cc
@@ -165,8 +165,11 @@ void mmu_t::check_triggers(triggers::operation_t operation, reg_t address, bool
throw triggers::matched_t(operation, address, data, action);
case triggers::MATCH_FIRE_AFTER:
+ // We want to take this exception on the next instruction. We check
+ // whether to do so in the I$ refill path, so flush the I$.
+ flush_icache();
matched_trigger = new triggers::matched_t(operation, address, data, action);
- throw *matched_trigger;
+ return;
}
}