diff options
author | Andrew Waterman <andrew@sifive.com> | 2024-05-26 18:05:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-26 18:05:35 -0700 |
commit | 4611b1f7f9243339d9b6a29eeed917416ada167f (patch) | |
tree | a24c531c55fc0531a178c8466f5b72744f99ea5b | |
parent | 2cfd5393520c0673fd0182fcca430351d9e6682d (diff) | |
parent | 853105c659094122ef0769780645848646a4f463 (diff) | |
download | spike-4611b1f7f9243339d9b6a29eeed917416ada167f.zip spike-4611b1f7f9243339d9b6a29eeed917416ada167f.tar.gz spike-4611b1f7f9243339d9b6a29eeed917416ada167f.tar.bz2 |
Merge pull request #1675 from chihminchao/cfi-fix
zicflip: fix [ms]ret behavior
-rw-r--r-- | riscv/insns/mret.h | 2 | ||||
-rw-r--r-- | riscv/insns/sret.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/riscv/insns/mret.h b/riscv/insns/mret.h index 1133e86..6d4d59f 100644 --- a/riscv/insns/mret.h +++ b/riscv/insns/mret.h @@ -11,8 +11,8 @@ s = set_field(s, MSTATUS_MPP, p->extension_enabled('U') ? PRV_U : PRV_M); s = set_field(s, MSTATUS_MPV, 0); if (ZICFILP_xLPE(prev_virt, prev_prv)) { STATE.elp = static_cast<elp_t>(get_field(s, MSTATUS_MPELP)); - s = set_field(s, MSTATUS_MPELP, elp_t::NO_LP_EXPECTED); } +s = set_field(s, MSTATUS_MPELP, elp_t::NO_LP_EXPECTED); STATE.mstatus->write(s); if (STATE.mstatush) STATE.mstatush->write(s >> 32); // log mstatush change p->set_privilege(prev_prv, prev_virt); diff --git a/riscv/insns/sret.h b/riscv/insns/sret.h index aeaf087..23a13b5 100644 --- a/riscv/insns/sret.h +++ b/riscv/insns/sret.h @@ -25,7 +25,7 @@ if (!STATE.v) { } if (ZICFILP_xLPE(prev_virt, prev_prv)) { STATE.elp = static_cast<elp_t>(get_field(s, SSTATUS_SPELP)); - s = set_field(s, SSTATUS_SPELP, elp_t::NO_LP_EXPECTED); } +s = set_field(s, SSTATUS_SPELP, elp_t::NO_LP_EXPECTED); STATE.sstatus->write(s); p->set_privilege(prev_prv, prev_virt); |