summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc/stand/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/powerpc/stand/cache.c')
-rw-r--r--sys/arch/powerpc/stand/cache.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/arch/powerpc/stand/cache.c b/sys/arch/powerpc/stand/cache.c
new file mode 100644
index 00000000000..c40dead4394
--- /dev/null
+++ b/sys/arch/powerpc/stand/cache.c
@@ -0,0 +1,22 @@
+#define CACHELINESIZE 32 /* For now XXX */
+
+void
+syncicache(from, len)
+ void *from;
+ int len;
+{
+ int l = len;
+ void *p = from;
+
+ do {
+ asm volatile ("dcbst 0,%0" :: "r"(p));
+ p += CACHELINESIZE;
+ } while ((l -= CACHELINESIZE) > 0);
+ asm volatile ("sync");
+ do {
+ asm volatile ("icbi 0,%0" :: "r"(from));
+ from += CACHELINESIZE;
+ } while ((len -= CACHELINESIZE) > 0);
+ asm volatile ("isync");
+}
+