summaryrefslogtreecommitdiff
path: root/src/lj_mcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_mcode.c')
-rw-r--r--src/lj_mcode.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/lj_mcode.c b/src/lj_mcode.c
index a48f9e55..7857ebc0 100644
--- a/src/lj_mcode.c
+++ b/src/lj_mcode.c
@@ -29,15 +29,6 @@
29void sys_icache_invalidate(void *start, size_t len); 29void sys_icache_invalidate(void *start, size_t len);
30#endif 30#endif
31 31
32#if LJ_TARGET_LINUX && LJ_TARGET_PPC
33#include <dlfcn.h>
34static void (*mcode_sync_ppc)(void *start, void *end);
35static void mcode_sync_dummy(void *start, void *end)
36{
37 UNUSED(start); UNUSED(end);
38}
39#endif
40
41/* Synchronize data/instruction cache. */ 32/* Synchronize data/instruction cache. */
42void lj_mcode_sync(void *start, void *end) 33void lj_mcode_sync(void *start, void *end)
43{ 34{
@@ -48,14 +39,9 @@ void lj_mcode_sync(void *start, void *end)
48 UNUSED(start); UNUSED(end); 39 UNUSED(start); UNUSED(end);
49#elif LJ_TARGET_OSX 40#elif LJ_TARGET_OSX
50 sys_icache_invalidate(start, (char *)end-(char *)start); 41 sys_icache_invalidate(start, (char *)end-(char *)start);
51#elif LJ_TARGET_LINUX && LJ_TARGET_PPC 42#elif LJ_TARGET_PPC
52 if (!mcode_sync_ppc) { 43 lj_vm_cachesync(start, end);
53 void *vdso = dlopen("linux-vdso32.so.1", RTLD_LAZY); 44#elif defined(__GNUC__)
54 if (!vdso || !(mcode_sync_ppc = dlsym(vdso, "__kernel_sync_dicache")))
55 mcode_sync_ppc = mcode_sync_dummy;
56 }
57 mcode_sync_ppc(start, end);
58#elif defined(__GNUC__) && !LJ_TARGET_PPC
59 __clear_cache(start, end); 45 __clear_cache(start, end);
60#else 46#else
61#error "Missing builtin to flush instruction cache" 47#error "Missing builtin to flush instruction cache"