aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2019-06-19 17:37:23 +0200
committerSverker Eriksson <[email protected]>2019-06-19 17:37:23 +0200
commita8d573d92e1c83748d1e5d45187c8a379e349fa8 (patch)
treef82b4470d0d808ac8b15f4fa1f0cf6b4aad6275a /erts
parent09e386cd37747c9f6634b061d75910a3e27f3f35 (diff)
parentdc67b706ea7091caae2d55eab45f59f1d125fa1d (diff)
downloadotp-a8d573d92e1c83748d1e5d45187c8a379e349fa8.tar.gz
otp-a8d573d92e1c83748d1e5d45187c8a379e349fa8.tar.bz2
otp-a8d573d92e1c83748d1e5d45187c8a379e349fa8.zip
Merge branch 'sverker/hipe-x86-flush-icache' into maint
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/hipe/hipe_x86.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/erts/emulator/hipe/hipe_x86.h b/erts/emulator/hipe/hipe_x86.h
index 8967793171..a1fe75e792 100644
--- a/erts/emulator/hipe/hipe_x86.h
+++ b/erts/emulator/hipe/hipe_x86.h
@@ -22,17 +22,28 @@
#ifndef HIPE_X86_H
#define HIPE_X86_H
-static __inline__ void hipe_flush_icache_word(void *address)
-{
- /* Do nothing. This works as long as compiled code is
- executed by a single CPU thread. */
-}
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
static __inline__ void
hipe_flush_icache_range(void *address, unsigned int nbytes)
{
- /* Do nothing. This works as long as compiled code is
- executed by a single CPU thread. */
+ void* end = (char*)address + nbytes;
+
+#if ERTS_AT_LEAST_GCC_VSN__(4, 3, 0) || __has_builtin(__builtin___clear_cache)
+ __builtin___clear_cache(address, end);
+#elif defined(__clang__)
+ void __clear_cache(void *start, void *end);
+ __clear_cache(address, end);
+#else
+# warning "Don't know how to flush instruction cache"
+#endif
+}
+
+static __inline__ void hipe_flush_icache_word(void *address)
+{
+ hipe_flush_icache_range(address, sizeof(void*));
}
/* for stack descriptor hash lookup */