Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1609)

Unified Diff: runtime/vm/cpu_arm64.cc

Issue 303443010: Prepares for arm64 cross-build. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
}

Powered by Google App Engine
This is Rietveld 408576698