diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
index f5d9bf3..f9793e6 100644
--- a/tcg/ppc/tcg-target.c
+++ b/tcg/ppc/tcg-target.c
@@ -1260,6 +1260,17 @@ static void tcg_out_brcond2 (TCGContext *s, const TCGArg *args,
     tcg_out_bc (s, (BC | BI (7, CR_EQ) | BO_COND_TRUE), args[5]);
 }
 
+#ifdef __NetBSD__
+static void flush_icache_range(unsigned long begin, unsigned long end)
+{
+    unsigned int i = begin & ~15UL;
+    for (; i < end; i+=16) {
+        asm("icbi 0,%0" : : "r"(i));
+    }
+    asm("isync");
+}
+#endif
+
 void ppc_tb_set_jmp_target (unsigned long jmp_addr, unsigned long addr)
 {
     uint32_t *ptr;
