| Index: runtime/vm/cpu_arm64.cc
|
| ===================================================================
|
| --- runtime/vm/cpu_arm64.cc (revision 36692)
|
| +++ runtime/vm/cpu_arm64.cc (working copy)
|
| @@ -18,10 +18,27 @@
|
| namespace dart {
|
|
|
| void CPU::FlushICache(uword start, uword size) {
|
| -#if defined(USING_SIMULATOR)
|
| - // Nothing to do.
|
| -#else
|
| - UNIMPLEMENTED();
|
| +#if defined(HOST_ARCH_ARM64)
|
| + // Nothing to do. Flushing no instructions.
|
| + if (size == 0) {
|
| + return;
|
| + }
|
| +
|
| + // ARM recommends using the gcc intrinsic __clear_cache on Linux, and the
|
| + // library call cacheflush from unistd.h on Android:
|
| + // blogs.arm.com/software-enablement/141-caches-and-self-modifying-code/
|
| + #if defined(__linux__) && !defined(ANDROID)
|
| + extern void __clear_cache(char*, char*);
|
| + char* beg = reinterpret_cast<char*>(start);
|
| + char* end = reinterpret_cast<char*>(start + size);
|
| + ::__clear_cache(beg, end);
|
| + #elif defined(ANDROID)
|
| + // TODO(zra): Verify that this is correct for arm64 in addition to arm.
|
| + cacheflush(start, start + size, 0);
|
| + #else
|
| + #error FlushICache only tested/supported on Linux and Android
|
| + #endif
|
| +
|
| #endif
|
| }
|
|
|
|
|