Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add __clear_cache implementatin for SPARC/SPARC64.



details:   https://anonhg.NetBSD.org/src/rev/37d9cf85752d
branches:  trunk
changeset: 353822:37d9cf85752d
user:      joerg <joerg%NetBSD.org@localhost>
date:      Wed May 24 21:45:40 2017 +0000

description:
Add __clear_cache implementatin for SPARC/SPARC64.

diffstat:

 lib/libc/compiler_rt/Makefile.inc                            |  7 ++++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c |  7 +++++++
 2 files changed, 13 insertions(+), 1 deletions(-)

diffs (38 lines):

diff -r b5c179a05ffb -r 37d9cf85752d lib/libc/compiler_rt/Makefile.inc
--- a/lib/libc/compiler_rt/Makefile.inc Wed May 24 20:23:58 2017 +0000
+++ b/lib/libc/compiler_rt/Makefile.inc Wed May 24 21:45:40 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.31 2016/03/30 07:25:33 martin Exp $
+# $NetBSD: Makefile.inc,v 1.32 2017/05/24 21:45:40 joerg Exp $
 
 COMPILER_RT_SRCDIR=    ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -242,6 +242,11 @@
        clear_cache.c
 .endif
 
+.if ${LIBC_MACHINE_CPU} == "sparc" || ${LIBC_MACHINE_CPU} == "sparc64"
+GENERIC_SRCS+= \
+       clear_cache.c
+.endif
+
 .if ${LIBC_MACHINE_CPU} == "arm"
 .if !empty(LIBC_MACHINE_ARCH:Mearm*)
 GENERIC_SRCS+= \
diff -r b5c179a05ffb -r 37d9cf85752d sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c      Wed May 24 20:23:58 2017 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/clear_cache.c      Wed May 24 21:45:40 2017 +0000
@@ -147,6 +147,13 @@
   for (addr = xstart; addr < xend; addr += icache_line_size)
     __asm __volatile("ic ivau, %0" :: "r"(addr));
   __asm __volatile("isb sy");
+#elif defined(__sparc__)
+  uintptr_t xstart = (uintptr_t) start & ~(uintptr_t)3;
+  uintptr_t xend = (uintptr_t) end;
+
+  for (; xstart < xend; xstart += 4) {
+    __asm __volatile("flush %0" :: "r" (xstart));
+  }
 #else
     #if __APPLE__
         /* On Darwin, sys_icache_invalidate() provides this functionality */



Home | Main Index | Thread Index | Old Index