Patchwork [109/147] target-s390: Convert STURA

login
register
mail settings
Submitter Richard Henderson
Date Sept. 28, 2012, 12:44 a.m.
Message ID <1348793067-27401-1-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/187632/
State New
Headers show

Comments

Richard Henderson - Sept. 28, 2012, 12:44 a.m.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-s390x/helper.h      |  2 +-
 target-s390x/insn-data.def |  2 ++
 target-s390x/mem_helper.c  |  4 ++--
 target-s390x/translate.c   | 20 ++++++++------------
 4 files changed, 13 insertions(+), 15 deletions(-)

Patch

diff --git a/target-s390x/helper.h b/target-s390x/helper.h
index 0b8e7a9..0a2cd7c 100644
--- a/target-s390x/helper.h
+++ b/target-s390x/helper.h
@@ -109,7 +109,7 @@  DEF_HELPER_2(sacf, void, env, i64)
 DEF_HELPER_FLAGS_3(ipte, TCG_CALL_CONST, void, env, i64, i64)
 DEF_HELPER_FLAGS_1(ptlb, TCG_CALL_CONST, void, env)
 DEF_HELPER_2(lra, i64, env, i64)
-DEF_HELPER_3(stura, void, env, i64, i32)
+DEF_HELPER_3(stura, void, env, i64, i64)
 #endif
 
 #include "def-helper.h"
diff --git a/target-s390x/insn-data.def b/target-s390x/insn-data.def
index 24a419c..8e457cb 100644
--- a/target-s390x/insn-data.def
+++ b/target-s390x/insn-data.def
@@ -678,6 +678,8 @@ 
     C(0xac00, STNSM,   SI,    Z,   la1, 0, 0, 0, stnosm, 0)
 /* STORE THEN OR SYSTEM MASK */
     C(0xad00, STOSM,   SI,    Z,   la1, 0, 0, 0, stnosm, 0)
+/* STORE USING REAL ADDRESS */
+    C(0xb246, STURA,   RRE,   Z,   r1_o, r2_o, 0, 0, stura, 0)
 /* TEST PROTECTION */
     C(0xe501, TPROT,   SSE,   Z,   la1, a2, 0, 0, tprot, 0)
 
diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c
index 1a32436..b8e4681 100644
--- a/target-s390x/mem_helper.c
+++ b/target-s390x/mem_helper.c
@@ -1099,9 +1099,9 @@  void HELPER(ptlb)(CPUS390XState *env)
 }
 
 /* store using real address */
-void HELPER(stura)(CPUS390XState *env, uint64_t addr, uint32_t v1)
+void HELPER(stura)(CPUS390XState *env, uint64_t addr, uint64_t v1)
 {
-    stw_phys(get_address(env, 0, 0, addr), v1);
+    stw_phys(get_address(env, 0, 0, addr), (uint32_t)v1);
 }
 
 /* load real address */
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index 334d4ea..f1546a7 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -1033,18 +1033,6 @@  static void disas_b2(CPUS390XState *env, DisasContext *s, int op,
     LOG_DISAS("disas_b2: op 0x%x r1 %d r2 %d\n", op, r1, r2);
 
     switch (op) {
-    case 0x46: /* STURA    R1,R2      [RRE] */
-        /* Store Using Real Address */
-        check_privileged(s);
-        r1 = (insn >> 4) & 0xf;
-        r2 = insn & 0xf;
-        tmp32_1 = load_reg32(r1);
-        tmp = load_reg(r2);
-        potential_page_fault(s);
-        gen_helper_stura(cpu_env, tmp, tmp32_1);
-        tcg_temp_free_i32(tmp32_1);
-        tcg_temp_free_i64(tmp);
-        break;
     case 0x50: /* CSP      R1,R2      [RRE] */
         /* Compare And Swap And Purge */
         check_privileged(s);
@@ -2945,6 +2933,14 @@  static ExitStatus op_stnosm(DisasContext *s, DisasOps *o)
     }
     return NO_EXIT;
 }
+
+static ExitStatus op_stura(DisasContext *s, DisasOps *o)
+{
+    check_privileged(s);
+    potential_page_fault(s);
+    gen_helper_stura(cpu_env, o->in2, o->in1);
+    return NO_EXIT;
+}
 #endif
 
 static ExitStatus op_st8(DisasContext *s, DisasOps *o)