render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0031-target-arm-convert-void-helpers.patch

5544c1
From 140048c58e4ceb4f3bac87d7154d2731bb2bcd5d Mon Sep 17 00:00:00 2001
5544c1
From: Blue Swirl <blauwirbel@gmail.com>
5544c1
Date: Tue, 4 Sep 2012 20:08:34 +0000
5544c1
Subject: [PATCH] target-arm: convert void helpers
5544c1
5544c1
Add an explicit CPUState parameter instead of relying on AREG0.
5544c1
5544c1
For easier review, convert only op helpers which don't return any value.
5544c1
5544c1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
5544c1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 target-arm/helper.h    |  8 ++++----
5544c1
 target-arm/op_helper.c | 20 ++++++++++----------
5544c1
 target-arm/translate.c |  8 ++++----
5544c1
 3 files changed, 18 insertions(+), 18 deletions(-)
5544c1
5544c1
diff --git a/target-arm/helper.h b/target-arm/helper.h
5544c1
index 21e9cfe..106aacd 100644
5544c1
--- a/target-arm/helper.h
5544c1
+++ b/target-arm/helper.h
5544c1
@@ -50,10 +50,10 @@ DEF_HELPER_2(usad8, i32, i32, i32)
5544c1
 DEF_HELPER_1(logicq_cc, i32, i64)
5544c1
 
5544c1
 DEF_HELPER_3(sel_flags, i32, i32, i32, i32)
5544c1
-DEF_HELPER_1(exception, void, i32)
5544c1
-DEF_HELPER_0(wfi, void)
5544c1
+DEF_HELPER_2(exception, void, env, i32)
5544c1
+DEF_HELPER_1(wfi, void, env)
5544c1
 
5544c1
-DEF_HELPER_2(cpsr_write, void, i32, i32)
5544c1
+DEF_HELPER_3(cpsr_write, void, env, i32, i32)
5544c1
 DEF_HELPER_0(cpsr_read, i32)
5544c1
 
5544c1
 DEF_HELPER_3(v7m_msr, void, env, i32, i32)
5544c1
@@ -68,7 +68,7 @@ DEF_HELPER_2(get_r13_banked, i32, env, i32)
5544c1
 DEF_HELPER_3(set_r13_banked, void, env, i32, i32)
5544c1
 
5544c1
 DEF_HELPER_1(get_user_reg, i32, i32)
5544c1
-DEF_HELPER_2(set_user_reg, void, i32, i32)
5544c1
+DEF_HELPER_3(set_user_reg, void, env, i32, i32)
5544c1
 
5544c1
 DEF_HELPER_1(vfp_get_fpscr, i32, env)
5544c1
 DEF_HELPER_2(vfp_set_fpscr, void, env, i32)
5544c1
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
5544c1
index d77bfab..b1adce3 100644
5544c1
--- a/target-arm/op_helper.c
5544c1
+++ b/target-arm/op_helper.c
5544c1
@@ -23,7 +23,7 @@
5544c1
 #define SIGNBIT (uint32_t)0x80000000
5544c1
 #define SIGNBIT64 ((uint64_t)1 << 63)
5544c1
 
5544c1
-static void raise_exception(int tt)
5544c1
+static void raise_exception(CPUARMState *env, int tt)
5544c1
 {
5544c1
     env->exception_index = tt;
5544c1
     cpu_loop_exit(env);
5544c1
@@ -93,7 +93,7 @@ void tlb_fill(CPUARMState *env1, target_ulong addr, int is_write, int mmu_idx,
5544c1
                 cpu_restore_state(tb, env, retaddr);
5544c1
             }
5544c1
         }
5544c1
-        raise_exception(env->exception_index);
5544c1
+        raise_exception(env, env->exception_index);
5544c1
     }
5544c1
     env = saved_env;
5544c1
 }
5544c1
@@ -230,14 +230,14 @@ uint32_t HELPER(usat16)(uint32_t x, uint32_t shift)
5544c1
     return res;
5544c1
 }
5544c1
 
5544c1
-void HELPER(wfi)(void)
5544c1
+void HELPER(wfi)(CPUARMState *env)
5544c1
 {
5544c1
     env->exception_index = EXCP_HLT;
5544c1
     env->halted = 1;
5544c1
     cpu_loop_exit(env);
5544c1
 }
5544c1
 
5544c1
-void HELPER(exception)(uint32_t excp)
5544c1
+void HELPER(exception)(CPUARMState *env, uint32_t excp)
5544c1
 {
5544c1
     env->exception_index = excp;
5544c1
     cpu_loop_exit(env);
5544c1
@@ -248,7 +248,7 @@ uint32_t HELPER(cpsr_read)(void)
5544c1
     return cpsr_read(env) & ~CPSR_EXEC;
5544c1
 }
5544c1
 
