[llvm] r177101 - Android uses cacheflush(long start, long end, long flags) for MIPS.

Akira Hatanaka ahatanaka at mips.com
Thu Mar 14 12:01:00 PDT 2013


Author: ahatanak
Date: Thu Mar 14 14:01:00 2013
New Revision: 177101

URL: http://llvm.org/viewvc/llvm-project?rev=177101&view=rev
Log:
Android uses cacheflush(long start, long end, long flags) for MIPS.

Patch by Stephen Hines.


Modified:
    llvm/trunk/lib/Support/Unix/Memory.inc

Modified: llvm/trunk/lib/Support/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Memory.inc?rev=177101&r1=177100&r2=177101&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Memory.inc (original)
+++ llvm/trunk/lib/Support/Unix/Memory.inc Thu Mar 14 14:01:00 2013
@@ -332,7 +332,16 @@ void Memory::InvalidateInstructionCache(
   __clear_cache(const_cast<char *>(Start), const_cast<char *>(End));
 #  elif defined(__mips__)
   const char *Start = static_cast<const char *>(Addr);
+#    if defined(ANDROID)
+  // The declaration of "cacheflush" in Android bionic:
+  // extern int cacheflush(long start, long end, long flags);
+  const char *End = Start + Len;
+  long LStart = reinterpret_cast<long>(const_cast<char *>(Start));
+  long LEnd = reinterpret_cast<long>(const_cast<char *>(End));
+  cacheflush(LStart, LEnd, BCACHE);
+#    else
   cacheflush(const_cast<char *>(Start), Len, BCACHE);
+#    endif
 #  endif
 
 #endif  // end apple





More information about the llvm-commits mailing list