render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0013-target-s390x-avoid-AREG0-for-condition-code-helpers.patch

5544c1
From ead7a100e907eddd0ba9f3cebb5f84c1afb120b8 Mon Sep 17 00:00:00 2001
5544c1
From: Blue Swirl <blauwirbel@gmail.com>
5544c1
Date: Sun, 2 Sep 2012 07:33:38 +0000
5544c1
Subject: [PATCH] target-s390x: avoid AREG0 for condition code helpers
5544c1
5544c1
Make condition code helpers take a parameter for CPUState instead
5544c1
of relying on global env.
5544c1
5544c1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
5544c1
Signed-off-by: Alexander Graf <agraf@suse.de>
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 target-s390x/Makefile.objs |  1 -
5544c1
 target-s390x/cc_helper.c   | 11 +++++------
5544c1
 target-s390x/helper.h      | 10 +++++-----
5544c1
 target-s390x/translate.c   | 16 ++++++++--------
5544c1
 4 files changed, 18 insertions(+), 20 deletions(-)
5544c1
5544c1
diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs
5544c1
index 7b2c5c1..736cf33 100644
5544c1
--- a/target-s390x/Makefile.objs
5544c1
+++ b/target-s390x/Makefile.objs
5544c1
@@ -3,6 +3,5 @@ obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o
5544c1
 obj-$(CONFIG_SOFTMMU) += machine.o
5544c1
 obj-$(CONFIG_KVM) += kvm.o
5544c1
 