5544c1
-void HELPER(cpsr_write)(uint32_t val, uint32_t mask)
5544c1
+void HELPER(cpsr_write)(CPUARMState *env, uint32_t val, uint32_t mask)
5544c1
 {
5544c1
     cpsr_write(env, val, mask);
5544c1
 }
5544c1
@@ -271,7 +271,7 @@ uint32_t HELPER(get_user_reg)(uint32_t regno)
5544c1
     return val;
5544c1
 }
5544c1
 
5544c1
-void HELPER(set_user_reg)(uint32_t regno, uint32_t val)
5544c1
+void HELPER(set_user_reg)(CPUARMState *env, uint32_t regno, uint32_t val)
5544c1
 {
5544c1
     if (regno == 13) {
5544c1
         env->banked_r13[0] = val;
5544c1
@@ -290,7 +290,7 @@ void HELPER(set_cp_reg)(CPUARMState *env, void *rip, uint32_t value)
5544c1
     const ARMCPRegInfo *ri = rip;
5544c1
     int excp = ri->writefn(env, ri, value);
5544c1
     if (excp) {
5544c1
-        raise_exception(excp);
5544c1
+        raise_exception(env, excp);
5544c1
     }
5544c1
 }
5544c1
 
5544c1
@@ -300,7 +300,7 @@ uint32_t HELPER(get_cp_reg)(CPUARMState *env, void *rip)
5544c1
     uint64_t value;
5544c1
     int excp = ri->readfn(env, ri, &value);
5544c1
     if (excp) {
5544c1
-        raise_exception(excp);
5544c1
+        raise_exception(env, excp);
5544c1
     }
5544c1
     return value;
5544c1
 }
5544c1
@@ -310,7 +310,7 @@ void HELPER(set_cp_reg64)(CPUARMState *env, void *rip, uint64_t value)
5544c1
     const ARMCPRegInfo *ri = rip;
5544c1
     int excp = ri->writefn(env, ri, value);
5544c1
     if (excp) {
5544c1
-        raise_exception(excp);
5544c1
+        raise_exception(env, excp);
5544c1
     }
5544c1
 }
5544c1
 
5544c1
@@ -320,7 +320,7 @@ uint64_t HELPER(get_cp_reg64)(CPUARMState *env, void *rip)
5544c1
     uint64_t value;
5544c1
     int excp = ri->readfn(env, ri, &value);
5544c1
     if (excp) {
5544c1
-        raise_exception(excp);
5544c1
+        raise_exception(env, excp);
5544c1
     }
5544c1
     return value;
5544c1
 }
5544c1
diff --git a/target-arm/translate.c b/target-arm/translate.c
5544c1
index edef79a..6f651d9 100644
5544c1
--- a/target-arm/translate.c
5544c1
+++ b/target-arm/translate.c
5544c1
@@ -199,7 +199,7 @@ static void store_reg(DisasContext *s, int reg, TCGv var)
5544c1
 static inline void gen_set_cpsr(TCGv var, uint32_t mask)
5544c1
 {
5544c1
     TCGv tmp_mask = tcg_const_i32(mask);
5544c1
-    gen_helper_cpsr_write(var, tmp_mask);
5544c1
+    gen_helper_cpsr_write(cpu_env, var, tmp_mask);
5544c1
     tcg_temp_free_i32(tmp_mask);
5544c1
 }
5544c1
 /* Set NZCV flags from the high 4 bits of var.  */
5544c1
@@ -209,7 +209,7 @@ static void gen_exception(int excp)
5544c1
 {
5544c1
     TCGv tmp = tcg_temp_new_i32();
5544c1
     tcg_gen_movi_i32(tmp, excp);
5544c1
-    gen_helper_exception(tmp);
5544c1
+    gen_helper_exception(cpu_env, tmp);
5544c1
     tcg_temp_free_i32(tmp);
5544c1
 }
5544c1
 
5544c1
@@ -7719,7 +7719,7 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s)
5544c1
                             tmp = gen_ld32(addr, IS_USER(s));
5544c1
                             if (user) {
5544c1
                                 tmp2 = tcg_const_i32(i);
5544c1
-                                gen_helper_set_user_reg(tmp2, tmp);
5544c1
+                                gen_helper_set_user_reg(cpu_env, tmp2, tmp);
5544c1
                                 tcg_temp_free_i32(tmp2);
5544c1
                                 tcg_temp_free_i32(tmp);
5544c1
                             } else if (i == rn) {
5544c1
@@ -9913,7 +9913,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env,
5544c1
             /* nothing more to generate */
5544c1
             break;
5544c1
         case DISAS_WFI:
5544c1
-            gen_helper_wfi();
5544c1
+            gen_helper_wfi(cpu_env);
5544c1
             break;
5544c1
         case DISAS_SWI:
5544c1
             gen_exception(EXCP_SWI);
5544c1
-- 
5544c1
1.7.12.1
5544c1