[PATCH 2/5] target/riscv: save ELP in MPELP for RNMI exceptions

[email protected]
Newsgroups org.nongnu.qemu-devel,org.nongnu.qemu-riscv
Message-ID <ce36a27e6346228b12c926a6f95835521ba56f86.1787489230.git.wangyang25@otcaix.iscas.ac.cn>
An M-mode exception with mnstatus.NMIE clear uses the RNMI vector, but
Smrnmi otherwise specifies the normal M-mode state updates. MRET restores
ELP from mstatus.MPELP, so save it there rather than in MNPELP.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4223

Signed-off-by: wangyang <[email protected]>
---
 target/riscv/tcg/cpu_helper.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/target/riscv/tcg/cpu_helper.c b/target/riscv/tcg/cpu_helper.c
index 07d9222..6337e91 100644
--- a/target/riscv/tcg/cpu_helper.c
+++ b/target/riscv/tcg/cpu_helper.c
@@ -2275,12 +2275,7 @@ void riscv_cpu_do_interrupt(CPUState *cs)
         /* handle the trap in M-mode */
         /* save elp status */
         if (cpu_get_fcfien(env)) {
-            if (nnmi_excep) {
-                env->mnstatus = set_field(env->mnstatus, MNSTATUS_MNPELP,
-                                          env->elp);
-            } else {
-                env->mstatus = set_field(env->mstatus, MSTATUS_MPELP, env->elp);
-            }
+            env->mstatus = set_field(env->mstatus, MSTATUS_MPELP, env->elp);
         }
 
         if (riscv_has_ext(env, RVH)) {
-- 
2.55.0.windows.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.