qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Sparc32: Mask writes to the WIM register


From: Luis Pureza
Subject: [Qemu-devel] Sparc32: Mask writes to the WIM register
Date: Tue, 19 Aug 2008 14:27:15 +0100

The following patch, for Sparc32, correctly masks the WIM register, so
that bits relative to non-existent windows remain cleared.
This fixes a problem I was having with RTEMS.

Cheers,

Luis Pureza

--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -2289,6 +2289,16 @@ target_ulong helper_rdpsr(void)
     return GET_PSR(env);
 }

+void helper_wrwim(target_ulong new_wim)
+{
+    if (env->nwindows == 32) {
+        env->wim = new_wim;
+    } else {
+        env->wim = new_wim & ((1 << env->nwindows) - 1);
+    }
+}
+
 #else
 /* XXX: use another pointer for %iN registers to avoid slow wrapping
    handling ? */
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -3487,9 +3487,9 @@ static void disas_sparc_insn(DisasContext * dc)
                                 goto illegal_insn;
                             }
 #else
                             tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0);
-                            tcg_gen_st_i32(cpu_tmp32, cpu_env,
-                                           offsetof(CPUSPARCState, wim));
+                            tcg_gen_helper_0_1(helper_wrwim, cpu_tmp32);
 #endif
                         }
                         break;




reply via email to

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