target-ppc: convert software TLB instructions to TCG
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 30 Nov 2008 16:22:56 +0000 (16:22 +0000)
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 30 Nov 2008 16:22:56 +0000 (16:22 +0000)
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5819 c046a42c-6fe2-441c-8c8c-71466251a162

target-ppc/helper.h
target-ppc/op.c
target-ppc/op_helper.c
target-ppc/op_helper.h
target-ppc/translate.c

index be6c6a0..67ba014 100644 (file)
@@ -139,4 +139,11 @@ DEF_HELPER_2(efdcmplt, i32, i64, i64)
 DEF_HELPER_2(efdcmpgt, i32, i64, i64)
 DEF_HELPER_2(efdcmpeq, i32, i64, i64)
 
+#if !defined(CONFIG_USER_ONLY)
+DEF_HELPER_1(load_6xx_tlbd, void, tl)
+DEF_HELPER_1(load_6xx_tlbi, void, tl)
+DEF_HELPER_1(load_74xx_tlbd, void, tl)
+DEF_HELPER_1(load_74xx_tlbi, void, tl)
+#endif
+
 #include "def-helper.h"
index 5d2cfa1..618bd3a 100644 (file)
@@ -378,34 +378,6 @@ void OPPROTO op_slbie_64 (void)
 #endif
 #endif
 
-#if !defined(CONFIG_USER_ONLY)
-/* PowerPC 602/603/755 software TLB load instructions */
-void OPPROTO op_6xx_tlbld (void)
-{
-    do_load_6xx_tlb(0);
-    RETURN();
-}
-
-void OPPROTO op_6xx_tlbli (void)
-{
-    do_load_6xx_tlb(1);
-    RETURN();
-}
-
-/* PowerPC 74xx software TLB load instructions */
-void OPPROTO op_74xx_tlbld (void)
-{
-    do_load_74xx_tlb(0);
-    RETURN();
-}
-
-void OPPROTO op_74xx_tlbli (void)
-{
-    do_load_74xx_tlb(1);
-    RETURN();
-}
-#endif
-
 /* 601 specific */
 void OPPROTO op_load_601_rtcl (void)
 {
index 6addc74..1ea5a98 100644 (file)
@@ -2460,7 +2460,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
 
 /* Software driven TLBs management */
 /* PowerPC 602/603 software TLB load instructions helpers */
-void do_load_6xx_tlb (int is_code)
+static void helper_load_6xx_tlb (target_ulong new_EPN, int is_code)
 {
     target_ulong RPN, CMP, EPN;
     int way;
@@ -2482,11 +2482,22 @@ void do_load_6xx_tlb (int is_code)
     }
 #endif
     /* Store this TLB */
-    ppc6xx_tlb_store(env, (uint32_t)(T0 & TARGET_PAGE_MASK),
+    ppc6xx_tlb_store(env, (uint32_t)(new_EPN & TARGET_PAGE_MASK),
                      way, is_code, CMP, RPN);
 }
 
-void do_load_74xx_tlb (int is_code)
+void helper_load_6xx_tlbd (target_ulong EPN)
+{
+    helper_load_6xx_tlb(EPN, 0);
+}
+
+void helper_load_6xx_tlbi (target_ulong EPN)
+{
+    helper_load_6xx_tlb(EPN, 1);
+}
+
+/* PowerPC 74xx software TLB load instructions helpers */
+static void helper_load_74xx_tlb (target_ulong new_EPN, int is_code)
 {
     target_ulong RPN, CMP, EPN;
     int way;
@@ -2503,10 +2514,20 @@ void do_load_74xx_tlb (int is_code)
     }
 #endif
     /* Store this TLB */
-    ppc6xx_tlb_store(env, (uint32_t)(T0 & TARGET_PAGE_MASK),
+    ppc6xx_tlb_store(env, (uint32_t)(new_EPN & TARGET_PAGE_MASK),
                      way, is_code, CMP, RPN);
 }
 
+void helper_load_74xx_tlbd (target_ulong EPN)
+{
+    helper_load_74xx_tlb(EPN, 0);
+}
+
+void helper_load_74xx_tlbi (target_ulong EPN)
+{
+    helper_load_74xx_tlb(EPN, 1);
+}
+
 static always_inline target_ulong booke_tlb_to_page_size (int size)
 {
     return 1024 << (2 * size);
index 1c046d8..5e36f57 100644 (file)
@@ -67,8 +67,6 @@ void do_rfi (void);
 void do_rfid (void);
 void do_hrfid (void);
 #endif
-void do_load_6xx_tlb (int is_code);
-void do_load_74xx_tlb (int is_code);
 #endif
 
 /* POWER / PowerPC 601 specific helpers */
index 95cb482..083bf28 100644 (file)
@@ -4965,8 +4965,7 @@ GEN_HANDLER2(tlbld_6xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_6xx_TLB)
         GEN_EXCP_PRIVOPC(ctx);
         return;
     }
-    tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
-    gen_op_6xx_tlbld();
+    gen_helper_load_6xx_tlbd(cpu_gpr[rB(ctx->opcode)]);
 #endif
 }
 
@@ -4980,8 +4979,7 @@ GEN_HANDLER2(tlbli_6xx, "tlbli", 0x1F, 0x12, 0x1F, 0x03FF0001, PPC_6xx_TLB)
         GEN_EXCP_PRIVOPC(ctx);
         return;
     }
-    tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
-    gen_op_6xx_tlbli();
+    gen_helper_load_6xx_tlbi(cpu_gpr[rB(ctx->opcode)]);
 #endif
 }
 
@@ -4996,8 +4994,7 @@ GEN_HANDLER2(tlbld_74xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_74xx_TLB)
         GEN_EXCP_PRIVOPC(ctx);
         return;
     }
-    tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
-    gen_op_74xx_tlbld();
+    gen_helper_load_74xx_tlbd(cpu_gpr[rB(ctx->opcode)]);
 #endif
 }
 
@@ -5011,8 +5008,7 @@ GEN_HANDLER2(tlbli_74xx, "tlbli", 0x1F, 0x12, 0x1F, 0x03FF0001, PPC_74xx_TLB)
         GEN_EXCP_PRIVOPC(ctx);
         return;
     }
-    tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
-    gen_op_74xx_tlbli();
+    gen_helper_load_74xx_tlbi(cpu_gpr[rB(ctx->opcode)]);
 #endif
 }