dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0035-target-cris-Avoid-AREG0-for-helpers.patch

5544c1
From 1e3916b0cbfd39cb3fc8996423d5574068583145 Mon Sep 17 00:00:00 2001
5544c1
From: Aurelien Jarno <aurelien@aurel32.net>
5544c1
Date: Thu, 30 Aug 2012 16:56:39 +0200
5544c1
Subject: [PATCH] target-cris: Avoid AREG0 for helpers
5544c1
5544c1
Add an explicit CPUCRISState parameter instead of relying on AREG0.
5544c1
5544c1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
5544c1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 target-cris/helper.h        | 37 +++++++++++----------
5544c1
 target-cris/op_helper.c     | 80 ++++++++++++++++++++++++---------------------
5544c1
 target-cris/translate.c     | 44 +++++++++++++------------
5544c1
 target-cris/translate_v10.c |  4 +--
5544c1
 4 files changed, 88 insertions(+), 77 deletions(-)
5544c1
5544c1
diff --git a/target-cris/helper.h b/target-cris/helper.h
5544c1
index 093063a..99fb326 100644
5544c1
--- a/target-cris/helper.h
5544c1
+++ b/target-cris/helper.h
5544c1
@@ -1,26 +1,29 @@
5544c1
 #include "def-helper.h"
5544c1
 
5544c1
-DEF_HELPER_1(raise_exception, void, i32)
5544c1
-DEF_HELPER_1(tlb_flush_pid, void, i32)
5544c1
-DEF_HELPER_1(spc_write, void, i32)
5544c1
+DEF_HELPER_2(raise_exception, void, env, i32)
5544c1
+DEF_HELPER_2(tlb_flush_pid, void, env, i32)
5544c1
+DEF_HELPER_2(spc_write, void, env, i32)
5544c1
 DEF_HELPER_3(dump, void, i32, i32, i32)
5544c1
-DEF_HELPER_0(rfe, void);
5544c1
-DEF_HELPER_0(rfn, void);
5544c1
+DEF_HELPER_1(rfe, void, env);
5544c1
+DEF_HELPER_1(rfn, void, env);
5544c1
 
5544c1
-DEF_HELPER_2(movl_sreg_reg, void, i32, i32)
5544c1
-DEF_HELPER_2(movl_reg_sreg, void, i32, i32)
5544c1
+DEF_HELPER_3(movl_sreg_reg, void, env, i32, i32)
5544c1
+DEF_HELPER_3(movl_reg_sreg, void, env, i32, i32)
5544c1
 
5544c1
 DEF_HELPER_FLAGS_1(lz, TCG_CALL_PURE, i32, i32);
5544c1
-DEF_HELPER_FLAGS_3(btst, TCG_CALL_PURE, i32, i32, i32, i32);
5544c1
+DEF_HELPER_FLAGS_4(btst, TCG_CALL_PURE, i32, env, i32, i32, i32);
5544c1
 
