PPC: Use builtin D-Cache/I-Cache sync code.

This commit is contained in:
Mike Pall
2012-03-29 01:12:54 +02:00
parent a53a549774
commit 1980ee95b0
4 changed files with 522 additions and 484 deletions

View File

@@ -29,15 +29,6 @@
void sys_icache_invalidate(void *start, size_t len);
#endif
#if LJ_TARGET_LINUX && LJ_TARGET_PPC
#include <dlfcn.h>
static void (*mcode_sync_ppc)(void *start, void *end);
static void mcode_sync_dummy(void *start, void *end)
{
UNUSED(start); UNUSED(end);
}
#endif
/* Synchronize data/instruction cache. */
void lj_mcode_sync(void *start, void *end)
{
@@ -48,14 +39,9 @@ void lj_mcode_sync(void *start, void *end)
UNUSED(start); UNUSED(end);
#elif LJ_TARGET_OSX
sys_icache_invalidate(start, (char *)end-(char *)start);
#elif LJ_TARGET_LINUX && LJ_TARGET_PPC
if (!mcode_sync_ppc) {
void *vdso = dlopen("linux-vdso32.so.1", RTLD_LAZY);
if (!vdso || !(mcode_sync_ppc = dlsym(vdso, "__kernel_sync_dicache")))
mcode_sync_ppc = mcode_sync_dummy;
}
mcode_sync_ppc(start, end);
#elif defined(__GNUC__) && !LJ_TARGET_PPC
#elif LJ_TARGET_PPC
lj_vm_cachesync(start, end);
#elif defined(__GNUC__)
__clear_cache(start, end);
#else
#error "Missing builtin to flush instruction cache"