aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.cc
diff options
context:
space:
mode:
authorScott Johnson <scott.johnson@arilinc.com>2021-02-24 10:09:17 -0800
committerAndrew Waterman <aswaterman@gmail.com>2021-09-08 07:59:02 -0700
commitca7700db2363b08ae65f237ef9819e72066adb67 (patch)
tree9578cd114b224ab1fe84ccd4ffd6c1750249bb7f /riscv/mmu.cc
parent07ee26043895862ca2f9e7737f157b86cc0f30ef (diff)
downloadspike-ca7700db2363b08ae65f237ef9819e72066adb67.zip
spike-ca7700db2363b08ae65f237ef9819e72066adb67.tar.gz
spike-ca7700db2363b08ae65f237ef9819e72066adb67.tar.bz2
Move permissions check into pmpaddr_csr_t
This was the last place outside of the csr_t hierarchy that pmpcfg was being accessed.
Diffstat (limited to 'riscv/mmu.cc')
-rw-r--r--riscv/mmu.cc7
1 files changed, 1 insertions, 6 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc
index b6dcc1f..d7a4110 100644
--- a/riscv/mmu.cc
+++ b/riscv/mmu.cc
@@ -236,12 +236,7 @@ bool mmu_t::pmp_ok(reg_t addr, reg_t len, access_type type, reg_t mode)
if (!all_match)
return false;
- uint8_t cfg = proc->state.pmpcfg[i];
- return
- (mode == PRV_M && !(cfg & PMP_L)) ||
- (type == LOAD && (cfg & PMP_R)) ||
- (type == STORE && (cfg & PMP_W)) ||
- (type == FETCH && (cfg & PMP_X));
+ return proc->state.pmpaddr[i]->access_ok(type, mode);
}
}