diff options
author | Andrew Waterman <andrew@sifive.com> | 2017-03-21 15:50:13 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2017-03-21 15:50:13 -0700 |
commit | 9e43ec4eafc7a96b9aa19397ffbc9dbeb161efb2 (patch) | |
tree | 67856a03ebd1e8177b0de7b36d8d2ea0dcec9fb0 /p/riscv_test.h | |
parent | 497efbd0fa104b70f058ea550ed0c7f8a554662b (diff) | |
download | env-9e43ec4eafc7a96b9aa19397ffbc9dbeb161efb2.zip env-9e43ec4eafc7a96b9aa19397ffbc9dbeb161efb2.tar.gz env-9e43ec4eafc7a96b9aa19397ffbc9dbeb161efb2.tar.bz2 |
Set up PMP if present
Diffstat (limited to 'p/riscv_test.h')
-rw-r--r-- | p/riscv_test.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/p/riscv_test.h b/p/riscv_test.h index 9f17ae5..fe71eae 100644 --- a/p/riscv_test.h +++ b/p/riscv_test.h @@ -54,10 +54,13 @@ #endif #define INIT_SPTBR \ - csrr a0, misa; \ - slli a0, a0, (__riscv_xlen - 1) - ('S' - 'A'); \ - bgez a0, 1f; \ + la t0, 1f; \ + csrw mtvec, t0; \ csrwi sptbr, 0; \ + li t0, -1; /* Set up a PMP to permit all accesses */ \ + csrw CSR_PMPADDR0, t0; \ + li t0, PMP_EN | PMP_NAPOT | PMP_M | PMP_R | PMP_W | PMP_X; \ + csrw CSR_PMPCFG0, t0; \ 1: #define RVTEST_ENABLE_SUPERVISOR \ |