aboutsummaryrefslogtreecommitdiff
path: root/target/riscv
diff options
context:
space:
mode:
authorWeiwei Li <liweiwei@iscas.ac.cn>2023-05-17 17:15:19 +0800
committerAlistair Francis <alistair.francis@wdc.com>2023-06-13 17:15:40 +1000
commit89fbbaddfb33556f3f669d40f917c65e75ea6768 (patch)
tree50c699f162696c3a256f9d44ec9417138f1f402e /target/riscv
parent1b63f2fee68e28566c218bdf34988f8c5978b1e4 (diff)
downloadqemu-89fbbaddfb33556f3f669d40f917c65e75ea6768.zip
qemu-89fbbaddfb33556f3f669d40f917c65e75ea6768.tar.gz
qemu-89fbbaddfb33556f3f669d40f917c65e75ea6768.tar.bz2
target/riscv: Deny access if access is partially inside the PMP entry
Access will fail if access is partially inside the PMP entry. However,only setting ret = false doesn't really mean pmp violation since pmp_hart_has_privs_default() may return true at the end of pmp_hart_has_privs(). Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn> Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20230517091519.34439-13-liweiwei@iscas.ac.cn> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv')
-rw-r--r--target/riscv/pmp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
index 37e9985..418738a 100644
--- a/target/riscv/pmp.c
+++ b/target/riscv/pmp.c
@@ -327,8 +327,8 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
if ((s + e) == 1) {
qemu_log_mask(LOG_GUEST_ERROR,
"pmp violation - access is partially inside\n");
- ret = false;
- break;
+ *allowed_privs = 0;
+ return false;
}
/* fully inside */