silence debug unless it has been requested
[AROS.git] / arch / ppc-all / exec / cachecleare.c
blobc126ceb576e5454da99cd6410fa184f98c8ef6c7
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: CacheClearE() - Clear the caches with extended control.
6 Lang: english
7 */
9 #include <aros/config.h>
10 #include <exec/types.h>
11 #include <exec/execbase.h>
12 #include <aros/libcall.h>
14 #include "kernel_syscall.h"
16 #include <proto/exec.h>
18 /* See rom/exec/cachecleare.c for documentation */
20 AROS_LH3(void, CacheClearE,
21 AROS_LHA(APTR, address, A0),
22 AROS_LHA(ULONG, length, D0),
23 AROS_LHA(ULONG, caches, D1),
24 struct ExecBase *, SysBase, 107, Exec)
26 AROS_LIBFUNC_INIT
28 char *start = (char*)((IPTR)address & 0xffffffe0);
29 char *end = (char*)(((IPTR)address + length + 31) & 0xffffffe0);
30 char *ptr;
32 /* Flush data caches and mark cache lines invalid */
33 if (caches & CACRF_ClearD)
35 for (ptr = start; ptr < end; ptr +=32)
37 asm volatile("dcbf 0,%0"::"r"(ptr));
39 asm volatile("sync");
42 #if (AROS_FLAVOUR & AROS_FLAVOUR_STANDALONE)
43 if (caches & CACRF_InvalidateD)
45 register APTR addr asm ("r4") = address;
46 register ULONG len asm ("r5") = length;
47 asm volatile("li %%r3,%0; sc"::"i"(SC_INVALIDATED),"r"(addr),"r"(len):"memory","r3");
49 #endif
51 if (caches & CACRF_ClearI) /* Clear ICache with DCache together */
53 for (ptr = start; ptr < end; ptr +=32)
55 asm volatile("icbi 0,%0"::"r"(ptr));
58 asm volatile("sync; isync; ");
61 AROS_LIBFUNC_EXIT
62 } /* CacheClearE */