grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / exec / cacheclearu.c
blob53617fc94a0f5b75839283a4cd283522294be911
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: CacheClearU - Simple way of clearing the caches.
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
13 /*****************************************************************************
15 NAME */
16 #include <proto/exec.h>
18 AROS_LH0(void, CacheClearU,
20 /* LOCATION */
21 struct ExecBase *, SysBase, 106, Exec)
23 /* FUNCTION
24 Flush the entire contents of the CPU instruction and data caches.
25 If some of the cache contains dirty data, push it to memory first.
27 For most systems DMA will not effect processor caches. If *any*
28 external (non-processor) event changes system memory, you MUST
29 clear the cache. For example:
31 DMA
32 Code relocation to run at a different address
33 Building jump tables
34 Loading code from disk
36 INPUTS
38 RESULT
39 The caches will be flushed.
41 NOTES
42 It is possible that on some systems the entire cache will be
43 even if this was not the specific request.
45 EXAMPLE
47 BUGS
49 SEE ALSO
50 CacheClearE(), CacheControl(), CachePreDMA(), CachePostDMA()
52 INTERNALS
53 Although it is not necessary, but it could be more efficient if
54 this function was replaced by a function in $(KERNEL).
56 ******************************************************************************/
58 AROS_LIBFUNC_INIT
61 * Just dump the whole lot.
62 * FIXME: This is known to trigger system cold reset on Archos-70
63 * Android tablet. Likely hardware quirk. Needs to be investigated.
65 CacheClearE(0, ~0, CACRF_ClearI | CACRF_ClearD);
67 AROS_LIBFUNC_EXIT
68 } /* CacheClearU */