support.c 376 B

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