|
| 1 | +diff -aur target-org/webkit/Source/JavaScriptCore/assembler/ARM64Assembler.h target/webkit/Source/JavaScriptCore/assembler/ARM64Assembler.h |
| 2 | +--- target-org/webkit/Source/JavaScriptCore/assembler/ARM64Assembler.h 2019-06-18 21:49:21.000000000 +0800 |
| 3 | ++++ target/webkit/Source/JavaScriptCore/assembler/ARM64Assembler.h 2019-06-19 15:14:46.000000000 +0800 |
| 4 | +@@ -2863,7 +2863,36 @@ |
| 5 | + |
| 6 | + unsigned debugOffset() { return m_buffer.debugOffset(); } |
| 7 | + |
| 8 | +-#if OS(LINUX) && COMPILER(GCC_COMPATIBLE) |
| 9 | ++#if defined(CUSTOMIZE_REACT_NATIVE) && CPU(ARM64) |
| 10 | ++ static inline void linuxPageFlush(uintptr_t start, uintptr_t end) |
| 11 | ++ { |
| 12 | ++ // NOTE(CUSTOMIZE_REACT_NATIVE): The code mostly copied from LLVM compiler-rt |
| 13 | ++ // https://github.com/llvm-mirror/compiler-rt/blob/ff75f2a0260b1940436a483413091c5770427c04/lib/builtins/clear_cache.c#L142 |
| 14 | ++ // But only to modify "dc cvau" to "dc civac" |
| 15 | ++ |
| 16 | ++ uint64_t xstart = (uint64_t)(uintptr_t)start; |
| 17 | ++ uint64_t xend = (uint64_t)(uintptr_t)end; |
| 18 | ++ uint64_t addr; |
| 19 | ++ |
| 20 | ++ // Get Cache Type Info |
| 21 | ++ uint64_t ctr_el0; |
| 22 | ++ __asm __volatile("mrs %0, ctr_el0" : "=r"(ctr_el0)); |
| 23 | ++ |
| 24 | ++ // dc & ic instructions must use 64bit registers so we don't use |
| 25 | ++ // uintptr_t in case this runs in an IPL32 environment. |
| 26 | ++ const size_t dcache_line_size = 4 << ((ctr_el0 >> 16) & 15); |
| 27 | ++ for (addr = xstart & ~(dcache_line_size - 1); addr < xend; |
| 28 | ++ addr += dcache_line_size) |
| 29 | ++ __asm __volatile("dc civac, %0" ::"r"(addr)); |
| 30 | ++ __asm __volatile("dsb ish"); |
| 31 | ++ |
| 32 | ++ const size_t icache_line_size = 4 << ((ctr_el0 >> 0) & 15); |
| 33 | ++ for (addr = xstart & ~(icache_line_size - 1); addr < xend; |
| 34 | ++ addr += icache_line_size) |
| 35 | ++ __asm __volatile("ic ivau, %0" ::"r"(addr)); |
| 36 | ++ __asm __volatile("isb sy"); |
| 37 | ++ } |
| 38 | ++#elif OS(LINUX) && COMPILER(GCC_COMPATIBLE) |
| 39 | + static inline void linuxPageFlush(uintptr_t begin, uintptr_t end) |
| 40 | + { |
| 41 | + __builtin___clear_cache(reinterpret_cast<char*>(begin), reinterpret_cast<char*>(end)); |
0 commit comments