From 5939641a43a555cafbc53895049719a2aef0e9c8 Mon Sep 17 00:00:00 2001 From: marcfedorow Date: Mon, 16 Dec 2024 10:14:52 +0300 Subject: [PATCH] Save only usefull bits of pmpaddr Fixes #1876 --- riscv/csrs.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/riscv/csrs.cc b/riscv/csrs.cc index 83b9a4425..171d278d5 100644 --- a/riscv/csrs.cc +++ b/riscv/csrs.cc @@ -120,6 +120,7 @@ bool pmpaddr_csr_t::unlogged_write(const reg_t val) noexcept { if (pmpidx < proc->n_pmp && !locked && !next_locked_and_tor()) { this->val = val & ((reg_t(1) << (MAX_PADDR_BITS - PMP_SHIFT)) - 1); + this->val &= proc->pmp_tor_mask(); } else return false;