Browse Source

Merge pull request #1736 from YenHaoChen/pr-hlvx-epmp

Fix ePMP checking on hlvx instructions
pull/1741/head
Andrew Waterman 2 years ago
committed by GitHub
parent
commit
34601fc488
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      riscv/csrs.cc

6
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;

Loading…
Cancel
Save