diff options
author | Scott Johnson <scott.johnson@arilinc.com> | 2021-02-23 17:40:39 -0800 |
---|---|---|
committer | Andrew Waterman <aswaterman@gmail.com> | 2021-09-08 07:59:02 -0700 |
commit | d9bd31becc124d3334f6fb0908d09d2cd8b06dd1 (patch) | |
tree | b093c47a8dc4b2d886767e41a2ae5f64f706c145 /riscv/mmu.cc | |
parent | 95824344eb56097e9bb45cab9d22ab370908c2ff (diff) | |
download | riscv-isa-sim-d9bd31becc124d3334f6fb0908d09d2cd8b06dd1.zip riscv-isa-sim-d9bd31becc124d3334f6fb0908d09d2cd8b06dd1.tar.gz riscv-isa-sim-d9bd31becc124d3334f6fb0908d09d2cd8b06dd1.tar.bz2 |
Add new method match4()
To simplify calling code.
Diffstat (limited to 'riscv/mmu.cc')
-rw-r--r-- | riscv/mmu.cc | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc index be3d3e0..c315a53 100644 --- a/riscv/mmu.cc +++ b/riscv/mmu.cc @@ -221,21 +221,16 @@ reg_t mmu_t::pmp_ok(reg_t addr, reg_t len, access_type type, reg_t mode) return true; for (size_t i = 0; i < proc->n_pmp; i++) { - reg_t base = proc->state.pmpaddr[i]->tor_base_paddr(); - reg_t tor = proc->state.pmpaddr[i]->tor_paddr(); uint8_t cfg = proc->state.pmpcfg[i]; if (cfg & PMP_A) { - bool is_tor = (cfg & PMP_A) == PMP_TOR; // Check each 4-byte sector of the access bool any_match = false; bool all_match = true; for (reg_t offset = 0; offset < len; offset += 1 << PMP_SHIFT) { reg_t cur_addr = addr + offset; - bool napot_match = ((cur_addr ^ tor) & proc->state.pmpaddr[i]->napot_mask()) == 0; - bool tor_match = base <= cur_addr && cur_addr < tor; - bool match = is_tor ? tor_match : napot_match; + bool match = proc->state.pmpaddr[i]->match4(cur_addr); any_match |= match; all_match &= match; } |