1 /* $OpenBSD: cache.c,v 1.2 2003/10/16 04:30:09 drahn Exp $ */ 2 #define CACHELINESIZE 32 /* For now XXX */ 3 4 void 5 syncicache(void *from, int len) 6 { 7 int l = len; 8 void *p = from; 9 10 do { 11 asm volatile ("dcbf %1,%0" :: "r"(p), "r"(0)); 12 p += CACHELINESIZE; 13 } while ((l -= CACHELINESIZE) > 0); 14 asm volatile ("sync"); 15 do { 16 asm volatile ("icbi %1,%0" :: "r"(from), "r"(0)); 17 from += CACHELINESIZE; 18 } while ((len -= CACHELINESIZE) > 0); 19 asm volatile ("isync"); 20 } 21