aboutsummaryrefslogtreecommitdiff
path: root/contrib/compiler-rt/lib/builtins/clear_cache.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-22 18:43:15 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-22 18:43:15 +0000
commit289fa303d6df65b9db955e478263677f8bc7e62a (patch)
treea13c0c7f6575c19340f22eadcb8e9165ea6dc841 /contrib/compiler-rt/lib/builtins/clear_cache.c
parentd0338a294d7c83730952e980a3866f54a6d4ad3c (diff)
parentf351c8a560ddc5b5df9ee5ba4ccc1cfb9029146d (diff)
Merge compiler-rt trunk r300890, and update build glue.
Notes
Notes: svn path=/projects/clang500-import/; revision=317285
Diffstat (limited to 'contrib/compiler-rt/lib/builtins/clear_cache.c')
-rw-r--r--contrib/compiler-rt/lib/builtins/clear_cache.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/compiler-rt/lib/builtins/clear_cache.c b/contrib/compiler-rt/lib/builtins/clear_cache.c
index bb6e24787cde..7ccbe019dba9 100644
--- a/contrib/compiler-rt/lib/builtins/clear_cache.c
+++ b/contrib/compiler-rt/lib/builtins/clear_cache.c
@@ -82,10 +82,6 @@ uintptr_t GetCurrentProcess(void);
#endif
#endif
-#if defined(__linux__) && defined(__arm__)
- #include <asm/unistd.h>
-#endif
-
/*
* The compiler generates calls to __clear_cache() when creating
* trampoline functions on the stack for use with nested functions.
@@ -94,7 +90,7 @@ uintptr_t GetCurrentProcess(void);
*/
void __clear_cache(void *start, void *end) {
-#if __i386__ || __x86_64__
+#if __i386__ || __x86_64__ || defined(_M_IX86) || defined(_M_X64)
/*
* Intel processors have a unified instruction and data cache
* so there is nothing to do
@@ -108,6 +104,15 @@ void __clear_cache(void *start, void *end) {
sysarch(ARM_SYNC_ICACHE, &arg);
#elif defined(__linux__)
+ /*
+ * We used to include asm/unistd.h for the __ARM_NR_cacheflush define, but
+ * it also brought many other unused defines, as well as a dependency on
+ * kernel headers to be installed.
+ *
+ * This value is stable at least since Linux 3.13 and should remain so for
+ * compatibility reasons, warranting it's re-definition here.
+ */
+ #define __ARM_NR_cacheflush 0x0f0002
register int start_reg __asm("r0") = (int) (intptr_t) start;
const register int end_reg __asm("r1") = (int) (intptr_t) end;
const register int flags __asm("r2") = 0;