diff mbox series

[pushed] Darwin, X86 : Implement __cache_clear.

Message ID 7DEC0DC1-5B0B-4AFD-B811-F7E3BE254F76@sandoe.co.uk
State New
Headers show
Series [pushed] Darwin, X86 : Implement __cache_clear. | expand

Commit Message

Iain Sandoe Aug. 27, 2021, 4:08 p.m. UTC
Hi,

We had a NOP cache clear, but there is a suitable mechanism provided
by a system call.  This connects it up.

tested on i686, x86_64-darwin and x86_64-linux
pushed to master, thanks
Iain

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/i386/darwin.h (CLEAR_INSN_CACHE): New.
---
 gcc/config/i386/darwin.h | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 73b06e2307d..da0ae5b3ee7 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -344,3 +344,8 @@  along with GCC; see the file COPYING3.  If not see
 #undef SUBTARGET_SHADOW_OFFSET
 #define SUBTARGET_SHADOW_OFFSET	\
   (TARGET_LP64 ? HOST_WIDE_INT_1 << 44 : HOST_WIDE_INT_1 << 29)
+
+#undef CLEAR_INSN_CACHE
+#define CLEAR_INSN_CACHE(beg, end)				\
+  extern void sys_icache_invalidate(void *start, size_t len);	\
+  sys_icache_invalidate ((beg), (size_t)((end)-(beg)))