Skip to content

Commit 34601fc

Browse files
authored
Merge pull request #1736 from YenHaoChen/pr-hlvx-epmp
Fix ePMP checking on hlvx instructions
2 parents c0281a1 + 229b159 commit 34601fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

riscv/csrs.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ bool pmpaddr_csr_t::access_ok(access_type type, reg_t mode, bool hlvx) const noe
197197
if (mseccfg_mml) {
198198
if (cfgx && cfgw && cfgr && cfgl) {
199199
// Locked Shared data region: Read only on both M and S/U mode.
200-
return typer;
200+
return typer && !hlvx;
201201
} else {
202202
const bool mml_shared_region = !cfgr && cfgw;
203203
const bool mml_chk_normal = (prvm == cfgl) && normal_rwx;
204204
const bool mml_chk_shared =
205-
(!cfgl && cfgx && (typer || typew)) ||
206-
(!cfgl && !cfgx && (typer || (typew && prvm))) ||
205+
(!cfgl && cfgx && ((typer && !hlvx) || typew)) ||
206+
(!cfgl && !cfgx && ((typer && !hlvx) || (typew && prvm))) ||
207207
(cfgl && typex) ||
208208
(cfgl && typer && cfgx && prvm);
209209
return mml_shared_region ? mml_chk_shared : mml_chk_normal;

0 commit comments

Comments
 (0)