diff options
author | Andrew Waterman <andrew@sifive.com> | 2020-05-09 23:58:09 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2020-05-09 23:58:09 -0700 |
commit | 43cfe9584638054ae25cc3c952d160277171cc26 (patch) | |
tree | c5fa0ee6e79b24ba92105a1bdbc58246a399d0f1 /riscv/sim.cc | |
parent | e551131e559d7a8ddac4db13420fd95f0042c426 (diff) | |
download | riscv-isa-sim-43cfe9584638054ae25cc3c952d160277171cc26.zip riscv-isa-sim-43cfe9584638054ae25cc3c952d160277171cc26.tar.gz riscv-isa-sim-43cfe9584638054ae25cc3c952d160277171cc26.tar.bz2 |
Support consuming PMP number and granularity from DTB
The feature itself isn't implemented yet.
Diffstat (limited to 'riscv/sim.cc')
-rw-r--r-- | riscv/sim.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/riscv/sim.cc b/riscv/sim.cc index 18df394..b25d79e 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -89,6 +89,15 @@ sim_t::sim_t(const char* isa, const char* priv, const char* varch, } else { bus.add_device(clint_base, clint.get()); } + + for (size_t i = 0; i < nprocs; i++) { + reg_t pmp_num = 0, pmp_granularity = 0; + fdt_parse_pmp_num((void *)dtb.c_str(), &pmp_num, "riscv"); + fdt_parse_pmp_alignment((void *)dtb.c_str(), &pmp_granularity, "riscv"); + + procs[i]->set_pmp_num(pmp_num); + procs[i]->set_pmp_granularity(pmp_granularity); + } } sim_t::~sim_t() |