qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC] ppc403: load/store pb


From: Andreas Färber
Subject: [Qemu-devel] [RFC] ppc403: load/store pb
Date: Sun, 7 Dec 2008 14:12:46 +0100

Add TCG variables for 403's pb registers.

Replace op_load_403_pb with tcg_gen_mov_tl.
Convert do_store_403_pb to a TCG helper.

Signed-off-by: Andreas Faerber <address@hidden>
---
 This is not yet compile-tested.
No problematic dyngen ops seem to remain inside translate.c, but some more are used from translate_init.c. Some more similar conversions are coming up, so please let me know if I got this wrong again.

 Andreas

diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 5b26078..b647241 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -202,4 +202,8 @@ DEF_HELPER_2(divso, tl, tl, tl)
 DEF_HELPER_1(load_dcr, tl, tl);
 DEF_HELPER_2(store_dcr, void, tl, tl);

+#if !defined(CONFIG_USER_ONLY)
+DEF_HELPER_2(store_403_pb, void, i32, tl);
+#endif
+
 #include "def-helper.h"
diff --git a/target-ppc/op.c b/target-ppc/op.c
index 868db83..0c54d54 100644
--- a/target-ppc/op.c
+++ b/target-ppc/op.c
@@ -269,18 +269,6 @@ void OPPROTO op_store_pir (void)
     RETURN();
 }

-void OPPROTO op_load_403_pb (void)
-{
-    do_load_403_pb(PARAM1);
-    RETURN();
-}
-
-void OPPROTO op_store_403_pb (void)
-{
-    do_store_403_pb(PARAM1);
-    RETURN();
-}
-
 void OPPROTO op_load_40x_pit (void)
 {
     T0 = load_40x_pit(env);
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index a4dc41d..c599907 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -1818,15 +1818,10 @@ void helper_rfmci (void)
            ~((target_ulong)0x3FFF0000), 0);
 }

-void do_load_403_pb (int num)
+void helper_store_403_pb (uint32_t num, target_ulong value)
 {
-    T0 = env->pb[num];
-}
-
-void do_store_403_pb (int num)
-{
-    if (likely(env->pb[num] != T0)) {
-        env->pb[num] = T0;
+    if (likely(env->pb[num] != value)) {
+        env->pb[num] = value;
         /* Should be optimized */
         tlb_flush(env, 1);
     }
diff --git a/target-ppc/op_helper.h b/target-ppc/op_helper.h
index 0fc379a..497a072 100644
--- a/target-ppc/op_helper.h
+++ b/target-ppc/op_helper.h
@@ -30,9 +30,3 @@ void ppc_store_dump_spr (int sprn, target_ulong val);
 #if !defined(CONFIG_USER_ONLY)
 void do_store_hid0_601 (void);
 #endif
-
-/* PowerPC 403 specific helpers */
-#if !defined(CONFIG_USER_ONLY)
-void do_load_403_pb (int num);
-void do_store_403_pb (int num);
-#endif
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index b34de13..3dde023 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -54,7 +54,8 @@ static char cpu_reg_names[10*3 + 22*4 /* GPR */
 #endif
     + 10*4 + 22*5 /* FPR */
     + 2*(10*6 + 22*7) /* AVRh, AVRl */
-    + 8*5 /* CRF */];
+    + 8*5 /* CRF */
+    + 4*4 /* PB */];
 static TCGv cpu_gpr[32];
 #if !defined(TARGET_PPC64)
 static TCGv cpu_gprh[32];
@@ -62,6 +63,7 @@ static TCGv cpu_gprh[32];
 static TCGv_i64 cpu_fpr[32];
 static TCGv_i64 cpu_avrh[32], cpu_avrl[32];
 static TCGv_i32 cpu_crf[8];
+static TCGv cpu_pb[4];
 static TCGv cpu_nip;
 static TCGv cpu_msr;
 static TCGv cpu_ctr;
@@ -101,6 +103,13 @@ void ppc_translate_init(void)
         p += 5;
     }

+    for (i = 0; i < 4; i++) {
+        sprintf(p, "pb%d", i);
+        cpu_pb[i] = tcg_global_mem_new(TCG_AREG0,
+                                       offsetof(CPUState, pb[i]), p);
+        p += 4;
+    }
+
     for (i = 0; i < 32; i++) {
         sprintf(p, "r%d", i);
         cpu_gpr[i] = tcg_global_mem_new(TCG_AREG0,
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 4208f3d..62fad49 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -386,12 +386,12 @@ static void spr_write_booke_tsr (void *opaque, int sprn)
 #if !defined(CONFIG_USER_ONLY)
 static void spr_read_403_pbr (void *opaque, int sprn)
 {
-    gen_op_load_403_pb(sprn - SPR_403_PBL1);
+    tcg_gen_mov_tl(cpu_T[0], cpu_pb[sprn - SPR_403_PBL1]);
 }

 static void spr_write_403_pbr (void *opaque, int sprn)
 {
-    gen_op_store_403_pb(sprn - SPR_403_PBL1);
+    gen_helper_store_403_pb(sprn - SPR_403_PBL1, cpu_T[0]);
 }

 static void spr_write_pir (void *opaque, int sprn)

Attachment: op_403_pb.diff
Description: Binary data



reply via email to

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