Skip to contentSkip to conversation

[5881] target-ppc: add functions to load/store SPR

Qemu-devel Aurelien Jarno 1 participant 1 message Dec 5, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5881

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5881
Author:   aurel32
Date:     2008-12-05 07:21:31 +0000 (Fri, 05 Dec 2008)

Log Message:
-----------
target-ppc: add functions to load/store SPR

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

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

target-ppc/translate.c +13 -2
@@ -688,6 +688,17 @@
     .oname = stringify(name),                                                 \
 }
 
+/* SPR load/store helpers */
+static always_inline void gen_load_spr(TCGv t, int reg)
+{
+    tcg_gen_ld_tl(t, cpu_env, offsetof(CPUState, spr[reg]));
+}
+
+static always_inline void gen_store_spr(int reg, TCGv t)
+{
+    tcg_gen_st_tl(t, cpu_env, offsetof(CPUState, spr[reg]));
+}
+
 /* Start opcode list */
 GEN_OPCODE_MARK(start);
 
@@ -1550,10 +1561,10 @@
         }
         if (prio) {
             TCGv t0 = tcg_temp_new();
-            tcg_gen_ld_tl(t0, cpu_env, offsetof(CPUState, spr[SPR_PPR]));
+            gen_load_spr(t0, SPR_PPR);
             tcg_gen_andi_tl(t0, t0, ~0x001C000000000000ULL);
             tcg_gen_ori_tl(t0, t0, ((uint64_t)prio) << 50);
-            tcg_gen_st_tl(t0, cpu_env, offsetof(CPUState, spr[SPR_PPR]));
+            gen_store_spr(SPR_PPR, t0);
             tcg_temp_free(t0);
         }
 #endif