#include #include #include #include #include #include /* assumes EABI */ #define __NR_SYSCALL_BASE (0) #define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000) #define __ARM_NR_cacheflush (__ARM_NR_BASE+2) static int cacheflush(void *start, void *end, int flags) { return syscall(__ARM_NR_cacheflush, start, end, flags); } int main(void) { int rc, map_size; void *buf; map_size = 4096; buf = mmap(NULL, map_size, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); if (buf == MAP_FAILED) { perror("mmap"); return EXIT_FAILURE; } printf("about to cacheflush from %p to %p\n", buf, buf + map_size); fflush(stdout); rc = cacheflush(buf, buf + map_size, 0); if (rc) { perror("cacheflush"); return EXIT_FAILURE; } return EXIT_SUCCESS; }