aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Native/macos_jit_support/support.c
blob: 1b13d90668895b25f73ff35fd8115a0ccbd2400b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stddef.h>
#include <string.h>
#include <pthread.h>

#include <libkern/OSCacheControl.h>

void armeilleure_jit_memcpy(void *dst, const void *src, size_t n) {
    pthread_jit_write_protect_np(0);
    memcpy(dst, src, n);
    pthread_jit_write_protect_np(1);

    // Ensure that the instruction cache for this range is invalidated.
    sys_icache_invalidate(dst, n);
}