]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
target/riscv: Use a smaller guess size for no-MMU PMP
authorAlistair Francis <alistair.francis@wdc.com>
Fri, 24 Apr 2020 01:47:38 +0000 (18:47 -0700)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 19 Jun 2020 15:24:07 +0000 (08:24 -0700)
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
target/riscv/pmp.c

index 0e6b640fbd8711eafdfc24ff40634502a23d0bbf..9418660f1bd31f26f6605b3f599c34d3de7676e9 100644 (file)
@@ -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;
     }