Skip to contentSkip to conversation

[5772] target-ppc: convert exceptions generation to TCG

Qemu-devel Aurelien Jarno 1 participant 1 message Nov 22, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5772

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5772
Author:   aurel32
Date:     2008-11-22 10:09:17 +0000 (Sat, 22 Nov 2008)

Log Message:
-----------
target-ppc: convert exceptions generation to TCG

Modified Paths:
--------------
trunk/cpu-exec.c
trunk/target-ppc/exec.h
trunk/target-ppc/helper.c
trunk/target-ppc/helper.h
trunk/target-ppc/op.c
trunk/target-ppc/op_helper.c
trunk/target-ppc/op_mem.h
trunk/target-ppc/translate.c

Modified: trunk/cpu-exec.c
===================================================================

cpu-exec.c +1 -1
@@ -918,7 +918,7 @@
     /* we restore the process signal mask as the sigreturn should
        do it (XXX: use sigsetjmp) */
         sigprocmask(SIG_SETMASK, old_set, NULL);
-        do_raise_exception_err(env->exception_index, env->error_code);
+        raise_exception_err(env, env->exception_index, env->error_code);
     } else {
         /* activate soft MMU for this block */
         cpu_resume_from_signal(env, puc);

Modified: trunk/target-ppc/exec.h
===================================================================

target-ppc/exec.h +2 -2
@@ -94,8 +94,8 @@
 #include "softmmu_exec.h"
 #endif /* !defined(CONFIG_USER_ONLY) */
 
-void do_raise_exception_err (uint32_t exception, int error_code);
-void do_raise_exception (uint32_t exception);
+void raise_exception_err (CPUState *env, int exception, int error_code);
+void raise_exception (CPUState *env, int exception);
 
 int get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong vaddr,
                           int rw, int access_type);

Modified: trunk/target-ppc/helper.c
===================================================================

target-ppc/helper.c +18 -0
@@ -40,6 +40,24 @@
 //#define FLUSH_ALL_TLBS
 
 /*****************************************************************************/
+/* Exceptions processing */
+
+void raise_exception_err (CPUState *env, int exception, int error_code)
+{
+#if 0
+    printf("Raise exception %3x code : %d\n", exception, error_code);
+#endif
+    env->exception_index = exception;
+    env->error_code = error_code;
+    cpu_loop_exit();
+}
+
+void raise_exception (CPUState *env, int exception)
+{
+    helper_raise_exception_err(exception, 0);
+}
+
+/*****************************************************************************/
 /* PowerPC MMU emulation */
 
 #if defined(CONFIG_USER_ONLY)

Modified: trunk/target-ppc/helper.h
===================================================================

target-ppc/helper.h +3 -0
@@ -1,5 +1,8 @@
 #include "def-helper.h"
 
+DEF_HELPER_2(raise_exception_err, void, i32, i32)
+DEF_HELPER_0(raise_debug, void)
+
 DEF_HELPER_2(fcmpo, i32, i64, i64)
 DEF_HELPER_2(fcmpu, i32, i64, i64)
 

Modified: trunk/target-ppc/op.c
===================================================================

target-ppc/op.c +0 -11
@@ -26,17 +26,6 @@
 #include "helper_regs.h"
 #include "op_helper.h"
 
-/* Generate exceptions */
-void OPPROTO op_raise_exception_err (void)
-{
-    do_raise_exception_err(PARAM1, PARAM2);
-}
-
-void OPPROTO op_debug (void)
-{
-    do_raise_exception(EXCP_DEBUG);
-}
-
 #if !defined(CONFIG_USER_ONLY)
 /* Segment registers load and store */
 void OPPROTO op_load_sr (void)

Modified: trunk/target-ppc/op_helper.c
===================================================================

target-ppc/op_helper.c +22 -26

128 lines not on this page · raw message

Modified: trunk/target-ppc/op_mem.h
===================================================================

target-ppc/op_mem.h +22 -22

152 lines not on this page · raw message

Modified: trunk/target-ppc/translate.c
===================================================================

target-ppc/translate.c +8 -4
@@ -293,10 +293,14 @@
 
 #define GEN_EXCP(ctx, excp, error)                                            \
 do {                                                                          \
+    TCGv_i32 t0 = tcg_const_i32(excp);                                        \
+    TCGv_i32 t1 = tcg_const_i32(error);                                       \
     if ((ctx)->exception == POWERPC_EXCP_NONE) {                              \
         gen_update_nip(ctx, (ctx)->nip);                                      \
     }                                                                         \
-    gen_op_raise_exception_err((excp), (error));                              \
+    gen_helper_raise_exception_err(t0, t1);                                   \
+    tcg_temp_free_i32(t0);                                                    \
+    tcg_temp_free_i32(t1);                                                    \
     ctx->exception = (excp);                                                  \
 } while (0)
 
@@ -3470,7 +3474,7 @@
             }
             if (ctx->singlestep_enabled & GDBSTUB_SINGLE_STEP) {
                 gen_update_nip(ctx, dest);
-                gen_op_debug();
+                gen_helper_raise_debug();
             }
         }
         tcg_gen_exit_tb(0);
@@ -7233,7 +7237,7 @@
             for (bp = env->breakpoints; bp != NULL; bp = bp->next) {
                 if (bp->pc == ctx.nip) {
                     gen_update_nip(&ctx, ctx.nip);
-                    gen_op_debug();
+                    gen_helper_raise_debug();
                     break;
                 }
             }
@@ -7344,7 +7348,7 @@
     } else if (ctx.exception != POWERPC_EXCP_BRANCH) {
         if (unlikely(env->singlestep_enabled)) {
             gen_update_nip(&ctx, ctx.nip);
-            gen_op_debug();
+            gen_helper_raise_debug();
         }
         /* Generate the return instruction */
         tcg_gen_exit_tb(0);