diff options
author | Jerry Zhao <jerryz123@berkeley.edu> | 2023-01-04 11:00:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-04 11:00:33 -0800 |
commit | 0a59b06f3b5542fab8d78ae3ee0b8276ec5acd36 (patch) | |
tree | 3bd9fe4522bf0961264442d896cabf177de3269b | |
parent | b3946f8500b58c934ca9bd036cb8f4b614788caf (diff) | |
parent | 7334b0180e010dc7b9b89128db53045fe67bf3f4 (diff) | |
download | riscv-isa-sim-0a59b06f3b5542fab8d78ae3ee0b8276ec5acd36.zip riscv-isa-sim-0a59b06f3b5542fab8d78ae3ee0b8276ec5acd36.tar.gz riscv-isa-sim-0a59b06f3b5542fab8d78ae3ee0b8276ec5acd36.tar.bz2 |
Merge pull request #1209 from riscv-software-src/debugfix
Fix debug-mode regression introduced by 20e7f53
-rw-r--r-- | riscv/execute.cc | 12 | ||||
-rw-r--r-- | riscv/processor.cc | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc index c922602..cd6ae1a 100644 --- a/riscv/execute.cc +++ b/riscv/execute.cc @@ -203,7 +203,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; + log_commits_enabled || histogram_enabled || in_wfi; } // fetch/decode/execute loop @@ -242,10 +242,6 @@ void processor_t::step(size_t n) try { take_pending_interrupt(); - if (unlikely(in_wfi)) { - // No unmasked pending interrupt, so remain in wfi - throw wait_for_interrupt_t(); - } if (unlikely(slow_path())) { @@ -265,6 +261,12 @@ void processor_t::step(size_t n) state.single_step = state.STEP_STEPPED; } + // debug mode wfis must nop + if (unlikely(in_wfi && !state.debug_mode)) { + throw wait_for_interrupt_t(); + } + + in_wfi = false; insn_fetch_t fetch = mmu->load_insn(pc); if (debug && !state.serialized) disasm(fetch.insn); diff --git a/riscv/processor.cc b/riscv/processor.cc index 666884f..c3c5d8f 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -537,6 +537,7 @@ void processor_t::reset() state.dcsr->halt = halt_on_reset; halt_on_reset = false; VU.reset(); + in_wfi = false; if (n_pmp > 0) { // For backwards compatibility with software that is unaware of PMP, @@ -744,6 +745,7 @@ void processor_t::enter_debug_mode(uint8_t cause) set_privilege(PRV_M); state.dpc->write(state.pc); state.pc = DEBUG_ROM_ENTRY; + in_wfi = false; } void processor_t::debug_output_log(std::stringstream *s) |