aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Native/macos_jit_support
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-01-10 19:16:59 -0300
committerGitHub <noreply@github.com>2023-01-10 19:16:59 -0300
commit5e0f8e873857ce3ca3f532aff0936beb28e412c8 (patch)
tree576e5110c076b7d1f4d94e608ee21493f5b48879 /ARMeilleure/Native/macos_jit_support
parentd16288a2a87f0979df30ba69d4fe10660177b6ac (diff)
Implement JIT Arm64 backend (#4114)
* Implement JIT Arm64 backend * PPTC version bump * Address some feedback from Arm64 JIT PR * Address even more PR feedback * Remove unused IsPageAligned function * Sync Qc flag before calls * Fix comment and remove unused enum * Address riperiperi PR feedback * Delete Breakpoint IR instruction that was only implemented for Arm64
Diffstat (limited to 'ARMeilleure/Native/macos_jit_support')
-rw-r--r--ARMeilleure/Native/macos_jit_support/Makefile8
-rw-r--r--ARMeilleure/Native/macos_jit_support/support.c14
2 files changed, 22 insertions, 0 deletions
diff --git a/ARMeilleure/Native/macos_jit_support/Makefile b/ARMeilleure/Native/macos_jit_support/Makefile
new file mode 100644
index 00000000..d6da35d5
--- /dev/null
+++ b/ARMeilleure/Native/macos_jit_support/Makefile
@@ -0,0 +1,8 @@
+NAME = libarmeilleure-jitsupport.dylib
+
+all: ${NAME}
+
+${NAME}:
+ clang -O3 -dynamiclib support.c -o ${NAME}
+clean:
+ rm -f ${NAME}
diff --git a/ARMeilleure/Native/macos_jit_support/support.c b/ARMeilleure/Native/macos_jit_support/support.c
new file mode 100644
index 00000000..1b13d906
--- /dev/null
+++ b/ARMeilleure/Native/macos_jit_support/support.c
@@ -0,0 +1,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);
+}