|
|
5544c1 |
From d44b8c2cacaa50e7420f0dfaf42c344bcf134431 Mon Sep 17 00:00:00 2001
|
|
|
5544c1 |
From: Blue Swirl <blauwirbel@gmail.com>
|
|
|
5544c1 |
Date: Sun, 2 Sep 2012 07:33:37 +0000
|
|
|
5544c1 |
Subject: [PATCH] target-s390x: avoid AREG0 for integer helpers
|
|
|
5544c1 |
|
|
|
5544c1 |
Make integer 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/helper.h | 10 +++++-----
|
|
|
5544c1 |
target-s390x/int_helper.c | 12 ++++++------
|
|
|
5544c1 |
target-s390x/translate.c | 16 ++++++++--------
|
|
|
5544c1 |
4 files changed, 19 insertions(+), 20 deletions(-)
|
|
|
5544c1 |
|
|
|
5544c1 |
diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs
|
|
|
5544c1 |
index 7d965e9..7b2c5c1 100644
|
|
|
5544c1 |
--- a/target-s390x/Makefile.objs
|
|
|
5544c1 |
+++ b/target-s390x/Makefile.objs
|
|
|
5544c1 |
@@ -3,7 +3,6 @@ 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)/int_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
|
|
|
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/helper.h b/target-s390x/helper.h
|
|
|
5544c1 |
index af98773..c03cd59 100644
|
|
|
5544c1 |
--- a/target-s390x/helper.h
|
|
|
5544c1 |
+++ b/target-s390x/helper.h
|
|
|
5544c1 |
@@ -12,8 +12,8 @@ DEF_HELPER_FLAGS_1(set_cc_comp_s64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64)
|
|
|
5544c1 |
DEF_HELPER_FLAGS_2(set_cc_icm, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32)
|
|
|
5544c1 |
DEF_HELPER_3(clm, i32, i32, i32, i64)
|
|
|
5544c1 |
DEF_HELPER_3(stcm, void, i32, i32, i64)
|
|
|
5544c1 |
-DEF_HELPER_2(mlg, void, i32, i64)
|
|
|
5544c1 |
-DEF_HELPER_2(dlg, void, i32, i64)
|
|
|
5544c1 |
+DEF_HELPER_3(mlg, void, env, i32, i64)
|
|
|
5544c1 |
+DEF_HELPER_3(dlg, void, env, i32, i64)
|
|
|
5544c1 |
DEF_HELPER_FLAGS_3(set_cc_add64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64, s64, s64)
|
|
|
5544c1 |
DEF_HELPER_FLAGS_3(set_cc_addu64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)
|
|
|
5544c1 |
DEF_HELPER_FLAGS_3(set_cc_add32, TCG_CALL_PURE|TCG_CALL_CONST, i32, s32, s32, s32)
|
|
|
5544c1 |
@@ -43,8 +43,8 @@ DEF_HELPER_3(stam, void, i32, i64, i32)
|
|
|
5544c1 |
DEF_HELPER_3(lam, void, i32, i64, i32)
|
|
|
5544c1 |
DEF_HELPER_3(mvcle, i32, i32, i64, i32)
|
|
|
5544c1 |
DEF_HELPER_3(clcle, i32, i32, i64, i32)
|
|
|
5544c1 |
-DEF_HELPER_3(slb, i32, i32, i32, i32)
|
|
|
5544c1 |
-DEF_HELPER_4(slbg, i32, i32, i32, i64, i64)
|
|
|
5544c1 |
+DEF_HELPER_4(slb, i32, env, i32, i32, i32)
|
|
|
5544c1 |
+DEF_HELPER_5(slbg, i32, env, i32, i32, i64, i64)
|
|
|
5544c1 |
DEF_HELPER_3(cefbr, void, env, i32, s32)
|
|
|
5544c1 |
DEF_HELPER_3(cdfbr, void, env, i32, s32)
|
|
|
5544c1 |
DEF_HELPER_3(cxfbr, void, env, i32, s32)
|
|
|
5544c1 |
@@ -107,7 +107,7 @@ DEF_HELPER_3(lxdb, void, env, i32, i64)
|
|
|
5544c1 |
DEF_HELPER_FLAGS_3(tceb, TCG_CALL_PURE, i32, env, i32, i64)
|
|
|
5544c1 |
DEF_HELPER_FLAGS_3(tcdb, TCG_CALL_PURE, i32, env, i32, i64)
|
|
|
5544c1 |
DEF_HELPER_FLAGS_3(tcxb, TCG_CALL_PURE, i32, env, i32, i64)
|
|
|
5544c1 |
-DEF_HELPER_2(flogr, i32, i32, i64)
|
|
|
5544c1 |
+DEF_HELPER_3(flogr, i32, env, i32, i64)
|
|
|
5544c1 |
DEF_HELPER_3(sqdbr, void, env, i32, i32)
|
|
|
5544c1 |
DEF_HELPER_FLAGS_1(cvd, TCG_CALL_PURE|TCG_CALL_CONST, i64, s32)
|
|
|
5544c1 |
DEF_HELPER_3(unpk, void, i32, i64, i64)
|
|
|
5544c1 |
diff --git a/target-s390x/int_helper.c b/target-s390x/int_helper.c
|
|
|
5544c1 |
index e2eeb07..f202a7e 100644
|
|
|
5544c1 |
--- a/target-s390x/int_helper.c
|
|
|
5544c1 |
+++ b/target-s390x/int_helper.c
|
|
|
5544c1 |
@@ -19,7 +19,6 @@
|
|
|
5544c1 |
*/
|
|
|
5544c1 |
|
|
|
5544c1 |
#include "cpu.h"
|
|
|
5544c1 |
-#include "dyngen-exec.h"
|
|
|
5544c1 |
#include "host-utils.h"
|
|
|
5544c1 |
#include "helper.h"
|
|
|
5544c1 |
|
|
|
5544c1 |
@@ -31,7 +30,7 @@
|
|
|
5544c1 |
#endif
|
|
|
5544c1 |
|
|
|
5544c1 |
/* 64/64 -> 128 unsigned multiplication */
|
|
|
5544c1 |
-void HELPER(mlg)(uint32_t r1, uint64_t v2)
|
|
|
5544c1 |
+void HELPER(mlg)(CPUS390XState *env, uint32_t r1, uint64_t v2)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
#if HOST_LONG_BITS == 64 && defined(__GNUC__)
|
|
|
5544c1 |
/* assuming 64-bit hosts have __uint128_t */
|
|
|
5544c1 |
@@ -46,7 +45,7 @@ void HELPER(mlg)(uint32_t r1, uint64_t v2)
|
|
|
5544c1 |
}
|
|
|
5544c1 |
|
|
|
5544c1 |
/* 128 -> 64/64 unsigned division */
|
|
|
5544c1 |
-void HELPER(dlg)(uint32_t r1, uint64_t v2)
|
|
|
5544c1 |
+void HELPER(dlg)(CPUS390XState *env, uint32_t r1, uint64_t v2)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
uint64_t divisor = v2;
|
|
|
5544c1 |
|
|
|
5544c1 |
@@ -129,7 +128,7 @@ uint32_t HELPER(addc_u32)(uint32_t cc, uint32_t v1, uint32_t v2)
|
|
|
5544c1 |
}
|
|
|
5544c1 |
|
|
|
5544c1 |
/* subtract unsigned v2 from v1 with borrow */
|
|
|
5544c1 |
-uint32_t HELPER(slb)(uint32_t cc, uint32_t r1, uint32_t v2)
|
|
|
5544c1 |
+uint32_t HELPER(slb)(CPUS390XState *env, uint32_t cc, uint32_t r1, uint32_t v2)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
uint32_t v1 = env->regs[r1];
|
|
|
5544c1 |
uint32_t res = v1 + (~v2) + (cc >> 1);
|
|
|
5544c1 |
@@ -144,7 +143,8 @@ uint32_t HELPER(slb)(uint32_t cc, uint32_t r1, uint32_t v2)
|
|
|
5544c1 |
}
|
|
|
5544c1 |
|
|
|
5544c1 |
/* subtract unsigned v2 from v1 with borrow */
|
|
|
5544c1 |
-uint32_t HELPER(slbg)(uint32_t cc, uint32_t r1, uint64_t v1, uint64_t v2)
|
|
|
5544c1 |
+uint32_t HELPER(slbg)(CPUS390XState *env, uint32_t cc, uint32_t r1,
|
|
|
5544c1 |
+ uint64_t v1, uint64_t v2)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
uint64_t res = v1 + (~v2) + (cc >> 1);
|
|
|
5544c1 |
|
|
|
5544c1 |
@@ -158,7 +158,7 @@ uint32_t HELPER(slbg)(uint32_t cc, uint32_t r1, uint64_t v1, uint64_t v2)
|
|
|
5544c1 |
}
|
|
|
5544c1 |
|
|
|
5544c1 |
/* find leftmost one */
|
|
|
5544c1 |
-uint32_t HELPER(flogr)(uint32_t r1, uint64_t v2)
|
|
|
5544c1 |
+uint32_t HELPER(flogr)(CPUS390XState *env, uint32_t r1, uint64_t v2)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
uint64_t res = 0;
|
|
|
5544c1 |
uint64_t ov2 = v2;
|
|
|
5544c1 |
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
|
|
|
5544c1 |
index b1f2071..2a61e92 100644
|
|
|
5544c1 |
--- a/target-s390x/translate.c
|
|
|
5544c1 |
+++ b/target-s390x/translate.c
|
|
|
5544c1 |
@@ -1803,7 +1803,7 @@ static void disas_e3(DisasContext* s, int op, int r1, int x2, int b2, int d2)
|
|
|
5544c1 |
tmp2 = tcg_temp_new_i64();
|
|
|
5544c1 |
tmp32_1 = tcg_const_i32(r1);
|
|
|
5544c1 |
tcg_gen_qemu_ld64(tmp2, addr, get_mem_index(s));
|
|
|
5544c1 |
- gen_helper_mlg(tmp32_1, tmp2);
|
|
|
5544c1 |
+ gen_helper_mlg(cpu_env, tmp32_1, tmp2);
|
|
|
5544c1 |
tcg_temp_free_i64(tmp2);
|
|
|
5544c1 |
tcg_temp_free_i32(tmp32_1);
|
|
|
5544c1 |
break;
|
|
|
5544c1 |
@@ -1811,7 +1811,7 @@ static void disas_e3(DisasContext* s, int op, int r1, int x2, int b2, int d2)
|
|
|
5544c1 |
tmp2 = tcg_temp_new_i64();
|
|
|
5544c1 |
tmp32_1 = tcg_const_i32(r1);
|
|
|
5544c1 |
tcg_gen_qemu_ld64(tmp2, addr, get_mem_index(s));
|
|
|
5544c1 |
- gen_helper_dlg(tmp32_1, tmp2);
|
|
|
5544c1 |
+ gen_helper_dlg(cpu_env, tmp32_1, tmp2);
|
|
|
5544c1 |
tcg_temp_free_i64(tmp2);
|
|
|
5544c1 |
tcg_temp_free_i32(tmp32_1);
|
|
|
5544c1 |
break;
|
|
|
5544c1 |
@@ -1837,7 +1837,7 @@ static void disas_e3(DisasContext* s, int op, int r1, int x2, int b2, int d2)
|
|
|
5544c1 |
tcg_gen_qemu_ld64(tmp2, addr, get_mem_index(s));
|
|
|
5544c1 |
/* XXX possible optimization point */
|
|
|
5544c1 |
gen_op_calc_cc(s);
|
|
|
5544c1 |
- gen_helper_slbg(cc_op, cc_op, tmp32_1, regs[r1], tmp2);
|
|
|
5544c1 |
+ gen_helper_slbg(cc_op, cpu_env, cc_op, tmp32_1, regs[r1], tmp2);
|
|
|
5544c1 |
set_cc_static(s);
|
|
|
5544c1 |
tcg_temp_free_i64(tmp2);
|
|
|
5544c1 |
tcg_temp_free_i32(tmp32_1);
|
|
|
5544c1 |
@@ -1917,7 +1917,7 @@ static void disas_e3(DisasContext* s, int op, int r1, int x2, int b2, int d2)
|
|
|
5544c1 |
tcg_gen_trunc_i64_i32(tmp32_2, tmp2);
|
|
|
5544c1 |
/* XXX possible optimization point */
|
|
|
5544c1 |
gen_op_calc_cc(s);
|
|
|
5544c1 |
- gen_helper_slb(cc_op, cc_op, tmp32_1, tmp32_2);
|
|
|
5544c1 |
+ gen_helper_slb(cc_op, cpu_env, cc_op, tmp32_1, tmp32_2);
|
|
|
5544c1 |
set_cc_static(s);
|
|
|
5544c1 |
tcg_temp_free_i64(tmp2);
|
|
|
5544c1 |
tcg_temp_free_i32(tmp32_1);
|
|
|
5544c1 |
@@ -3535,7 +3535,7 @@ static void disas_b9(DisasContext *s, int op, int r1, int r2)
|
|
|
5544c1 |
case 0x83: /* FLOGR R1,R2 [RRE] */
|
|
|
5544c1 |
tmp = load_reg(r2);
|
|
|
5544c1 |
tmp32_1 = tcg_const_i32(r1);
|
|
|
5544c1 |
- gen_helper_flogr(cc_op, tmp32_1, tmp);
|
|
|
5544c1 |
+ gen_helper_flogr(cc_op, cpu_env, tmp32_1, tmp);
|
|
|
5544c1 |
set_cc_static(s);
|
|
|
5544c1 |
tcg_temp_free_i64(tmp);
|
|
|
5544c1 |
tcg_temp_free_i32(tmp32_1);
|
|
|
5544c1 |
@@ -3555,7 +3555,7 @@ static void disas_b9(DisasContext *s, int op, int r1, int r2)
|
|
|
5544c1 |
case 0x87: /* DLGR R1,R2 [RRE] */
|
|
|
5544c1 |
tmp32_1 = tcg_const_i32(r1);
|
|
|
5544c1 |
tmp = load_reg(r2);
|
|
|
5544c1 |
- gen_helper_dlg(tmp32_1, tmp);
|
|
|
5544c1 |
+ gen_helper_dlg(cpu_env, tmp32_1, tmp);
|
|
|
5544c1 |
tcg_temp_free_i64(tmp);
|
|
|
5544c1 |
tcg_temp_free_i32(tmp32_1);
|
|
|
5544c1 |
break;
|
|
|
5544c1 |
@@ -3580,7 +3580,7 @@ static void disas_b9(DisasContext *s, int op, int r1, int r2)
|
|
|
5544c1 |
tmp2 = load_reg(r2);
|
|
|
5544c1 |
tmp32_1 = tcg_const_i32(r1);
|
|
|
5544c1 |
gen_op_calc_cc(s);
|
|
|
5544c1 |
- gen_helper_slbg(cc_op, cc_op, tmp32_1, tmp, tmp2);
|
|
|
5544c1 |
+ gen_helper_slbg(cc_op, cpu_env, cc_op, tmp32_1, tmp, tmp2);
|
|
|
5544c1 |
set_cc_static(s);
|
|
|
5544c1 |
tcg_temp_free_i64(tmp);
|
|
|
5544c1 |
tcg_temp_free_i64(tmp2);
|
|
|
5544c1 |
@@ -3647,7 +3647,7 @@ static void disas_b9(DisasContext *s, int op, int r1, int r2)
|
|
|
5544c1 |
tmp32_1 = load_reg32(r2);
|
|
|
5544c1 |
tmp32_2 = tcg_const_i32(r1);
|
|
|
5544c1 |
gen_op_calc_cc(s);
|
|
|
5544c1 |
- gen_helper_slb(cc_op, cc_op, tmp32_2, tmp32_1);
|
|
|
5544c1 |
+ gen_helper_slb(cc_op, cpu_env, cc_op, tmp32_2, tmp32_1);
|
|
|
5544c1 |
set_cc_static(s);
|
|
|
5544c1 |
tcg_temp_free_i32(tmp32_1);
|
|
|
5544c1 |
tcg_temp_free_i32(tmp32_2);
|
|
|
5544c1 |
--
|
|
|
5544c1 |
1.7.12.1
|
|
|
5544c1 |
|