#include //Originally written by Segher, but I changed the function enough to be "mine" void sync_before_exec(const void *p, uint32_t len) { uint32_t x, y; x = (uint32_t)p & ~0x1f; y = ((uint32_t)p + len + 0x1f) & ~0x1f; while(x < y) { asm("dcbst 0,%0 ; sync ; icbi 0,%0" : : "b"(x)); x += 32; } asm("sync ; isync"); }