aboutsummaryrefslogtreecommitdiff
path: root/target-ppc/op_helper.c
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-30 16:24:05 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-30 16:24:05 +0000
commit799a8c8d0a33ee8732407530f1a06a649be3b0bc (patch)
tree08d8b264dfe3c8ed9fe35c298b8c03a1e45946ea /target-ppc/op_helper.c
parentff4a62cd8100f373ce0195d5e888c191a1a07516 (diff)
target-ppc: convert dcbz instruction to TCG
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5826 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc/op_helper.c')
-rw-r--r--target-ppc/op_helper.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index 4796e60859..6f6f1ec23d 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -56,7 +56,6 @@ void helper_raise_debug (void)
raise_exception(env, EXCP_DEBUG);
}
-
/*****************************************************************************/
/* Registers load and stores */
target_ulong helper_load_cr (void)
@@ -171,6 +170,46 @@ void helper_stmw (target_ulong addr, uint32_t reg)
}
}
+static void do_dcbz(target_ulong addr, int dcache_line_size)
+{
+ target_long mask = get_addr(~(dcache_line_size - 1));
+ int i;
+#ifdef CONFIG_USER_ONLY
+#define stfun stl_raw
+#else
+ void (*stfun)(target_ulong, int);
+
+ switch (env->mmu_idx) {
+ default:
+ case 0: stfun = stl_user;
+ break;
+ case 1: stfun = stl_kernel;
+ break;
+ case 2: stfun = stl_hypv;
+ break;
+ }
+#endif
+ addr &= mask;
+ for (i = 0 ; i < dcache_line_size ; i += 4) {
+ stfun(addr + i , 0);
+ }
+ if ((env->reserve & mask) == addr)
+ env->reserve = (target_ulong)-1ULL;
+}
+
+void helper_dcbz(target_ulong addr)
+{
+ do_dcbz(addr, env->dcache_line_size);
+}
+
+void helper_dcbz_970(target_ulong addr)
+{
+ if (((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1)
+ do_dcbz(addr, 32);
+ else
+ do_dcbz(addr, env->dcache_line_size);
+}
+
/*****************************************************************************/
/* Fixed point operations helpers */
#if defined(TARGET_PPC64)
@@ -1219,7 +1258,6 @@ uint64_t helper_fnmsub (uint64_t arg1, uint64_t arg2, uint64_t arg3)
return farg1.ll;
}
-
/* frsp - frsp. */
uint64_t helper_frsp (uint64_t arg)
{