5544c1
-$(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
5544c1
 $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
5544c1
 $(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
5544c1
diff --git a/target-s390x/cc_helper.c b/target-s390x/cc_helper.c
5544c1
index 9c3a2c4..19ef145 100644
5544c1
--- a/target-s390x/cc_helper.c
5544c1
+++ b/target-s390x/cc_helper.c
5544c1
@@ -19,7 +19,6 @@
5544c1
  */
5544c1
 
5544c1
 #include "cpu.h"
5544c1
-#include "dyngen-exec.h"
5544c1
 #include "helper.h"
5544c1
 
5544c1
 /* #define DEBUG_HELPER */
5544c1
@@ -500,14 +499,14 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,
5544c1
     return do_calc_cc(env, cc_op, src, dst, vr);
5544c1
 }
5544c1
 
5544c1
-uint32_t HELPER(calc_cc)(uint32_t cc_op, uint64_t src, uint64_t dst,
5544c1
-                         uint64_t vr)
5544c1
+uint32_t HELPER(calc_cc)(CPUS390XState *env, uint32_t cc_op, uint64_t src,
5544c1
+                         uint64_t dst, uint64_t vr)
5544c1
 {
5544c1
     return do_calc_cc(env, cc_op, src, dst, vr);
5544c1
 }
5544c1
 
5544c1
 /* insert psw mask and condition code into r1 */
5544c1
-void HELPER(ipm)(uint32_t cc, uint32_t r1)
5544c1
+void HELPER(ipm)(CPUS390XState *env, uint32_t cc, uint32_t r1)
5544c1
 {
5544c1
     uint64_t r = env->regs[r1];
5544c1
 
5544c1
@@ -519,13 +518,13 @@ void HELPER(ipm)(uint32_t cc, uint32_t r1)
5544c1
 }
5544c1
 
5544c1
 #ifndef CONFIG_USER_ONLY
5544c1
-void HELPER(load_psw)(uint64_t mask, uint64_t addr)
5544c1
+void HELPER(load_psw)(CPUS390XState *env, uint64_t mask, uint64_t addr)
5544c1
 {
5544c1
     load_psw(env, mask, addr);
5544c1
     cpu_loop_exit(env);
5544c1
 }
5544c1
 
5544c1
-void HELPER(sacf)(uint64_t a1)
5544c1
+void HELPER(sacf)(CPUS390XState *env, uint64_t a1)
5544c1
 {
5544c1
     HELPER_LOG("%s: %16" PRIx64 "\n", __func__, a1);
5544c1
 
5544c1
diff --git a/target-s390x/helper.h b/target-s390x/helper.h
5544c1
index c03cd59..876b88e 100644
5544c1
--- a/target-s390x/helper.h
5544c1
+++ b/target-s390x/helper.h
5544c1
@@ -36,7 +36,7 @@ DEF_HELPER_FLAGS_1(abs_i64, TCG_CALL_PURE|TCG_CALL_CONST, i64, s64)
5544c1
 DEF_HELPER_FLAGS_1(nabs_i64, TCG_CALL_PURE|TCG_CALL_CONST, s64, s64)
5544c1
 DEF_HELPER_3(stcmh, void, i32, i64, i32)
5544c1
 DEF_HELPER_3(icmh, i32, i32, i64, i32)
5544c1
-DEF_HELPER_2(ipm, void, i32, i32)
5544c1
+DEF_HELPER_3(ipm, void, env, i32, i32)
5544c1
 DEF_HELPER_FLAGS_3(addc_u32, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32, i32)
5544c1
 DEF_HELPER_FLAGS_3(set_cc_addc_u64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)
5544c1
 DEF_HELPER_3(stam, void, i32, i64, i32)
5544c1
@@ -115,7 +115,7 @@ DEF_HELPER_3(tr, void, i32, i64, i64)
5544c1
 
5544c1
 DEF_HELPER_2(servc, i32, i32, i64)
5544c1
 DEF_HELPER_3(diag, i64, i32, i64, i64)
5544c1
-DEF_HELPER_2(load_psw, void, i64, i64)
5544c1
+DEF_HELPER_3(load_psw, void, env, i64, i64)
5544c1
 DEF_HELPER_1(program_interrupt, void, i32)
5544c1
 DEF_HELPER_FLAGS_1(stidp, TCG_CALL_CONST, void, i64)
5544c1
 DEF_HELPER_FLAGS_1(spx, TCG_CALL_CONST, void, i64)
5544c1
@@ -139,14 +139,14 @@ DEF_HELPER_2(csp, i32, i32, i32)
5544c1
 DEF_HELPER_3(mvcs, i32, i64, i64, i64)
5544c1
 DEF_HELPER_3(mvcp, i32, i64, i64, i64)
5544c1
 DEF_HELPER_3(sigp, i32, i64, i32, i64)
5544c1
-DEF_HELPER_1(sacf, void, i64)
5544c1
+DEF_HELPER_2(sacf, void, env, i64)
5544c1
 DEF_HELPER_FLAGS_2(ipte, TCG_CALL_CONST, void, i64, i64)
5544c1
 DEF_HELPER_FLAGS_0(ptlb, TCG_CALL_CONST, void)
5544c1
 DEF_HELPER_2(lra, i32, i64, i32)
5544c1
 DEF_HELPER_2(stura, void, i64, i32)
5544c1
 DEF_HELPER_2(cksm, void, i32, i32)
5544c1
 
5544c1
-DEF_HELPER_FLAGS_4(calc_cc, TCG_CALL_PURE|TCG_CALL_CONST,
5544c1
-                   i32, i32, i64, i64, i64)
5544c1
+DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_PURE|TCG_CALL_CONST,
5544c1
+                   i32, env, i32, i64, i64, i64)
5544c1
 
5544c1
 #include "def-helper.h"
5544c1
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
5544c1
index 2a61e92..1d87272 100644
5544c1
--- a/target-s390x/translate.c
5544c1
+++ b/target-s390x/translate.c
5544c1
@@ -722,7 +722,7 @@ static void gen_op_calc_cc(DisasContext *s)
5544c1
     case CC_OP_NZ_F32:
5544c1
     case CC_OP_NZ_F64:
5544c1
         /* 1 argument */
5544c1
-        gen_helper_calc_cc(cc_op, local_cc_op, dummy, cc_dst, dummy);
5544c1
+        gen_helper_calc_cc(cc_op, cpu_env, local_cc_op, dummy, cc_dst, dummy);
5544c1
         break;
5544c1
     case CC_OP_ICM:
5544c1
     case CC_OP_LTGT_32:
5544c1
@@ -735,7 +735,7 @@ static void gen_op_calc_cc(DisasContext *s)
5544c1
     case CC_OP_LTGT_F64:
5544c1
     case CC_OP_SLAG:
5544c1
         /* 2 arguments */
5544c1
-        gen_helper_calc_cc(cc_op, local_cc_op, cc_src, cc_dst, dummy);
5544c1
+        gen_helper_calc_cc(cc_op, cpu_env, local_cc_op, cc_src, cc_dst, dummy);
5544c1
         break;
5544c1
     case CC_OP_ADD_64:
5544c1
     case CC_OP_ADDU_64:
5544c1
@@ -746,11 +746,11 @@ static void gen_op_calc_cc(DisasContext *s)
5544c1
     case CC_OP_SUB_32:
5544c1
     case CC_OP_SUBU_32:
5544c1
         /* 3 arguments */
5544c1
-        gen_helper_calc_cc(cc_op, local_cc_op, cc_src, cc_dst, cc_vr);
5544c1
+        gen_helper_calc_cc(cc_op, cpu_env, local_cc_op, cc_src, cc_dst, cc_vr);
5544c1
         break;
5544c1
     case CC_OP_DYNAMIC:
5544c1
         /* unknown operation - assume 3 arguments and cc_op in env */
5544c1
-        gen_helper_calc_cc(cc_op, cc_op, cc_src, cc_dst, cc_vr);
5544c1
+        gen_helper_calc_cc(cc_op, cpu_env, cc_op, cc_src, cc_dst, cc_vr);
5544c1
         break;
5544c1
     default:
5544c1
         tcg_abort();
5544c1
@@ -2628,7 +2628,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)
5544c1
     case 0x22: /* IPM    R1               [RRE] */
