[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
This commit is contained in:
parent
a7d25d5934
commit
fc9b29bd61
|
@ -25,6 +25,10 @@
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __Fuchsia__
|
||||||
|
#include <zircon/syscalls.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__mips__)
|
#if defined(__mips__)
|
||||||
# if defined(__OpenBSD__)
|
# if defined(__OpenBSD__)
|
||||||
# include <mips64/sysarch.h>
|
# include <mips64/sysarch.h>
|
||||||
|
@ -33,7 +37,7 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__)
|
||||||
extern "C" void sys_icache_invalidate(const void *Addr, size_t len);
|
extern "C" void sys_icache_invalidate(const void *Addr, size_t len);
|
||||||
#else
|
#else
|
||||||
extern "C" void __clear_cache(void *, void*);
|
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);
|
sys_icache_invalidate(const_cast<void *>(Addr), Len);
|
||||||
# endif
|
# 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
|
#else
|
||||||
|
|
||||||
# if (defined(__POWERPC__) || defined (__ppc__) || \
|
# if (defined(__POWERPC__) || defined (__ppc__) || \
|
||||||
|
|
Loading…
Reference in New Issue