Implement __clear_cache using __syncicache on PPC

This commit is contained in:
joerg 2017-06-16 21:22:14 +00:00
parent 29bb99b1da
commit 0cc4289645
2 changed files with 12 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.33 2017/05/26 22:56:50 joerg Exp $
# $NetBSD: Makefile.inc,v 1.34 2017/06/16 21:22:14 joerg Exp $
COMPILER_RT_SRCDIR= ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
@ -242,6 +242,11 @@ GENERIC_SRCS+= \
clear_cache.c
.endif
.if ${LIBC_MACHINE_ARCH} == "powerpc" || ${LIBC_MACHINE_ARCH} == "powerpc64"
GENERIC_SRCS+= \
clear_cache.c
.endif
.if ${LIBC_MACHINE_ARCH} == "sparc" || ${LIBC_MACHINE_ARCH} == "sparc64"
GENERIC_SRCS+= \
clear_cache.c

View File

@ -23,6 +23,10 @@
#include <machine/sysarch.h>
#endif
#if defined(__NetBSD__) && defined(__ppc__)
#include <machine/cpu.h>
#endif
#if defined(__mips__)
#include <sys/cachectl.h>
#include <sys/syscall.h>
@ -154,6 +158,8 @@ void __clear_cache(void *start, void *end) {
for (; xstart < xend; xstart += 4) {
__asm __volatile("flush %0" :: "r" (xstart));
}
#elif defined(__NetBSD__) && defined(__ppc__)
__syncicache(start, (uintptr_t)end - (uintptr_t)start);
#else
#if __APPLE__
/* On Darwin, sys_icache_invalidate() provides this functionality */