5544c1
         tmp32_1 = tcg_const_i32(r1);
5544c1
         gen_op_calc_cc(s);
5544c1
-        gen_helper_ipm(cc_op, tmp32_1);
5544c1
+        gen_helper_ipm(cpu_env, cc_op, tmp32_1);
5544c1
         tcg_temp_free_i32(tmp32_1);
5544c1
         break;
5544c1
     case 0x41: /* CKSM    R1,R2     [RRE] */
5544c1
@@ -2916,7 +2916,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)
5544c1
         decode_rs(s, insn, &r1, &r3, &b2, &d2;;
5544c1
         tmp = get_address(s, 0, b2, d2);
5544c1
         potential_page_fault(s);
5544c1
-        gen_helper_sacf(tmp);
5544c1
+        gen_helper_sacf(cpu_env, tmp);
5544c1
         tcg_temp_free_i64(tmp);
5544c1
         /* addressing mode has changed, so end the block */
5544c1
         s->pc += ilc * 2;
5544c1
@@ -2967,7 +2967,7 @@ static void disas_b2(DisasContext *s, int op, uint32_t insn)
5544c1
         tcg_gen_qemu_ld64(tmp2, tmp, get_mem_index(s));
5544c1
         tcg_gen_addi_i64(tmp, tmp, 8);
5544c1
         tcg_gen_qemu_ld64(tmp3, tmp, get_mem_index(s));
5544c1
-        gen_helper_load_psw(tmp2, tmp3);
5544c1
+        gen_helper_load_psw(cpu_env, tmp2, tmp3);
5544c1
         /* we need to keep cc_op intact */
5544c1
         s->is_jmp = DISAS_JUMP;
5544c1
         tcg_temp_free_i64(tmp);
5544c1
@@ -4527,7 +4527,7 @@ static void disas_s390_insn(DisasContext *s)
5544c1
         tcg_gen_qemu_ld32u(tmp2, tmp, get_mem_index(s));
5544c1
         tcg_gen_addi_i64(tmp, tmp, 4);
5544c1
         tcg_gen_qemu_ld32u(tmp3, tmp, get_mem_index(s));
5544c1
-        gen_helper_load_psw(tmp2, tmp3);
5544c1
+        gen_helper_load_psw(cpu_env, tmp2, tmp3);
5544c1
         tcg_temp_free_i64(tmp);
5544c1
         tcg_temp_free_i64(tmp2);
5544c1
         tcg_temp_free_i64(tmp3);
5544c1
-- 
5544c1
1.7.12.1
5544c1