summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Chien <loganchien@google.com>2011-11-27 02:19:05 +0800
committerLogan Chien <loganchien@google.com>2011-11-27 02:19:05 +0800
commit503cc3eb626da7ee71e89ee6f935517134c3f060 (patch)
tree85a25f4dbdfb24238fd266e68f7980d10c5bff26
parent7296be5441d4b1d1a98543884e1f86d3d22f6856 (diff)
downloadlinkloader-503cc3eb626da7ee71e89ee6f935517134c3f060.tar.gz
Use cacheflush system call to flush the cache on MIPS.
Change-Id: Iae9691fefef14e5b07171b145376bbb521b8b25a
-rw-r--r--utils/flush_cpu_cache.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/flush_cpu_cache.h b/utils/flush_cpu_cache.h
index 526f46f..7a269ed 100644
--- a/utils/flush_cpu_cache.h
+++ b/utils/flush_cpu_cache.h
@@ -17,7 +17,7 @@
#ifndef FLUSH_CPU_CACHE_H
#define FLUSH_CPU_CACHE_H
-#ifdef __arm__
+#if defined(__arm__) || defined(__mips__)
// Note: Though we wish to use the gcc builtin function __clear_cache to
// invalidate the instruction cache; however, the toolchain of Android
@@ -32,12 +32,17 @@
#define FLUSH_CPU_CACHE(BEGIN, END) \
cacheflush(((long)(BEGIN)), ((long)(END)), 0)
-#elif defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)
+#if 0 && defined(__mips__)
+
+// Note: Following code does not work with Android Toolchain, though they
+// works while using standalone mips-linux-gnu-gcc.
#include <sys/cachectl.h>
#define FLUSH_CPU_CACHE(BEGIN, END) \
_flush_cache(reinterpret_cast<char*>(BEGIN), END-BEGIN+1, BCACHE);
+#endif
+
#else
#define FLUSH_CPU_CACHE(BEGIN, END) do { } while (0)