aboutsummaryrefslogtreecommitdiff
path: root/riscv/csrs.cc
diff options
context:
space:
mode:
authorxinyuwang-sifive <1047913839@qq.com>2024-04-10 17:15:29 +0800
committerJerry Zhao <jerryz123@berkeley.edu>2024-04-29 13:30:07 -0700
commit10b97370eb588da957fd2fbfc8155261100d13bf (patch)
tree97aaded9540f22636995b363bbc22507d575cd07 /riscv/csrs.cc
parentb3bcc127f0d6d39607f1d081191a678c2956b736 (diff)
downloadriscv-isa-sim-10b97370eb588da957fd2fbfc8155261100d13bf.zip
riscv-isa-sim-10b97370eb588da957fd2fbfc8155261100d13bf.tar.gz
riscv-isa-sim-10b97370eb588da957fd2fbfc8155261100d13bf.tar.bz2
add hlvx pmp protect to fix issue 1557
Diffstat (limited to 'riscv/csrs.cc')
-rw-r--r--riscv/csrs.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/riscv/csrs.cc b/riscv/csrs.cc
index 2bd8b0d..31e05f2 100644
--- a/riscv/csrs.cc
+++ b/riscv/csrs.cc
@@ -180,7 +180,7 @@ bool pmpaddr_csr_t::subset_match(reg_t addr, reg_t len) const noexcept {
return !(is_tor ? tor_homogeneous : napot_homogeneous);
}
-bool pmpaddr_csr_t::access_ok(access_type type, reg_t mode) const noexcept {
+bool pmpaddr_csr_t::access_ok(access_type type, reg_t mode, bool hlvx) const noexcept {
const bool cfgx = cfg & PMP_X;
const bool cfgw = cfg & PMP_W;
const bool cfgr = cfg & PMP_R;
@@ -191,7 +191,7 @@ bool pmpaddr_csr_t::access_ok(access_type type, reg_t mode) const noexcept {
const bool typer = type == LOAD;
const bool typex = type == FETCH;
const bool typew = type == STORE;
- const bool normal_rwx = (typer && cfgr) || (typew && cfgw) || (typex && cfgx);
+ const bool normal_rwx = (typer && cfgr && (!hlvx || cfgx)) || (typew && cfgw) || (typex && cfgx);
const bool mseccfg_mml = state->mseccfg->get_mml();
if (mseccfg_mml) {