aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2022-07-30 10:28:58 -0700
committerTim Newsome <tim@sifive.com>2022-07-30 10:28:58 -0700
commit9e042c7bb1ab3601b018182b52c9ee6c29d45b42 (patch)
tree4d51dbc5065945c8ff50da9f97b5b7f2b2e82a04
parent4d985feb4e65fd09e6fd9f6f5e9c534c2e522892 (diff)
downloadspike-debug_rom_fence.zip
spike-debug_rom_fence.tar.gz
spike-debug_rom_fence.tar.bz2
Move fence inside entry_loop.debug_rom_fence
This greatly reduces the amount of spinning in the debug loop spike does when DEBUG_ROM_FLAGS are written by the debug module, because now it's not getting a cached version over and over again. Test using riscv-tests/debug. Debugging still works.
-rwxr-xr-xdebug_rom/debug_rom.S5
-rw-r--r--debug_rom/debug_rom.h4
2 files changed, 4 insertions, 5 deletions
diff --git a/debug_rom/debug_rom.S b/debug_rom/debug_rom.S
index 2d36139..a1ddfe5 100755
--- a/debug_rom/debug_rom.S
+++ b/debug_rom/debug_rom.S
@@ -20,9 +20,6 @@ exception:
jal zero, _exception
_entry:
- // This fence is required because the execution may have written something
- // into the Abstract Data or Program Buffer registers.
- fence
csrw CSR_DSCRATCH0, s0 // Save s0 to allow signaling MHARTID
// We continue to let the hart know that we are halted in order that
@@ -30,6 +27,8 @@ _entry:
// We keep checking both whether there is something the debugger wants
// us to do, or whether we should resume.
entry_loop:
+ // Make sure that we don't access a cached version of DEBUG_ROM_FLAGS
+ fence
csrr s0, CSR_MHARTID
sw s0, DEBUG_ROM_HALTED(zero)
lbu s0, DEBUG_ROM_FLAGS(s0) // 1 byte flag per hart. Only one hart advances here.
diff --git a/debug_rom/debug_rom.h b/debug_rom/debug_rom.h
index 7edd5f6..0c94eea 100644
--- a/debug_rom/debug_rom.h
+++ b/debug_rom/debug_rom.h
@@ -1,10 +1,10 @@
static const unsigned char debug_rom_raw[] = {
0x6f, 0x00, 0xc0, 0x00, 0x6f, 0x00, 0x00, 0x06, 0x6f, 0x00, 0x80, 0x03,
- 0x0f, 0x00, 0xf0, 0x0f, 0x73, 0x10, 0x24, 0x7b, 0x73, 0x24, 0x40, 0xf1,
+ 0x73, 0x10, 0x24, 0x7b, 0x0f, 0x00, 0xf0, 0x0f, 0x73, 0x24, 0x40, 0xf1,
0x23, 0x20, 0x80, 0x10, 0x03, 0x44, 0x04, 0x40, 0x13, 0x74, 0x14, 0x00,
0x63, 0x14, 0x04, 0x02, 0x73, 0x24, 0x40, 0xf1, 0x03, 0x44, 0x04, 0x40,
0x13, 0x74, 0x24, 0x00, 0x63, 0x18, 0x04, 0x02, 0x73, 0x00, 0x50, 0x10,
- 0x6f, 0xf0, 0x9f, 0xfd, 0x73, 0x24, 0x20, 0x7b, 0x23, 0x26, 0x00, 0x10,
+ 0x6f, 0xf0, 0x5f, 0xfd, 0x73, 0x24, 0x20, 0x7b, 0x23, 0x26, 0x00, 0x10,
0x73, 0x00, 0x10, 0x00, 0x73, 0x24, 0x40, 0xf1, 0x23, 0x22, 0x80, 0x10,
0x73, 0x24, 0x20, 0x7b, 0x0f, 0x00, 0xf0, 0x0f, 0x0f, 0x10, 0x00, 0x00,
0x67, 0x00, 0x00, 0x30, 0x73, 0x24, 0x40, 0xf1, 0x23, 0x24, 0x80, 0x10,