diff options
author | Atish Patra <atish.patra@wdc.com> | 2020-12-23 11:25:53 -0800 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2021-01-16 10:57:21 -0800 |
commit | d102f19a2085ac931cb998e6153b73248cca49f1 (patch) | |
tree | 27dd4ac7a7840c7a9d462869482c6f9ad76fce3f /target/riscv/pmp.c | |
parent | 1a475d39ef5467ca432c91beb67e9009304bb0bc (diff) |
target/riscv/pmp: Raise exception if no PMP entry is configured
As per the privilege specification, any access from S/U mode should fail
if no pmp region is configured.
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20201223192553.332508-1-atish.patra@wdc.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv/pmp.c')
-rw-r--r-- | target/riscv/pmp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index 2eda8e1e2f..80d0334e1b 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -74,7 +74,7 @@ static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index) /* * Count the number of active rules. */ -static inline uint32_t pmp_get_num_rules(CPURISCVState *env) +uint32_t pmp_get_num_rules(CPURISCVState *env) { return env->pmp_state.num_rules; } @@ -237,7 +237,7 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr, /* Short cut if no rules */ if (0 == pmp_get_num_rules(env)) { - return true; + return (env->priv == PRV_M) ? true : false; } if (size == 0) { |