aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.cc
diff options
context:
space:
mode:
authorYenHaoChen <howard25336284@gmail.com>2022-11-30 11:26:13 +0800
committerYenHaoChen <howard25336284@gmail.com>2022-11-30 12:11:32 +0800
commitb81652954ef91c6ab169efaae050825d159fdf05 (patch)
tree8ae7beb6d8957a7a0327869aec4555cd28e11ae0 /riscv/mmu.cc
parente359d952850439563eaa3c1d8c256512686a4242 (diff)
downloadriscv-isa-sim-b81652954ef91c6ab169efaae050825d159fdf05.zip
riscv-isa-sim-b81652954ef91c6ab169efaae050825d159fdf05.tar.gz
riscv-isa-sim-b81652954ef91c6ab169efaae050825d159fdf05.tar.bz2
triggers: refactor: let match_result_t be a struct with fire and timing variables
Mapping of previous and revised match_result_t data type: ------------------------------------------- Previous Revised MATCH_NONE fire=false (don't care timing) MATCH_MATCH_FIRE_BEFORE fire=true,timing=TIMING_BEFORE MATCH_MATCH_FIRE_AFTER fire=true,timing=TIMING_AFTER
Diffstat (limited to 'riscv/mmu.cc')
-rw-r--r--riscv/mmu.cc25
1 files changed, 11 insertions, 14 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc
index a966180..f2d8445 100644
--- a/riscv/mmu.cc
+++ b/riscv/mmu.cc
@@ -160,20 +160,17 @@ void mmu_t::check_triggers(triggers::operation_t operation, reg_t address, std::
triggers::action_t action;
auto match = proc->TM.memory_access_match(&action, operation, address, data);
- switch (match) {
- case triggers::MATCH_NONE:
- return;
-
- case triggers::MATCH_FIRE_BEFORE:
- throw triggers::matched_t(operation, address, 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, action);
- return;
- }
+ if (match.fire)
+ switch (match.timing) {
+ case triggers::TIMING_BEFORE:
+ throw triggers::matched_t(operation, address, action);
+
+ case triggers::TIMING_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, action);
+ }
}
void mmu_t::load_slow_path_intrapage(reg_t addr, reg_t len, uint8_t* bytes, uint32_t xlate_flags)