[PATCH] D47753: [Support] Use zx_cache_flush on Fuchsia to flush instruction cache

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 5 23:30:36 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL334068: [Support] Use zx_cache_flush on Fuchsia to flush instruction cache (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47753?vs=149891&id=150078#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47753

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


Index: llvm/trunk/lib/Support/Unix/Memory.inc
===================================================================
--- llvm/trunk/lib/Support/Unix/Memory.inc
+++ llvm/trunk/lib/Support/Unix/Memory.inc
@@ -25,15 +25,19 @@
 #include <mach/mach.h>
 #endif
 
+#ifdef __Fuchsia__
+#include <zircon/syscalls.h>
+#endif
+
 #if defined(__mips__)
 #  if defined(__OpenBSD__)
 #    include <mips64/sysarch.h>
 #  elif !defined(__FreeBSD__)
 #    include <sys/cachectl.h>
 #  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 @@
   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__) || \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47753.150078.patch
Type: text/x-patch
Size: 973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180606/93496018/attachment.bin>


More information about the llvm-commits mailing list