target-ppc: convert icbi instruction to TCG

Signed-off-by: Aurelien Jarno <[email protected]>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5827 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index 6f6f1ec..98c4289 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -210,6 +210,32 @@
         do_dcbz(addr, env->dcache_line_size);
 }
 
+void helper_icbi(target_ulong addr)
+{
+    uint32_t tmp;
+
+    addr = get_addr(addr & ~(env->dcache_line_size - 1));
+    /* Invalidate one cache line :
+     * PowerPC specification says this is to be treated like a load
+     * (not a fetch) by the MMU. To be sure it will be so,
+     * do the load "by hand".
+     */
+#ifdef CONFIG_USER_ONLY
+    tmp = ldl_raw(addr);
+#else
+    switch (env->mmu_idx) {
+    default:
+    case 0: tmp = ldl_user(addr);
+        break;
+    case 1: tmp = ldl_kernel(addr);
+        break;
+    case 2: tmp = ldl_hypv(addr);
+        break;
+    }
+#endif
+    tb_invalidate_page_range(addr, addr + env->icache_line_size);
+}
+
 /*****************************************************************************/
 /* Fixed point operations helpers */
 #if defined(TARGET_PPC64)