aboutsummaryrefslogtreecommitdiff
path: root/c_emulator/riscv_sim.c
diff options
context:
space:
mode:
authorPrashanth Mundkur <prashanth.mundkur@gmail.com>2019-06-24 16:55:18 -0700
committerPrashanth Mundkur <prashanth.mundkur@gmail.com>2019-06-24 18:11:18 -0700
commitbbb65b3c3422d02989015a6135cf36107f10ad95 (patch)
tree98f7f7bc49e5a9779428eb6a38727e8913bb3b7b /c_emulator/riscv_sim.c
parent295175dd4d510cb416bdc4ef17c2ca96d84ed04e (diff)
downloadsail-riscv-bbb65b3c3422d02989015a6135cf36107f10ad95.zip
sail-riscv-bbb65b3c3422d02989015a6135cf36107f10ad95.tar.gz
sail-riscv-bbb65b3c3422d02989015a6135cf36107f10ad95.tar.bz2
Add PMP checks to physical memory accesses.
- unify AccessType and ReadType since they were essentially redundant, making it easier to implement PMP checks for ReadWrite/atomic accesses. - add command line options to enable PMP in the platform - also fix the matching for the case when all entries are off
Diffstat (limited to 'c_emulator/riscv_sim.c')
-rw-r--r--c_emulator/riscv_sim.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/c_emulator/riscv_sim.c b/c_emulator/riscv_sim.c
index d9a1c23..af0df02 100644
--- a/c_emulator/riscv_sim.c
+++ b/c_emulator/riscv_sim.c
@@ -75,6 +75,7 @@ int total_insns = 0;
static struct option options[] = {
{"enable-dirty-update", no_argument, 0, 'd'},
{"enable-misaligned", no_argument, 0, 'm'},
+ {"enable-pmp", no_argument, 0, 'P'},
{"ram-size", required_argument, 0, 'z'},
{"disable-compressed", no_argument, 0, 'C'},
{"disable-writable-misa", no_argument, 0, 'I'},
@@ -185,6 +186,10 @@ char *process_args(int argc, char **argv)
fprintf(stderr, "enabling misaligned access.\n");
rv_enable_misaligned = true;
break;
+ case 'P':
+ fprintf(stderr, "enabling PMP support.\n");
+ rv_enable_pmp = true;
+ break;
case 'C':
fprintf(stderr, "disabling RVC compressed instructions.\n");
rv_enable_rvc = false;