aboutsummaryrefslogtreecommitdiff
path: root/riscv/processor.h
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2019-07-12 11:55:01 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2019-07-22 02:11:03 -0700
commit4367fd1b4be8bbe7f45d9a439531aff183c6f18a (patch)
tree4bc7808b58ab2ec67f5f9343f7a7a4305570b194 /riscv/processor.h
parenta1655f21604e773f01499ebf3c44e78a23113a7b (diff)
downloadspike-4367fd1b4be8bbe7f45d9a439531aff183c6f18a.zip
spike-4367fd1b4be8bbe7f45d9a439531aff183c6f18a.tar.gz
spike-4367fd1b4be8bbe7f45d9a439531aff183c6f18a.tar.bz2
Add debug_mode state bit, rather than overloading dcsr.cause
In the previous scheme, debug-mode software could exit debug mode by zeroing the dcsr.cause field. While benign, that behavior is out of spec.
Diffstat (limited to 'riscv/processor.h')
-rw-r--r--riscv/processor.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/riscv/processor.h b/riscv/processor.h
index 5504d21..9698145 100644
--- a/riscv/processor.h
+++ b/riscv/processor.h
@@ -241,12 +241,14 @@ struct state_t
reg_t stvec;
reg_t satp;
reg_t scause;
+
reg_t dpc;
reg_t dscratch;
dcsr_t dcsr;
reg_t tselect;
mcontrol_t mcontrol[num_triggers];
reg_t tdata2[num_triggers];
+ bool debug_mode;
static const int n_pmp = 16;
uint8_t pmpcfg[n_pmp];
@@ -339,13 +341,13 @@ public:
bool debug;
// When true, take the slow simulation path.
bool slow_path();
- bool halted() { return state.dcsr.cause ? true : false; }
+ bool halted() { return state.debug_mode; }
bool halt_request;
// Return the index of a trigger that matched, or -1.
inline int trigger_match(trigger_operation_t operation, reg_t address, reg_t data)
{
- if (state.dcsr.cause)
+ if (state.debug_mode)
return -1;
bool chain_ok = true;