diff options
-rw-r--r-- | benchmarks/pmp/pmp.c | 13 | ||||
m--------- | env | 10 |
2 files changed, 13 insertions, 10 deletions
diff --git a/benchmarks/pmp/pmp.c b/benchmarks/pmp/pmp.c index 055ec79..9d07ed8 100644 --- a/benchmarks/pmp/pmp.c +++ b/benchmarks/pmp/pmp.c @@ -44,7 +44,7 @@ static void init_pt() #endif write_csr(sptbr, ((uintptr_t)l1pt >> RISCV_PGSHIFT) | (vm_choice * (SPTBR_MODE & ~(SPTBR_MODE<<1)))); - write_csr(pmpcfg0, (PMP_EN | PMP_NAPOT | PMP_R) << 16); + write_csr(pmpcfg0, (PMP_NAPOT | PMP_R) << 16); write_csr(pmpaddr2, -1); } @@ -65,10 +65,13 @@ typedef struct { INLINE int pmp_ok(pmpcfg_t p, uintptr_t addr, uintptr_t size) { - if (!(p.cfg & PMP_TOR)) { + if ((p.cfg & PMP_A) == 0) + return 1; + + if ((p.cfg & PMP_A) != PMP_TOR) { uintptr_t range = 1; - if (p.cfg & PMP_NAPOT) { + if ((p.cfg & PMP_A) == PMP_NAPOT) { range <<= 1; for (uintptr_t i = 1; i; i <<= 1) { if ((p.a1 & i) == 0) @@ -141,7 +144,7 @@ INLINE pmpcfg_t set_pmp(pmpcfg_t p) INLINE pmpcfg_t set_pmp_range(uintptr_t base, uintptr_t range) { pmpcfg_t p; - p.cfg = PMP_EN | PMP_TOR | PMP_M | PMP_R; + p.cfg = PMP_TOR | PMP_R; p.a0 = base >> PMP_SHIFT; p.a1 = (base + range) >> PMP_SHIFT; return set_pmp(p); @@ -150,7 +153,7 @@ INLINE pmpcfg_t set_pmp_range(uintptr_t base, uintptr_t range) INLINE pmpcfg_t set_pmp_napot(uintptr_t base, uintptr_t range) { pmpcfg_t p; - p.cfg = PMP_EN | PMP_M | PMP_R | (range > GRANULE ? PMP_NAPOT : 0); + p.cfg = PMP_R | (range > GRANULE ? PMP_NAPOT : PMP_NA4); p.a0 = 0; p.a1 = (base + (range/2 - 1)) >> PMP_SHIFT; return set_pmp(p); diff --git a/env b/env -Subproject 47fef2b463a484f3dafe979ec4e646990460dec +Subproject 3f1d04a2e8f849c306bdca7c7115462c3a60a6e |