correct size usage in pmp addr checks

This commit is contained in:
Maribel Gomez 2021-11-22 15:15:47 +01:00
parent 974d103381
commit 86da31033c

View File

@ -581,7 +581,7 @@ template <typename BASE, features_e FEAT> bool riscv_hart_mu_p<BASE, FEAT>::pmp_
for (reg_t offset = 0; offset < len; offset += 1 << PMP_SHIFT) {
reg_t cur_addr = addr + offset;
auto napot_match = ((cur_addr ^ tor) & mask) == 0;
auto tor_match = base <= cur_addr && cur_addr < tor;
auto tor_match = base <= (cur_addr+len-1) && cur_addr < tor;
auto match = is_tor ? tor_match : napot_match;
any_match |= match;
all_match &= match;