[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 9/9] target/riscv: Use a smaller guess size for no-MMU PMP
From: |
Alistair Francis |
Subject: |
[PATCH v1 9/9] target/riscv: Use a smaller guess size for no-MMU PMP |
Date: |
Sat, 25 Apr 2020 04:29:33 -0700 |
From: Alistair Francis <address@hidden>
Signed-off-by: Alistair Francis <address@hidden>
---
target/riscv/pmp.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
index 0e6b640fbd..5aba4d13ea 100644
--- a/target/riscv/pmp.c
+++ b/target/riscv/pmp.c
@@ -233,12 +233,21 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong
addr,
return true;
}
- /*
- * if size is unknown (0), assume that all bytes
- * from addr to the end of the page will be accessed.
- */
if (size == 0) {
- pmp_size = -(addr | TARGET_PAGE_MASK);
+ if (!riscv_feature(env, RISCV_FEATURE_MMU)) {
+ /*
+ * if size is unknown (0), assume that all bytes
+ * from addr to the end of the page will be accessed.
+ */
+ pmp_size = -(addr | TARGET_PAGE_MASK);
+ } else {
+ /*
+ * If size is unknown (0) and we don't have an MMU,
+ * just guess the size as the xlen as we don't want to
+ * access an entire page worth.
+ */
+ pmp_size = sizeof(target_ulong);
+ }
} else {
pmp_size = size;
}
--
2.26.2
- [PATCH v1 0/9] RISC-V Add the OpenTitan Machine, Alistair Francis, 2020/04/26
- [PATCH v1 1/9] riscv/boot: Add a missing header include, Alistair Francis, 2020/04/26
- [PATCH v1 2/9] target/riscv: Don't overwrite the reset vector, Alistair Francis, 2020/04/26
- [PATCH v1 3/9] target/riscv: Add the lowRISC Ibex CPU, Alistair Francis, 2020/04/26
- [PATCH v1 5/9] hw/char: Initial commit of Ibex UART, Alistair Francis, 2020/04/26
- [PATCH v1 4/9] riscv: Initial commit of OpenTitan machine, Alistair Francis, 2020/04/26
- [PATCH v1 8/9] riscv/opentitan: Connect the UART device, Alistair Francis, 2020/04/26
- [PATCH v1 6/9] hw/intc: Initial commit of lowRISC Ibex PLIC, Alistair Francis, 2020/04/26
- [PATCH v1 7/9] riscv/opentitan: Connect the PLIC device, Alistair Francis, 2020/04/26
- [PATCH v1 9/9] target/riscv: Use a smaller guess size for no-MMU PMP,
Alistair Francis <=