From 7ef44d652ae9e5e1f5b3465d73684e4a54de73c0 Mon Sep 17 00:00:00 2001 From: Yaroslav Kolomiiets Date: Mon, 27 Feb 2017 17:23:28 +0200 Subject: add AIX/power port --- emu/AIX/segflush-power.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 emu/AIX/segflush-power.c (limited to 'emu/AIX/segflush-power.c') diff --git a/emu/AIX/segflush-power.c b/emu/AIX/segflush-power.c new file mode 100644 index 00000000..5029b0aa --- /dev/null +++ b/emu/AIX/segflush-power.c @@ -0,0 +1,33 @@ +#include + +#include "dat.h" + + +/* + * from geoff collyer's port + * invalidate instruction cache and write back data cache from a to a+n-1, + * at least. + */ +int +segflush(void *a, ulong n) +{ + ulong *p; + + // cache blocks are often eight words (32 bytes) long, sometimes 16 bytes. + // need to determine it dynamically? + for (p = (ulong *)((ulong)a & ~7UL); (char *)p < (char *)a + n; p++) + __asm__("dcbst 0,r0\n\t" // not dcbf, which writes back, then invalidates + "icbi 0,r0\n\t" + : // no output + : "ar" (p) + ); + __asm__("sync\n\t" + : // no output + : + ); + __asm__("isync\n\t" + : // no output + : + ); + return 0; +} -- cgit v1.2.3