5544c1
-DEF_HELPER_FLAGS_3(evaluate_flags_muls, TCG_CALL_PURE, i32, i32, i32, i32)
5544c1
-DEF_HELPER_FLAGS_3(evaluate_flags_mulu, TCG_CALL_PURE, i32, i32, i32, i32)
5544c1
-DEF_HELPER_FLAGS_4(evaluate_flags_mcp, TCG_CALL_PURE, i32, i32, i32, i32, i32)
5544c1
-DEF_HELPER_FLAGS_4(evaluate_flags_alu_4, TCG_CALL_PURE, i32, i32, i32, i32, i32)
5544c1
-DEF_HELPER_FLAGS_4(evaluate_flags_sub_4, TCG_CALL_PURE, i32, i32, i32, i32, i32)
5544c1
-DEF_HELPER_FLAGS_2(evaluate_flags_move_4, TCG_CALL_PURE, i32, i32, i32)
5544c1
-DEF_HELPER_FLAGS_2(evaluate_flags_move_2, TCG_CALL_PURE, i32, i32, i32)
5544c1
-DEF_HELPER_0(evaluate_flags, void)
5544c1
-DEF_HELPER_0(top_evaluate_flags, void)
5544c1
+DEF_HELPER_FLAGS_4(evaluate_flags_muls, TCG_CALL_PURE, i32, env, i32, i32, i32)
5544c1
+DEF_HELPER_FLAGS_4(evaluate_flags_mulu, TCG_CALL_PURE, i32, env, i32, i32, i32)
5544c1
+DEF_HELPER_FLAGS_5(evaluate_flags_mcp, TCG_CALL_PURE, i32, env,
5544c1
+                                                      i32, i32, i32, i32)
5544c1
+DEF_HELPER_FLAGS_5(evaluate_flags_alu_4, TCG_CALL_PURE, i32, env,
5544c1
+                                                        i32, i32, i32, i32)
5544c1
+DEF_HELPER_FLAGS_5(evaluate_flags_sub_4, TCG_CALL_PURE, i32, env,
5544c1
+                                                        i32, i32, i32, i32)
5544c1
+DEF_HELPER_FLAGS_3(evaluate_flags_move_4, TCG_CALL_PURE, i32, env, i32, i32)
5544c1
+DEF_HELPER_FLAGS_3(evaluate_flags_move_2, TCG_CALL_PURE, i32, env, i32, i32)
5544c1
+DEF_HELPER_1(evaluate_flags, void, env)
5544c1
+DEF_HELPER_1(top_evaluate_flags, void, env)
5544c1
 
5544c1
 #include "def-helper.h"
5544c1
diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c
5544c1
index ac7c98c..5ca85a0 100644
5544c1
--- a/target-cris/op_helper.c
5544c1
+++ b/target-cris/op_helper.c
5544c1
@@ -79,7 +79,7 @@ void tlb_fill(CPUCRISState *env1, target_ulong addr, int is_write, int mmu_idx,
5544c1
                 cpu_restore_state(tb, env, retaddr);
5544c1
 
5544c1
 		/* Evaluate flags after retranslation.  */
5544c1
-                helper_top_evaluate_flags();
5544c1
+                helper_top_evaluate_flags(env);
5544c1
             }
5544c1
         }
5544c1
         cpu_loop_exit(env);
5544c1
@@ -89,13 +89,13 @@ void tlb_fill(CPUCRISState *env1, target_ulong addr, int is_write, int mmu_idx,
5544c1
 
5544c1
 #endif
5544c1
 
5544c1
-void helper_raise_exception(uint32_t index)
5544c1
+void helper_raise_exception(CPUCRISState *env, uint32_t index)
5544c1
 {
5544c1
 	env->exception_index = index;
5544c1
         cpu_loop_exit(env);
5544c1
 }
5544c1
 
5544c1
-void helper_tlb_flush_pid(uint32_t pid)
5544c1
+void helper_tlb_flush_pid(CPUCRISState *env, uint32_t pid)
5544c1
 {
5544c1
 #if !defined(CONFIG_USER_ONLY)
5544c1
 	pid &= 0xff;
5544c1
@@ -104,7 +104,7 @@ void helper_tlb_flush_pid(uint32_t pid)
5544c1
 #endif
5544c1
 }
5544c1
 
5544c1
-void helper_spc_write(uint32_t new_spc)
5544c1
+void helper_spc_write(CPUCRISState *env, uint32_t new_spc)
5544c1
 {
5544c1
 #if !defined(CONFIG_USER_ONLY)
5544c1
 	tlb_flush_page(env, env->pregs[PR_SPC]);
5544c1
@@ -121,7 +121,7 @@ void helper_dump(uint32_t a0, uint32_t a1, uint32_t a2)
5544c1
 #define EXTRACT_FIELD(src, start, end) \
5544c1
 	    (((src) >> start) & ((1 << (end - start + 1)) - 1))
5544c1
 
5544c1
-void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg)
5544c1
+void helper_movl_sreg_reg(CPUCRISState *env, uint32_t sreg, uint32_t reg)
5544c1
 {
5544c1
 	uint32_t srs;
5544c1
 	srs = env->pregs[PR_SRS];
5544c1
@@ -171,7 +171,7 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg)
5544c1
 #endif
5544c1
 }
