aboutsummaryrefslogtreecommitdiff
path: root/riscv/debug_module.cc
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2019-04-04 14:34:33 -0700
committerGitHub <noreply@github.com>2019-04-04 14:34:33 -0700
commit69a8b5d2cfc54c36c86b8733a1fbcdffe9811a94 (patch)
tree7a5ec2a8021c4fd69f78b11ddd90d386eb9876bd /riscv/debug_module.cc
parent3e79495c38bf58df9c7b389205032b2eb3f45fb7 (diff)
downloadspike-69a8b5d2cfc54c36c86b8733a1fbcdffe9811a94.zip
spike-69a8b5d2cfc54c36c86b8733a1fbcdffe9811a94.tar.gz
spike-69a8b5d2cfc54c36c86b8733a1fbcdffe9811a94.tar.bz2
Add --debug-no-abstract-csr (#267)
This is used to make sure that OpenOCD can work on targets that don't support abstract access to CSR registers. It replaces a simpler hack, which caused #266.
Diffstat (limited to 'riscv/debug_module.cc')
-rw-r--r--riscv/debug_module.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/riscv/debug_module.cc b/riscv/debug_module.cc
index 0c3e927..20419b1 100644
--- a/riscv/debug_module.cc
+++ b/riscv/debug_module.cc
@@ -32,13 +32,15 @@ static unsigned field_width(unsigned n)
///////////////////////// debug_module_t
debug_module_t::debug_module_t(sim_t *sim, unsigned progbufsize, unsigned max_bus_master_bits,
- bool require_authentication, unsigned abstract_rti, bool support_hasel) :
+ bool require_authentication, unsigned abstract_rti, bool support_hasel,
+ bool support_abstract_csr_access) :
nprocs(sim->nprocs()),
progbufsize(progbufsize),
program_buffer_bytes(4 + 4*progbufsize),
max_bus_master_bits(max_bus_master_bits),
require_authentication(require_authentication),
abstract_rti(abstract_rti),
+ support_abstract_csr_access(support_abstract_csr_access),
debug_progbuf_start(debug_data_start - program_buffer_bytes),
debug_abstract_start(debug_progbuf_start - debug_abstract_size*4),
custom_base(0),
@@ -585,9 +587,7 @@ bool debug_module_t::perform_abstract_command()
unsigned i = 0;
if (get_field(command, AC_ACCESS_REGISTER_TRANSFER)) {
- if (regno < 0x1000 && progbufsize < 2) {
- // Make the debugger use the program buffer if it's available, so it
- // can test both use cases.
+ if (regno < 0x1000 && support_abstract_csr_access) {
write32(debug_abstract, i++, csrw(S0, CSR_DSCRATCH));
if (write) {
@@ -642,9 +642,6 @@ bool debug_module_t::perform_abstract_command()
}
} else if (regno >= 0x1020 && regno < 0x1040) {
- // Don't force the debugger to use progbuf if it exists, so the
- // debugger has to make the decision not to use abstract commands to
- // access 64-bit FPRs on 32-bit targets.
unsigned fprnum = regno - 0x1020;
if (write) {