Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jan 2018 20:25:48 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r328366 - vendor/compiler-rt/dist-release_60/lib/builtins
Message-ID:  <201801242025.w0OKPml1042910@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Jan 24 20:25:48 2018
New Revision: 328366
URL: https://svnweb.freebsd.org/changeset/base/328366

Log:
  Vendor import of compiler-rt release_60 branch r323338:
  https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@323338

Modified:
  vendor/compiler-rt/dist-release_60/lib/builtins/clear_cache.c

Modified: vendor/compiler-rt/dist-release_60/lib/builtins/clear_cache.c
==============================================================================
--- vendor/compiler-rt/dist-release_60/lib/builtins/clear_cache.c	Wed Jan 24 20:25:46 2018	(r328365)
+++ vendor/compiler-rt/dist-release_60/lib/builtins/clear_cache.c	Wed Jan 24 20:25:48 2018	(r328366)
@@ -33,6 +33,11 @@ uintptr_t GetCurrentProcess(void);
   #include <machine/sysarch.h>
 #endif
 
+#if defined(__OpenBSD__) && defined(__mips__)
+  #include <sys/types.h>
+  #include <machine/sysarch.h>
+#endif
+
 #if defined(__linux__) && defined(__mips__)
   #include <sys/cachectl.h>
   #include <sys/syscall.h>
@@ -142,6 +147,8 @@ void __clear_cache(void *start, void *end) {
     #else
         syscall(__NR_cacheflush, start, (end_int - start_int), BCACHE);
     #endif
+#elif defined(__mips__) && defined(__OpenBSD__)
+  cacheflush(start, (uintptr_t)end - (uintptr_t)start, BCACHE);
 #elif defined(__aarch64__) && !defined(__APPLE__)
   uint64_t xstart = (uint64_t)(uintptr_t) start;
   uint64_t xend = (uint64_t)(uintptr_t) end;
@@ -156,12 +163,14 @@ void __clear_cache(void *start, void *end) {
    * uintptr_t in case this runs in an IPL32 environment.
    */
   const size_t dcache_line_size = 4 << ((ctr_el0 >> 16) & 15);
-  for (addr = xstart; addr < xend; addr += dcache_line_size)
+  for (addr = xstart & ~(dcache_line_size - 1); addr < xend;
+       addr += dcache_line_size)
     __asm __volatile("dc cvau, %0" :: "r"(addr));
   __asm __volatile("dsb ish");
 
   const size_t icache_line_size = 4 << ((ctr_el0 >> 0) & 15);
-  for (addr = xstart; addr < xend; addr += icache_line_size)
+  for (addr = xstart & ~(icache_line_size - 1); addr < xend;
+       addr += icache_line_size)
     __asm __volatile("ic ivau, %0" :: "r"(addr));
   __asm __volatile("isb sy");
 #elif defined (__powerpc64__)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801242025.w0OKPml1042910>