5544c1
 
5544c1
-void helper_movl_reg_sreg (uint32_t reg, uint32_t sreg)
5544c1
+void helper_movl_reg_sreg(CPUCRISState *env, uint32_t reg, uint32_t sreg)
5544c1
 {
5544c1
 	uint32_t srs;
5544c1
 	env->pregs[PR_SRS] &= 3;
5544c1
@@ -216,7 +216,7 @@ static void cris_ccs_rshift(CPUCRISState *env)
5544c1
 	env->pregs[PR_CCS] = ccs;
5544c1
 }
5544c1
 
5544c1
-void helper_rfe(void)
5544c1
+void helper_rfe(CPUCRISState *env)
5544c1
 {
5544c1
 	int rflag = env->pregs[PR_CCS] & R_FLAG;
5544c1
 
5544c1
@@ -232,7 +232,7 @@ void helper_rfe(void)
5544c1
 		env->pregs[PR_CCS] |= P_FLAG;
5544c1
 }
5544c1
 
5544c1
-void helper_rfn(void)
5544c1
+void helper_rfn(CPUCRISState *env)
5544c1
 {
5544c1
 	int rflag = env->pregs[PR_CCS] & R_FLAG;
5544c1
 
5544c1
@@ -256,7 +256,7 @@ uint32_t helper_lz(uint32_t t0)
5544c1
 	return clz32(t0);
5544c1
 }
5544c1
 
5544c1
-uint32_t helper_btst(uint32_t t0, uint32_t t1, uint32_t ccs)
5544c1
+uint32_t helper_btst(CPUCRISState *env, uint32_t t0, uint32_t t1, uint32_t ccs)
5544c1
 {
5544c1
 	/* FIXME: clean this up.  */
5544c1
 
5544c1
@@ -284,7 +284,8 @@ uint32_t helper_btst(uint32_t t0, uint32_t t1, uint32_t ccs)
5544c1
 	return ccs;
5544c1
 }
5544c1
 
5544c1
-static inline uint32_t evaluate_flags_writeback(uint32_t flags, uint32_t ccs)
5544c1
+static inline uint32_t evaluate_flags_writeback(CPUCRISState *env,
5544c1
+                                                uint32_t flags, uint32_t ccs)
5544c1
 {
5544c1
 	unsigned int x, z, mask;
5544c1
 
5544c1
@@ -303,7 +304,8 @@ static inline uint32_t evaluate_flags_writeback(uint32_t flags, uint32_t ccs)
5544c1
 	return ccs;
5544c1
 }
5544c1
 
5544c1
-uint32_t helper_evaluate_flags_muls(uint32_t ccs, uint32_t res, uint32_t mof)
5544c1
+uint32_t helper_evaluate_flags_muls(CPUCRISState *env,
5544c1
+                                    uint32_t ccs, uint32_t res, uint32_t mof)
5544c1
 {
5544c1
 	uint32_t flags = 0;
5544c1
 	int64_t tmp;
5544c1
@@ -321,10 +323,11 @@ uint32_t helper_evaluate_flags_muls(uint32_t ccs, uint32_t res, uint32_t mof)
5544c1
 	if ((dneg && mof != -1)
5544c1
 	    || (!dneg && mof != 0))
5544c1
 		flags |= V_FLAG;
5544c1
-	return evaluate_flags_writeback(flags, ccs);
5544c1
+        return evaluate_flags_writeback(env, flags, ccs);
5544c1
 }
5544c1
 
5544c1
-uint32_t helper_evaluate_flags_mulu(uint32_t ccs, uint32_t res, uint32_t mof)
5544c1
+uint32_t helper_evaluate_flags_mulu(CPUCRISState *env,
5544c1
+                                    uint32_t ccs, uint32_t res, uint32_t mof)
5544c1
 {
5544c1
 	uint32_t flags = 0;
5544c1
 	uint64_t tmp;
5544c1
@@ -339,10 +342,10 @@ uint32_t helper_evaluate_flags_mulu(uint32_t ccs, uint32_t res, uint32_t mof)
5544c1
 	if (mof)
5544c1
 		flags |= V_FLAG;
5544c1
 
5544c1
-	return evaluate_flags_writeback(flags, ccs);
5544c1
+        return evaluate_flags_writeback(env, flags, ccs);
5544c1
 }
