aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2019-06-19 17:37:41 +0200
committerSverker Eriksson <[email protected]>2019-06-19 17:37:41 +0200
commit22da9dfc279af62c1ff132449c54786b3aff0577 (patch)
tree2ebfe4c4a8cbb6d2bd1847c4f0599959b5e7b36f
parent99ad5bfc28bfd32af757d4461ef2bd1370e0d2bd (diff)
parenta8d573d92e1c83748d1e5d45187c8a379e349fa8 (diff)
downloadotp-22da9dfc279af62c1ff132449c54786b3aff0577.tar.gz
otp-22da9dfc279af62c1ff132449c54786b3aff0577.tar.bz2
otp-22da9dfc279af62c1ff132449c54786b3aff0577.zip
Merge branch 'maint'
-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 */