support.c
1 #include <stddef.h> 2 #include <string.h> 3 #include <pthread.h> 4 5 #include <libkern/OSCacheControl.h> 6 7 void armeilleure_jit_memcpy(void *dst, const void *src, size_t n) { 8 pthread_jit_write_protect_np(0); 9 memcpy(dst, src, n); 10 pthread_jit_write_protect_np(1); 11 12 // Ensure that the instruction cache for this range is invalidated. 13 sys_icache_invalidate(dst, n); 14 }