diff options
| author | Mike Pall <mike> | 2011-10-24 16:18:02 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-10-24 16:18:02 +0200 |
| commit | 3591609dad5ac7179f67f799751265a91825406d (patch) | |
| tree | bb4d4de7fd920e575a78bdc8a5584acfda3ca165 /src | |
| parent | 8fc9bc172413630d1b7a769deb1ef7e45ffa9b0e (diff) | |
| download | luajit-3591609dad5ac7179f67f799751265a91825406d.tar.gz luajit-3591609dad5ac7179f67f799751265a91825406d.tar.bz2 luajit-3591609dad5ac7179f67f799751265a91825406d.zip | |
PPC: Add Linux/PPC cache flush mechanism.
GCC's __clear_cache() does nothing on PPC. Duh.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_asm.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index ff64402c..0c794ebb 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
| @@ -933,6 +933,15 @@ static uint32_t ir_khash(IRIns *ir) | |||
| 933 | void sys_icache_invalidate(void *start, size_t len); | 933 | void sys_icache_invalidate(void *start, size_t len); |
| 934 | #endif | 934 | #endif |
| 935 | 935 | ||
| 936 | #if LJ_TARGET_LINUX && LJ_TARGET_PPC | ||
| 937 | #include <dlfcn.h> | ||
| 938 | static void (*asm_ppc_cache_flush)(MCode *start, MCode *end); | ||
| 939 | static void asm_dummy_cache_flush(MCode *start, MCode *end) | ||
| 940 | { | ||
| 941 | UNUSED(start); UNUSED(end); | ||
| 942 | } | ||
| 943 | #endif | ||
| 944 | |||
| 936 | /* Flush instruction cache. */ | 945 | /* Flush instruction cache. */ |
| 937 | static void asm_cache_flush(MCode *start, MCode *end) | 946 | static void asm_cache_flush(MCode *start, MCode *end) |
| 938 | { | 947 | { |
| @@ -941,7 +950,14 @@ static void asm_cache_flush(MCode *start, MCode *end) | |||
| 941 | UNUSED(start); UNUSED(end); | 950 | UNUSED(start); UNUSED(end); |
| 942 | #elif LJ_TARGET_OSX | 951 | #elif LJ_TARGET_OSX |
| 943 | sys_icache_invalidate(start, end-start); | 952 | sys_icache_invalidate(start, end-start); |
| 944 | #elif defined(__GNUC__) | 953 | #elif LJ_TARGET_LINUX && LJ_TARGET_PPC |
| 954 | if (!asm_ppc_cache_flush) { | ||
| 955 | void *vdso = dlopen("linux-vdso32.so.1", RTLD_LAZY); | ||
| 956 | if (!vdso || !(asm_ppc_cache_flush = dlsym(vdso, "__kernel_sync_dicache"))) | ||
| 957 | asm_ppc_cache_flush = asm_dummy_cache_flush; | ||
| 958 | } | ||
| 959 | asm_ppc_cache_flush(start, end); | ||
| 960 | #elif defined(__GNUC__) && !LJ_TARGET_PPC | ||
| 945 | __clear_cache(start, end); | 961 | __clear_cache(start, end); |
| 946 | #else | 962 | #else |
| 947 | #error "Missing builtin to flush instruction cache" | 963 | #error "Missing builtin to flush instruction cache" |
