Browse Source

triggers: force to slow path with icount triggers

pull/1220/head
YenHaoChen 4 years ago
parent
commit
1230b321f9
  1. 2
      riscv/execute.cc
  2. 6
      riscv/processor.cc
  3. 1
      riscv/processor.h
  4. 2
      riscv/triggers.h

2
riscv/execute.cc

@ -204,7 +204,7 @@ static inline reg_t execute_insn_logged(processor_t* p, reg_t pc, insn_fetch_t f
bool processor_t::slow_path()
{
return debug || state.single_step != state.STEP_NONE || state.debug_mode ||
log_commits_enabled || histogram_enabled || in_wfi;
log_commits_enabled || histogram_enabled || in_wfi || check_triggers_icount;
}
// fetch/decode/execute loop

6
riscv/processor.cc

@ -34,7 +34,7 @@ processor_t::processor_t(const isa_parser_t *isa, const cfg_t *cfg,
: debug(false), halt_request(HR_NONE), isa(isa), cfg(cfg), sim(sim), id(id), xlen(0),
histogram_enabled(false), log_commits_enabled(false),
log_file(log_file), sout_(sout_.rdbuf()), halt_on_reset(halt_on_reset),
in_wfi(false),
in_wfi(false), check_triggers_icount(false),
impl_table(256, false), last_pc(1), executions(1), TM(cfg->trigger_count)
{
VU.p = this;
@ -1123,6 +1123,7 @@ void processor_t::trigger_updated(const std::vector<triggers::trigger_t *> &trig
mmu->check_triggers_fetch = false;
mmu->check_triggers_load = false;
mmu->check_triggers_store = false;
check_triggers_icount = false;
for (auto trigger : triggers) {
if (trigger->get_execute()) {
@ -1134,5 +1135,8 @@ void processor_t::trigger_updated(const std::vector<triggers::trigger_t *> &trig
if (trigger->get_store()) {
mmu->check_triggers_store = true;
}
if (trigger->icount_check_needed()) {
check_triggers_icount = true;
}
}
}

1
riscv/processor.h

@ -301,6 +301,7 @@ private:
std::ostream sout_; // needed for socket command interface -s, also used for -d and -l, but not for --log
bool halt_on_reset;
bool in_wfi;
bool check_triggers_icount;
std::vector<bool> impl_table;
std::vector<insn_desc_t> instructions;

2
riscv/triggers.h

@ -79,6 +79,7 @@ public:
virtual bool get_store() const { return false; }
virtual bool get_load() const { return false; }
virtual action_t get_action() const { return ACTION_DEBUG_EXCEPTION; }
virtual bool icount_check_needed() const { return false; }
virtual std::optional<match_result_t> detect_memory_access_match(processor_t UNUSED * const proc,
operation_t UNUSED operation, reg_t UNUSED address, std::optional<reg_t> UNUSED data) noexcept { return std::nullopt; }
@ -240,6 +241,7 @@ public:
bool get_dmode() const override { return dmode; }
virtual action_t get_action() const override { return action; }
virtual bool icount_check_needed() const override { return true; }
private:
bool dmode;

Loading…
Cancel
Save