qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 29/35] target/mips: Fix ERET/ERETNC can cause ADEL e


From: Yongbok Kim
Subject: [Qemu-devel] [PATCH 29/35] target/mips: Fix ERET/ERETNC can cause ADEL exception
Date: Wed, 20 Jun 2018 13:06:14 +0100

From: Yongbok Kim <address@hidden>

Fix ERET/ERETNC can cause ADEL exception

Signed-off-by: Yongbok Kim <address@hidden>
---
 target/mips/op_helper.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
index 6f5e5a3..09ec20a 100644
--- a/target/mips/op_helper.c
+++ b/target/mips/op_helper.c
@@ -2434,6 +2434,13 @@ static void set_pc(CPUMIPSState *env, target_ulong 
error_pc)
     env->active_tc.PC = error_pc & ~(target_ulong)1;
     if (env->insn_flags & ISA_NANOMIPS32) {
         /* Don't clear MIPS_HFLAG_M16 */
+        if (error_pc & 1) {
+            if (!(env->hflags & MIPS_HFLAG_DM)) {
+                env->CP0_BadVAddr = error_pc;
+            }
+            env->active_tc.PC = error_pc;
+            do_raise_exception(env, EXCP_AdEL, 0);
+        }
         return;
     }
     if (error_pc & 1) {
@@ -2471,10 +2478,12 @@ void helper_eretnc(CPUMIPSState *env)
 void helper_deret(CPUMIPSState *env)
 {
     debug_pre_eret(env);
-    set_pc(env, env->CP0_DEPC);
 
     env->hflags &= ~MIPS_HFLAG_DM;
     compute_hflags(env);
+
+    set_pc(env, env->CP0_DEPC);
+
     debug_post_eret(env);
 }
 #endif /* !CONFIG_USER_ONLY */
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]