Browse Source
Merge pull request #1209 from riscv-software-src/debugfix
Fix debug-mode regression introduced by 20e7f53
pull/1211/head
Jerry Zhao
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
9 additions and
5 deletions
-
riscv/execute.cc
-
riscv/processor.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); |
|
|
|
|
|
|
|
@ -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) |
|
|
|
|