aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Wren <wren6991@gmail.com>2022-05-31 18:08:48 +0100
committerGitHub <noreply@github.com>2022-05-31 10:08:48 -0700
commit3bd84bd415cd6b3ef9454df354eb2973b4e0f623 (patch)
treeb20c52c445367e2c4788389a41c44c04af548625
parent3dc79832d072ccbb6ebd1b7115c887fb621be5d3 (diff)
downloadriscv-tests-3bd84bd415cd6b3ef9454df354eb2973b4e0f623.zip
riscv-tests-3bd84bd415cd6b3ef9454df354eb2973b4e0f623.tar.gz
riscv-tests-3bd84bd415cd6b3ef9454df354eb2973b4e0f623.tar.bz2
Fix GdbTest.disable_pmp failing on systems which support NAPOT but not TOR regions (#388)
-rw-r--r--debug/testlib.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/debug/testlib.py b/debug/testlib.py
index 4ebed43..6b4854f 100644
--- a/debug/testlib.py
+++ b/debug/testlib.py
@@ -1208,8 +1208,14 @@ class GdbTest(BaseTest):
# memory.
try:
self.gdb.p("$pmpcfg0=0xf") # TOR, R, W, X
- self.gdb.p("$pmpaddr0=0x%x" %
- ((self.hart.ram + self.hart.ram_size) >> 2))
+ if self.gdb.p("$pmpcfg0") != 0xf:
+ # TOR is unsupported (detected via WARL) so use NAPOT instead
+ self.gdb.p("$pmpcfg0=0x1f") # NAPOT, R, W, X
+ self.gdb.p("$pmpaddr0=0x" + "f" * (self.hart.xlen // 4))
+ else:
+ # pmcfg0 readback matches write, so TOR is supported.
+ self.gdb.p("$pmpaddr0=0x%x" %
+ ((self.hart.ram + self.hart.ram_size) >> 2))
except CouldNotFetch:
# PMP registers are optional
pass