]> Git Repo - qemu.git/blobdiff - target-sh4/op_helper.c
SH4: convert a few helpers to TCG
[qemu.git] / target-sh4 / op_helper.c
index f02fa588fc4e5d628aa712919f539de4944af3a7..8504115400d0028399f7e32feb5b75522ace9a8a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  SH4 emulation
- * 
+ *
  *  Copyright (c) 2005 Samuel Tardieu
  *
  * This library is free software; you can redistribute it and/or
 #include <assert.h>
 #include "exec.h"
 
-void cpu_loop_exit(void)
-{
-    longjmp(env->jmp_env, 1);
-}
-
-void do_raise_exception(void)
-{
-    cpu_loop_exit();
-}
-
 #ifndef CONFIG_USER_ONLY
 
 #define MMUSUFFIX _mmu
-#define GETPC() (__builtin_return_address(0))
 
 #define SHIFT 0
 #include "softmmu_template.h"
@@ -47,7 +36,7 @@ void do_raise_exception(void)
 #define SHIFT 3
 #include "softmmu_template.h"
 
-void tlb_fill(target_ulong addr, int is_write, int is_user, void *retaddr)
+void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr)
 {
     TranslationBlock *tb;
     CPUState *saved_env;
@@ -58,7 +47,7 @@ void tlb_fill(target_ulong addr, int is_write, int is_user, void *retaddr)
        generated code */
     saved_env = env;
     env = cpu_single_env;
-    ret = cpu_sh4_handle_mmu_fault(env, addr, is_write, is_user, 1);
+    ret = cpu_sh4_handle_mmu_fault(env, addr, is_write, mmu_idx, 1);
     if (ret) {
        if (retaddr) {
            /* now we have a real cpu fault */
@@ -70,13 +59,55 @@ void tlb_fill(target_ulong addr, int is_write, int is_user, void *retaddr)
                cpu_restore_state(tb, env, pc, NULL);
            }
        }
-       do_raise_exception();
+       cpu_loop_exit();
     }
     env = saved_env;
 }
 
 #endif
 
+void helper_ldtlb(void)
+{
+#ifdef CONFIG_USER_ONLY
+    /* XXXXX */
+    assert(0);
+#else
+    cpu_load_tlb(env);
+#endif
+}
+
+void helper_raise_illegal_instruction(void)
+{
+    env->exception_index = 0x180;
+    cpu_loop_exit();
+}
+
+void helper_raise_slot_illegal_instruction(void)
+{
+    env->exception_index = 0x1a0;
+    cpu_loop_exit();
+}
+
+void helper_debug(void)
+{
+    env->exception_index = EXCP_DEBUG;
+    cpu_loop_exit();
+}
+
+void helper_sleep(void)
+{
+    env->halted = 1;
+    env->exception_index = EXCP_HLT;
+    cpu_loop_exit();
+}
+
+void helper_trapa(uint32_t tra)
+{
+    env->tra = tra << 2;
+    env->exception_index = 0x160;
+    cpu_loop_exit();
+}
+
 void helper_addc_T0_T1(void)
 {
     uint32_t tmp0, tmp1;
This page took 0.028093 seconds and 4 git commands to generate.