Commit 1145188e authored by Alistair Francis's avatar Alistair Francis
Browse files

target/riscv: Use a smaller guess size for no-MMU PMP

parent cc411260
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -233,12 +233,16 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
        return true;
    }

    if (size == 0) {
        if (riscv_feature(env, RISCV_FEATURE_MMU)) {
            /*
     * if size is unknown (0), assume that all bytes
             * 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);
        } else {
            pmp_size = sizeof(target_ulong);
        }
    } else {
        pmp_size = size;
    }