qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 5/6] arm: move exception and wfi helpers to helper.c


From: Blue Swirl
Subject: [Qemu-devel] [PATCH 5/6] arm: move exception and wfi helpers to helper.c
Date: Sat, 24 Mar 2012 19:00:54 +0000

Add an explicit CPUARMState parameter instead of relying on AREG0
and move exception and wfi helpers to helper.c. Merge raise_exception()
and helper_exception().

Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Blue Swirl <address@hidden>
---
 target-arm/helper.c    |   13 +++++++++++++
 target-arm/helper.h    |    4 ++--
 target-arm/op_helper.c |   23 +----------------------
 target-arm/translate.c |    4 ++--
 4 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/target-arm/helper.c b/target-arm/helper.c
index 35c7890..fbf1eea 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -774,6 +774,19 @@ uint32_t HELPER(ror_cc)(CPUARMState *env,
uint32_t x, uint32_t i)
     }
 }

+void HELPER(wfi)(CPUARMState *env)
+{
+    env->exception_index = EXCP_HLT;
+    env->halted = 1;
+    cpu_loop_exit(env);
+}
+
+void HELPER(exception)(CPUARMState *env, uint32_t excp)
+{
+    env->exception_index = excp;
+    cpu_loop_exit(env);
+}
+
 #if defined(CONFIG_USER_ONLY)

 void do_interrupt (CPUARMState *env)
diff --git a/target-arm/helper.h b/target-arm/helper.h
index 3e5f92e..e9f2201 100644
--- a/target-arm/helper.h
+++ b/target-arm/helper.h
@@ -50,8 +50,8 @@ DEF_HELPER_2(usad8, i32, i32, i32)
 DEF_HELPER_1(logicq_cc, i32, i64)

 DEF_HELPER_3(sel_flags, i32, i32, i32, i32)
-DEF_HELPER_1(exception, void, i32)
-DEF_HELPER_0(wfi, void)
+DEF_HELPER_2(exception, void, env, i32)
+DEF_HELPER_1(wfi, void, env)

 DEF_HELPER_3(cpsr_write, void, env, i32, i32)
 DEF_HELPER_1(cpsr_read, i32, env)
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index b1ced67..f1933c3 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -21,14 +21,6 @@
 #include "helper.h"

 #if !defined(CONFIG_USER_ONLY)
-static void raise_exception(int tt)
-{
-    env->exception_index = tt;
-    cpu_loop_exit(env);
-}
-#endif
-
-#if !defined(CONFIG_USER_ONLY)

 #include "softmmu_exec.h"

@@ -72,21 +64,8 @@ void tlb_fill(CPUARMState *env1, target_ulong addr,
int is_write, int mmu_idx,
                 cpu_restore_state(tb, env, pc);
             }
         }
-        raise_exception(env->exception_index);
+        helper_exception(env, env->exception_index);
     }
     env = saved_env;
 }
 #endif
-
-void HELPER(wfi)(void)
-{
-    env->exception_index = EXCP_HLT;
-    env->halted = 1;
-    cpu_loop_exit(env);
-}
-
-void HELPER(exception)(uint32_t excp)
-{
-    env->exception_index = excp;
-    cpu_loop_exit(env);
-}
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 1dcf8fe..a3b3449 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -208,7 +208,7 @@ static void gen_exception(int excp)
 {
     TCGv tmp = tcg_temp_new_i32();
     tcg_gen_movi_i32(tmp, excp);
-    gen_helper_exception(tmp);
+    gen_helper_exception(cpu_env, tmp);
     tcg_temp_free_i32(tmp);
 }

@@ -10083,7 +10083,7 @@ static inline void
gen_intermediate_code_internal(CPUARMState *env,
             /* nothing more to generate */
             break;
         case DISAS_WFI:
-            gen_helper_wfi();
+            gen_helper_wfi(cpu_env);
             break;
         case DISAS_SWI:
             gen_exception(EXCP_SWI);
-- 
1.7.9

Attachment: 0005-arm-move-exception-and-wfi-helpers-to-helper.c.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]