aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2016-04-23 10:40:23 -0700
committerTim Newsome <tim@sifive.com>2016-05-23 12:12:11 -0700
commit78332ffbafeae5e9079bfc69ff136c5d24644a4c (patch)
tree8bc0b585669a3c58e74d839fba2aeac9b813b3f4
parentdf640b0cacf4ac6903b21c28e23fd9ef6861f94f (diff)
downloadriscv-isa-sim-78332ffbafeae5e9079bfc69ff136c5d24644a4c.zip
riscv-isa-sim-78332ffbafeae5e9079bfc69ff136c5d24644a4c.tar.gz
riscv-isa-sim-78332ffbafeae5e9079bfc69ff136c5d24644a4c.tar.bz2
Make sure to translate Debug RAM addresses also.
-rw-r--r--riscv/decode.h3
-rw-r--r--riscv/sim.cc5
2 files changed, 6 insertions, 2 deletions
diff --git a/riscv/decode.h b/riscv/decode.h
index bf6a84c..9b9df5b 100644
--- a/riscv/decode.h
+++ b/riscv/decode.h
@@ -237,9 +237,12 @@ private:
#define DCSR_CAUSE_STEPPED 4
#define DCSR_CAUSE_HALT 5
+#define DEBUG_START 0xfffffffffffff000
#define DEBUG_RAM_START 0xfffffffffffffc00 // TODO: 0x400
#define DEBUG_RAM_END (DEBUG_RAM_START + 64)
#define DEBUG_ROM_START 0xfffffffffffff800 // TODO: 0x800
#define DEBUG_ROM_END (DEBUG_ROM_START + debug_rom_raw_len)
+#define DEBUG_END 0xffffffffffffffff
+#define DEBUG_SIZE (DEBUG_END - DEBUG_START + 1)
#endif
diff --git a/riscv/sim.cc b/riscv/sim.cc
index 5cf2646..7c50425 100644
--- a/riscv/sim.cc
+++ b/riscv/sim.cc
@@ -42,10 +42,11 @@ sim_t::sim_t(const char* isa, size_t nprocs, size_t mem_mb, bool halted,
(unsigned long)memsz, (unsigned long)memsz0);
/* Copy Debug ROM into the end of the allocated block, because we surely
- * didn't succeed in allocation 0xfffffffff800 bytes. */
+ * didn't succeed in allocating 0xfffffffff800 bytes. */
/* TODO: Once everything uses the new memory map, just put this at the
* address that it actually belongs at. */
- memcpy(mem + memsz - debug_rom_raw_len, debug_rom_raw, debug_rom_raw_len);
+ memcpy(mem + memsz - DEBUG_SIZE + DEBUG_ROM_START - DEBUG_START,
+ debug_rom_raw, debug_rom_raw_len);
debug_mmu = new mmu_t(this, NULL);