diff options
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/processor.cc | 4 | ||||
-rw-r--r-- | riscv/processor.h | 2 | ||||
-rw-r--r-- | riscv/triggers.cc | 9 | ||||
-rw-r--r-- | riscv/triggers.h | 1 |
4 files changed, 10 insertions, 6 deletions
diff --git a/riscv/processor.cc b/riscv/processor.cc index 0543c26..f626a78 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -988,14 +988,14 @@ bool processor_t::store(reg_t addr, size_t len, const uint8_t* bytes) return false; } -void processor_t::trigger_updated() +void processor_t::trigger_updated(const std::vector<triggers::mcontrol_t *> *triggers) { mmu->flush_tlb(); mmu->check_triggers_fetch = false; mmu->check_triggers_load = false; mmu->check_triggers_store = false; - for (auto trigger : TM.triggers) { + for (auto trigger : *triggers) { if (trigger->execute) { mmu->check_triggers_fetch = true; } diff --git a/riscv/processor.h b/riscv/processor.h index a09b6b6..0283a99 100644 --- a/riscv/processor.h +++ b/riscv/processor.h @@ -314,7 +314,7 @@ public: HR_GROUP /* Halt requested due to halt group. */ } halt_request; - void trigger_updated(); + void trigger_updated(const std::vector<triggers::mcontrol_t *> *triggers); void set_pmp_num(reg_t pmp_num); void set_pmp_granularity(reg_t pmp_granularity); diff --git a/riscv/triggers.cc b/riscv/triggers.cc index 2cb4b13..3a782e1 100644 --- a/riscv/triggers.cc +++ b/riscv/triggers.cc @@ -65,7 +65,6 @@ bool mcontrol_t::tdata1_write(processor_t *proc, const reg_t val) noexcept { // Assume we're here because of csrw. if (execute) timing = 0; - proc->trigger_updated(); return true; } @@ -180,7 +179,9 @@ reg_t module_t::tdata1_read(const processor_t *proc, unsigned index) const noexc bool module_t::tdata1_write(processor_t *proc, unsigned index, const reg_t val) noexcept { - return triggers[index]->tdata1_write(proc, val); + bool result = triggers[index]->tdata1_write(proc, val); + proc->trigger_updated(&triggers); + return result; } reg_t module_t::tdata2_read(const processor_t *proc, unsigned index) const noexcept @@ -190,7 +191,9 @@ reg_t module_t::tdata2_read(const processor_t *proc, unsigned index) const noexc bool module_t::tdata2_write(processor_t *proc, unsigned index, const reg_t val) noexcept { - return triggers[index]->tdata2_write(proc, val); + bool result = triggers[index]->tdata2_write(proc, val); + proc->trigger_updated(&triggers); + return result; } diff --git a/riscv/triggers.h b/riscv/triggers.h index 6752807..7cb5f6c 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -111,6 +111,7 @@ public: bool tdata2_write(processor_t *proc, unsigned index, const reg_t val) noexcept; processor_t *proc; +private: std::vector<mcontrol_t *> triggers; }; |