5544c1
 
5544c1
-uint32_t helper_evaluate_flags_mcp(uint32_t ccs,
5544c1
+uint32_t helper_evaluate_flags_mcp(CPUCRISState *env, uint32_t ccs,
5544c1
 				   uint32_t src, uint32_t dst, uint32_t res)
5544c1
 {
5544c1
 	uint32_t flags = 0;
5544c1
@@ -368,10 +371,10 @@ uint32_t helper_evaluate_flags_mcp(uint32_t ccs,
5544c1
 			flags |= R_FLAG;
5544c1
 	}
5544c1
 
5544c1
-	return evaluate_flags_writeback(flags, ccs);
5544c1
+        return evaluate_flags_writeback(env, flags, ccs);
5544c1
 }
5544c1
 
5544c1
-uint32_t helper_evaluate_flags_alu_4(uint32_t ccs,
5544c1
+uint32_t helper_evaluate_flags_alu_4(CPUCRISState *env, uint32_t ccs,
5544c1
 				     uint32_t src, uint32_t dst, uint32_t res)
5544c1
 {
5544c1
 	uint32_t flags = 0;
5544c1
@@ -397,10 +400,10 @@ uint32_t helper_evaluate_flags_alu_4(uint32_t ccs,
5544c1
 			flags |= C_FLAG;
5544c1
 	}
5544c1
 
5544c1
-	return evaluate_flags_writeback(flags, ccs);
5544c1
+        return evaluate_flags_writeback(env, flags, ccs);
5544c1
 }
5544c1
 
5544c1
-uint32_t helper_evaluate_flags_sub_4(uint32_t ccs,
5544c1
+uint32_t helper_evaluate_flags_sub_4(CPUCRISState *env, uint32_t ccs,
5544c1
 				     uint32_t src, uint32_t dst, uint32_t res)
5544c1
 {
5544c1
 	uint32_t flags = 0;
5544c1
@@ -427,10 +430,11 @@ uint32_t helper_evaluate_flags_sub_4(uint32_t ccs,
5544c1
 	}
5544c1
 
5544c1
 	flags ^= C_FLAG;
5544c1
-	return evaluate_flags_writeback(flags, ccs);
5544c1
+        return evaluate_flags_writeback(env, flags, ccs);
5544c1
 }
5544c1
 
5544c1
-uint32_t helper_evaluate_flags_move_4(uint32_t ccs, uint32_t res)
5544c1
+uint32_t helper_evaluate_flags_move_4(CPUCRISState *env,
5544c1
+                                      uint32_t ccs, uint32_t res)
5544c1
 {
5544c1
 	uint32_t flags = 0;
5544c1
 
5544c1
@@ -439,9 +443,10 @@ uint32_t helper_evaluate_flags_move_4(uint32_t ccs, uint32_t res)
5544c1
 	else if (res == 0L)
5544c1
 		flags |= Z_FLAG;
5544c1
 
5544c1
-	return evaluate_flags_writeback(flags, ccs);
5544c1
+        return evaluate_flags_writeback(env, flags, ccs);
5544c1
 }
5544c1
-uint32_t helper_evaluate_flags_move_2(uint32_t ccs, uint32_t res)
5544c1
+uint32_t helper_evaluate_flags_move_2(CPUCRISState *env,
5544c1
+                                      uint32_t ccs, uint32_t res)
5544c1
 {
5544c1
 	uint32_t flags = 0;
5544c1
 
5544c1
@@ -450,12 +455,12 @@ uint32_t helper_evaluate_flags_move_2(uint32_t ccs, uint32_t res)
5544c1
 	else if (res == 0)
5544c1
 		flags |= Z_FLAG;
5544c1
 
5544c1
-	return evaluate_flags_writeback(flags, ccs);
5544c1
+        return evaluate_flags_writeback(env, flags, ccs);
5544c1
 }
5544c1
 
5544c1
 /* TODO: This is expensive. We could split things up and only evaluate part of
5544c1
    CCR on a need to know basis. For now, we simply re-evaluate everything.  */
5544c1
-void  helper_evaluate_flags(void)
5544c1
+void helper_evaluate_flags(CPUCRISState *env)
5544c1
 {
5544c1
 	uint32_t src, dst, res;
5544c1
 	uint32_t flags = 0;
5544c1
@@ -571,25 +576,26 @@ void  helper_evaluate_flags(void)
5544c1
 	if (env->cc_op == CC_OP_SUB || env->cc_op == CC_OP_CMP)
5544c1
 		flags ^= C_FLAG;
5544c1
 
5544c1
-	env->pregs[PR_CCS] = evaluate_flags_writeback(flags, env->pregs[PR_CCS]);
5544c1
+        env->pregs[PR_CCS] = evaluate_flags_writeback(env, flags,
5544c1
+                                                      env->pregs[PR_CCS]);
5544c1
 }
5544c1
 
5544c1
-void helper_top_evaluate_flags(void)
5544c1
+void helper_top_evaluate_flags(CPUCRISState *env)
5544c1
 {
5544c1
 	switch (env->cc_op)
5544c1
 	{
5544c1
 		case CC_OP_MCP:
5544c1
-			env->pregs[PR_CCS] = helper_evaluate_flags_mcp(
5544c1
+                        env->pregs[PR_CCS] = helper_evaluate_flags_mcp(env,
5544c1
 					env->pregs[PR_CCS], env->cc_src,
5544c1
 					env->cc_dest, env->cc_result);
5544c1
 			break;
5544c1
 		case CC_OP_MULS:
5544c1
-			env->pregs[PR_CCS] = helper_evaluate_flags_muls(
5544c1
+                        env->pregs[PR_CCS] = helper_evaluate_flags_muls(env,
5544c1
 					env->pregs[PR_CCS], env->cc_result,
5544c1
 					env->pregs[PR_MOF]);
5544c1
 			break;
5544c1
 		case CC_OP_MULU:
5544c1
-			env->pregs[PR_CCS] = helper_evaluate_flags_mulu(
5544c1
+                        env->pregs[PR_CCS] = helper_evaluate_flags_mulu(env,
5544c1
 					env->pregs[PR_CCS], env->cc_result,
5544c1
 					env->pregs[PR_MOF]);
5544c1
 			break;
5544c1
@@ -604,18 +610,18 @@ void helper_top_evaluate_flags(void)
5544c1
 		{
5544c1
 			case 4:
5544c1
 				env->pregs[PR_CCS] =
5544c1
-					helper_evaluate_flags_move_4(
5544c1
+                                        helper_evaluate_flags_move_4(env,
5544c1
 							env->pregs[PR_CCS],
5544c1
 							env->cc_result);
5544c1
 				break;
5544c1
 			case 2:
5544c1
 				env->pregs[PR_CCS] =
5544c1
-					helper_evaluate_flags_move_2(
5544c1
+                                        helper_evaluate_flags_move_2(env,
5544c1
 							env->pregs[PR_CCS],
5544c1
 							env->cc_result);
5544c1
 				break;
5544c1
 			default:
5544c1
-				helper_evaluate_flags();
5544c1
+                                helper_evaluate_flags(env);
5544c1
 				break;
5544c1
 		}
5544c1
 		break;
5544c1
@@ -626,12 +632,12 @@ void helper_top_evaluate_flags(void)
5544c1
 		case CC_OP_CMP:
5544c1
 			if (env->cc_size == 4)
5544c1
 				env->pregs[PR_CCS] =
5544c1
-					helper_evaluate_flags_sub_4(
5544c1
+                                        helper_evaluate_flags_sub_4(env,
5544c1
 						env->pregs[PR_CCS],
5544c1
 						env->cc_src, env->cc_dest,
5544c1
 						env->cc_result);
5544c1
 			else
5544c1
-				helper_evaluate_flags();
5544c1
+                                helper_evaluate_flags(env);
5544c1
 			break;
5544c1
 		default:
5544c1
 		{
5544c1
@@ -639,13 +645,13 @@ void helper_top_evaluate_flags(void)
5544c1
 			{
5544c1
 			case 4:
5544c1
 				env->pregs[PR_CCS] =
5544c1
-					helper_evaluate_flags_alu_4(
5544c1
+                                        helper_evaluate_flags_alu_4(env,
5544c1
 						env->pregs[PR_CCS],
5544c1
 						env->cc_src, env->cc_dest,
5544c1
 						env->cc_result);
5544c1
 				break;
5544c1
 			default:
5544c1
-				helper_evaluate_flags();
5544c1
+                                helper_evaluate_flags(env);
5544c1
 				break;
5544c1
 			}
5544c1
 		}
5544c1
diff --git a/target-cris/translate.c b/target-cris/translate.c
5544c1
index ad31877..283dd98 100644
5544c1
--- a/target-cris/translate.c
5544c1
+++ b/target-cris/translate.c
5544c1
@@ -211,9 +211,9 @@ static inline void t_gen_mov_preg_TN(DisasContext *dc, int r, TCGv tn)
5544c1
 		tcg_gen_andi_tl(cpu_PR[r], tn, 3);
5544c1
 	else {
5544c1
 		if (r == PR_PID) 
5544c1
-			gen_helper_tlb_flush_pid(tn);
5544c1
+                        gen_helper_tlb_flush_pid(cpu_env, tn);
5544c1
 		if (dc->tb_flags & S_FLAG && r == PR_SPC) 
5544c1
-			gen_helper_spc_write(tn);
5544c1
+                        gen_helper_spc_write(cpu_env, tn);
5544c1
 		else if (r == PR_CCS)
5544c1
 			dc->cpustate_changed = 1;
5544c1
 		tcg_gen_mov_tl(cpu_PR[r], tn);
5544c1
@@ -278,7 +278,7 @@ static void cris_lock_irq(DisasContext *dc)
5544c1
 static inline void t_gen_raise_exception(uint32_t index)
5544c1
 {
5544c1
         TCGv_i32 tmp = tcg_const_i32(index);
5544c1
-	gen_helper_raise_exception(tmp);
5544c1
+        gen_helper_raise_exception(cpu_env, tmp);
5544c1
         tcg_temp_free_i32(tmp);
5544c1
 }
5544c1
 
5544c1
@@ -624,17 +624,17 @@ static void cris_evaluate_flags(DisasContext *dc)
5544c1
 	switch (dc->cc_op)
5544c1
 	{
5544c1
 	case CC_OP_MCP:
5544c1
-		gen_helper_evaluate_flags_mcp(cpu_PR[PR_CCS],
5544c1
+                gen_helper_evaluate_flags_mcp(cpu_PR[PR_CCS], cpu_env,
5544c1
 					cpu_PR[PR_CCS], cc_src,
5544c1
 					cc_dest, cc_result);
5544c1
 		break;
5544c1
 	case CC_OP_MULS:
5544c1
-		gen_helper_evaluate_flags_muls(cpu_PR[PR_CCS],
5544c1
+                gen_helper_evaluate_flags_muls(cpu_PR[PR_CCS], cpu_env,
5544c1
 					cpu_PR[PR_CCS], cc_result,
5544c1
 					cpu_PR[PR_MOF]);
5544c1
 		break;
5544c1
 	case CC_OP_MULU:
5544c1
-		gen_helper_evaluate_flags_mulu(cpu_PR[PR_CCS],
5544c1
+                gen_helper_evaluate_flags_mulu(cpu_PR[PR_CCS], cpu_env,
5544c1
 					cpu_PR[PR_CCS], cc_result,
5544c1
 					cpu_PR[PR_MOF]);
5544c1
 		break;
5544c1
@@ -648,15 +648,15 @@ static void cris_evaluate_flags(DisasContext *dc)
5544c1
 		switch (dc->cc_size)
5544c1
 		{
5544c1
 		case 4:
5544c1
-			gen_helper_evaluate_flags_move_4(cpu_PR[PR_CCS],
5544c1
-						cpu_PR[PR_CCS], cc_result);
5544c1
+                        gen_helper_evaluate_flags_move_4(cpu_PR[PR_CCS],
5544c1
+                                           cpu_env, cpu_PR[PR_CCS], cc_result);
5544c1
 			break;
5544c1
 		case 2:
5544c1
-			gen_helper_evaluate_flags_move_2(cpu_PR[PR_CCS],
5544c1
-						cpu_PR[PR_CCS], cc_result);
5544c1
+                        gen_helper_evaluate_flags_move_2(cpu_PR[PR_CCS],
5544c1
+                                           cpu_env, cpu_PR[PR_CCS], cc_result);
5544c1
 			break;
5544c1
 		default:
5544c1
-			gen_helper_evaluate_flags();
5544c1
+                        gen_helper_evaluate_flags(cpu_env);
5544c1
 			break;
5544c1
 		}
5544c1
 		break;
5544c1
@@ -666,21 +666,21 @@ static void cris_evaluate_flags(DisasContext *dc)
5544c1
 	case CC_OP_SUB:
5544c1
 	case CC_OP_CMP:
5544c1
 		if (dc->cc_size == 4)
5544c1
-			gen_helper_evaluate_flags_sub_4(cpu_PR[PR_CCS],
5544c1
+                        gen_helper_evaluate_flags_sub_4(cpu_PR[PR_CCS], cpu_env,
5544c1
 				cpu_PR[PR_CCS], cc_src, cc_dest, cc_result);
5544c1
 		else
5544c1
-			gen_helper_evaluate_flags();
5544c1
+                        gen_helper_evaluate_flags(cpu_env);
5544c1
 
5544c1
 		break;
5544c1
 	default:
5544c1
 		switch (dc->cc_size)
5544c1
 		{
5544c1
 			case 4:
5544c1
-			gen_helper_evaluate_flags_alu_4(cpu_PR[PR_CCS],
5544c1
+                        gen_helper_evaluate_flags_alu_4(cpu_PR[PR_CCS], cpu_env,
5544c1
 				cpu_PR[PR_CCS], cc_src, cc_dest, cc_result);
5544c1
 				break;
5544c1
 			default:
5544c1
-				gen_helper_evaluate_flags();
5544c1
+                                gen_helper_evaluate_flags(cpu_env);
5544c1
 				break;
5544c1
 		}
5544c1
 		break;
5544c1
@@ -1475,7 +1475,7 @@ static int dec_btstq(DisasContext *dc)
5544c1
 
5544c1
 	cris_cc_mask(dc, CC_MASK_NZ);
5544c1
 	cris_evaluate_flags(dc);
5544c1
-	gen_helper_btst(cpu_PR[PR_CCS], cpu_R[dc->op2],
5544c1
+        gen_helper_btst(cpu_PR[PR_CCS], cpu_env, cpu_R[dc->op2],
5544c1
 			tcg_const_tl(dc->op1), cpu_PR[PR_CCS]);
5544c1
 	cris_alu(dc, CC_OP_MOVE,
5544c1
 		 cpu_R[dc->op2], cpu_R[dc->op2], cpu_R[dc->op2], 4);
5544c1
@@ -1925,7 +1925,7 @@ static int dec_btst_r(DisasContext *dc)
5544c1
 		    dc->op1, dc->op2);
5544c1
 	cris_cc_mask(dc, CC_MASK_NZ);
5544c1
 	cris_evaluate_flags(dc);
5544c1
-	gen_helper_btst(cpu_PR[PR_CCS], cpu_R[dc->op2],
5544c1
+        gen_helper_btst(cpu_PR[PR_CCS], cpu_env, cpu_R[dc->op2],
5544c1
 			cpu_R[dc->op1], cpu_PR[PR_CCS]);
5544c1
 	cris_alu(dc, CC_OP_MOVE, cpu_R[dc->op2],
5544c1
 		 cpu_R[dc->op2], cpu_R[dc->op2], 4);
5544c1
@@ -2135,14 +2135,16 @@ static int dec_move_rs(DisasContext *dc)
5544c1
 {
5544c1
 	LOG_DIS("move $r%u, $s%u\n", dc->op1, dc->op2);
5544c1
 	cris_cc_mask(dc, 0);
5544c1
-	gen_helper_movl_sreg_reg(tcg_const_tl(dc->op2), tcg_const_tl(dc->op1));
5544c1
+        gen_helper_movl_sreg_reg(cpu_env, tcg_const_tl(dc->op2),
5544c1
+                                 tcg_const_tl(dc->op1));
5544c1
 	return 2;
5544c1
 }
5544c1
 static int dec_move_sr(DisasContext *dc)
5544c1
 {
5544c1
 	LOG_DIS("move $s%u, $r%u\n", dc->op2, dc->op1);
5544c1
 	cris_cc_mask(dc, 0);
5544c1
-	gen_helper_movl_reg_sreg(tcg_const_tl(dc->op1), tcg_const_tl(dc->op2));
5544c1
+        gen_helper_movl_reg_sreg(cpu_env, tcg_const_tl(dc->op1),
5544c1
+                                 tcg_const_tl(dc->op2));
5544c1
 	return 2;
5544c1
 }
5544c1
 
5544c1
@@ -2906,14 +2908,14 @@ static int dec_rfe_etc(DisasContext *dc)
5544c1
 			/* rfe.  */
5544c1
 			LOG_DIS("rfe\n");
5544c1
 			cris_evaluate_flags(dc);
5544c1
-			gen_helper_rfe();
5544c1
+                        gen_helper_rfe(cpu_env);
5544c1
 			dc->is_jmp = DISAS_UPDATE;
5544c1
 			break;
5544c1
 		case 5:
5544c1
 			/* rfn.  */
5544c1
 			LOG_DIS("rfn\n");
5544c1
 			cris_evaluate_flags(dc);
5544c1
-			gen_helper_rfn();
5544c1
+                        gen_helper_rfn(cpu_env);
5544c1
 			dc->is_jmp = DISAS_UPDATE;
5544c1
 			break;
5544c1
 		case 6:
5544c1
diff --git a/target-cris/translate_v10.c b/target-cris/translate_v10.c
5544c1
index 3629629..9a39c6a 100644
5544c1
--- a/target-cris/translate_v10.c
5544c1
+++ b/target-cris/translate_v10.c
5544c1
@@ -289,7 +289,7 @@ static unsigned int dec10_quick_imm(DisasContext *dc)
5544c1
             } else {
5544c1
                 /* BTST */
5544c1
                 cris_update_cc_op(dc, CC_OP_FLAGS, 4);
5544c1
-                gen_helper_btst(cpu_PR[PR_CCS], cpu_R[dc->dst],
5544c1
+                gen_helper_btst(cpu_PR[PR_CCS], cpu_env, cpu_R[dc->dst],
5544c1
                            tcg_const_tl(imm), cpu_PR[PR_CCS]);
5544c1
             }
5544c1
             break;
5544c1
@@ -723,7 +723,7 @@ static unsigned int dec10_reg(DisasContext *dc)
5544c1
                 LOG_DIS("btst $r%d, $r%d sz=%d\n", dc->src, dc->dst, size);
5544c1
                 cris_cc_mask(dc, CC_MASK_NZVC);
5544c1
                 cris_update_cc_op(dc, CC_OP_FLAGS, 4);
5544c1
-                gen_helper_btst(cpu_PR[PR_CCS], cpu_R[dc->dst],
5544c1
+                gen_helper_btst(cpu_PR[PR_CCS], cpu_env, cpu_R[dc->dst],
5544c1
                            cpu_R[dc->src], cpu_PR[PR_CCS]);
5544c1
                 break;
5544c1
             case CRISV10_REG_DSTEP:
5544c1
-- 
5544c1
1.7.12.1
5544c1