From: Alistair Francis Date: Fri, 24 Apr 2020 01:47:38 +0000 (-0700) Subject: target/riscv: Use a smaller guess size for no-MMU PMP X-Git-Tag: v5.1.0-rc0~58^2~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1145188e091aa4675b09882b6bd500c50b87547f;p=thirdparty%2Fqemu.git target/riscv: Use a smaller guess size for no-MMU PMP Signed-off-by: Alistair Francis Reviewed-by: Bin Meng --- diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index 0e6b640fbd8..9418660f1bd 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -233,12 +233,16 @@ 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 { + pmp_size = sizeof(target_ulong); + } } else { pmp_size = size; }