summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix/Memory.inc
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2018-06-06 06:26:18 +0000
committerPetr Hosek <phosek@chromium.org>2018-06-06 06:26:18 +0000
commitfc9b29bd617922a9c6fc3b602e075b353f5c2395 (patch)
tree77e61283544cbaddf330de5d8aa4b3618c32edaf /llvm/lib/Support/Unix/Memory.inc
parenta7d25d5934409cdf5ef00b10cb3216bc338a88e2 (diff)
downloadbcm5719-llvm-fc9b29bd617922a9c6fc3b602e075b353f5c2395.tar.gz
bcm5719-llvm-fc9b29bd617922a9c6fc3b602e075b353f5c2395.zip
[Support] Use zx_cache_flush on Fuchsia to flush instruction cache
Fuchsia doesn't use __clear_cache, instead it provide zx_cache_flush system call. Use it to flush instruction cache. Differential Revision: https://reviews.llvm.org/D47753 llvm-svn: 334068
Diffstat (limited to 'llvm/lib/Support/Unix/Memory.inc')
-rw-r--r--llvm/lib/Support/Unix/Memory.inc11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
index cc5a43cd282..adbfff2f59a 100644
--- a/llvm/lib/Support/Unix/Memory.inc
+++ b/llvm/lib/Support/Unix/Memory.inc
@@ -25,6 +25,10 @@
#include <mach/mach.h>
#endif
+#ifdef __Fuchsia__
+#include <zircon/syscalls.h>
+#endif
+
#if defined(__mips__)
# if defined(__OpenBSD__)
# include <mips64/sysarch.h>
@@ -33,7 +37,7 @@
# endif
#endif
-#ifdef __APPLE__
+#if defined(__APPLE__)
extern "C" void sys_icache_invalidate(const void *Addr, size_t len);
#else
extern "C" void __clear_cache(void *, void*);
@@ -206,6 +210,11 @@ void Memory::InvalidateInstructionCache(const void *Addr,
sys_icache_invalidate(const_cast<void *>(Addr), Len);
# endif
+#elif defined(__Fuchsia__)
+
+ zx_status_t Status = zx_cache_flush(Addr, Len, ZX_CACHE_FLUSH_INSN);
+ assert(Status == ZX_OK && "cannot invalidate instruction cache");
+
#else
# if (defined(__POWERPC__) || defined (__ppc__) || \
OpenPOWER on IntegriCloud