aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2024-07-17 17:40:50 -0700
committerGitHub <noreply@github.com>2024-07-17 17:40:50 -0700
commit34601fc48851e49f7ecbbd87405b8b7afcc4e59b (patch)
treee72adf89369bed2adb8d84bd74c3db05283c01cd
parentc0281a17d6473137c243ebd093711adb95024e68 (diff)
parent229b159465bf23b20cc29879d0c68acc8fc792f6 (diff)
downloadspike-34601fc48851e49f7ecbbd87405b8b7afcc4e59b.zip
spike-34601fc48851e49f7ecbbd87405b8b7afcc4e59b.tar.gz
spike-34601fc48851e49f7ecbbd87405b8b7afcc4e59b.tar.bz2
Merge pull request #1736 from YenHaoChen/pr-hlvx-epmp
Fix ePMP checking on hlvx instructions
-rw-r--r--riscv/csrs.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/riscv/csrs.cc b/riscv/csrs.cc
index 2bb255d..068c640 100644
--- a/riscv/csrs.cc
+++ b/riscv/csrs.cc
@@ -197,13 +197,13 @@ bool pmpaddr_csr_t::access_ok(access_type type, reg_t mode, bool hlvx) const noe
if (mseccfg_mml) {
if (cfgx && cfgw && cfgr && cfgl) {
// Locked Shared data region: Read only on both M and S/U mode.
- return typer;
+ return typer && !hlvx;
} else {
const bool mml_shared_region = !cfgr && cfgw;
const bool mml_chk_normal = (prvm == cfgl) && normal_rwx;
const bool mml_chk_shared =
- (!cfgl && cfgx && (typer || typew)) ||
- (!cfgl && !cfgx && (typer || (typew && prvm))) ||
+ (!cfgl && cfgx && ((typer && !hlvx) || typew)) ||
+ (!cfgl && !cfgx && ((typer && !hlvx) || (typew && prvm))) ||
(cfgl && typex) ||
(cfgl && typer && cfgx && prvm);
return mml_shared_region ? mml_chk_shared : mml_chk_normal;