Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / arch / i386-pc / exec / cachecleare.c
blob3c14b1ad11d08db46fbab1d575d2a68d651b0238
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: CacheClearE() - Clear the caches with extended control.
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
13 void Exec_Wbinvd();
15 /*****************************************************************************
17 NAME */
18 #include <proto/exec.h>
20 AROS_LH3(void, CacheClearE,
22 /* SYNOPSIS */
23 AROS_LHA(APTR, address, A0),
24 AROS_LHA(ULONG, length, D0),
25 AROS_LHA(ULONG, caches, D1),
27 /* LOCATION */
28 struct ExecBase *, SysBase, 107, Exec)
30 /* FUNCTION
31 Flush the contents of the CPU instruction or data caches. If some
32 of the cache contains dirty data, push it to memory first.
34 For most systems DMA will not effect processor caches. If *any*
35 external (non-processor) event changes system memory, you MUST
36 clear the cache. For example:
38 DMA
39 Code relocation to run at a different address
40 Building jump tables
41 Loading code from disk
43 INPUTS
44 address - Address to start the operation. This address may be
45 rounded DOWN due to hardware granularity.
46 length - Length of the memory to flush. This will be rounded
47 up, of $FFFFFFFF to indicate that all addresses
48 should be cleared.
49 caches - Bit flags to indicate which caches should be cleared
51 CACRF_ClearI - Clear the instruction cache
52 CACRF_ClearD - Clear the data cache
54 All other bits are reserved.
56 RESULT
57 The caches will be flushed.
59 NOTES
60 It is possible that on some systems the entire cache will be
61 even if this was not the specific request.
63 EXAMPLE
65 BUGS
67 SEE ALSO
68 CacheClearU(), CacheControl()
70 INTERNALS
71 Due to the strong cache coherency of x86 systems this function
72 is actually not needed. CPU snoops the address lines and
73 invalidate all cache which is out-of-date. It is valid for both
74 D and I caches). Even a BM-DMA transfer are perfectly safe here.
76 ******************************************************************************/
78 AROS_LIBFUNC_INIT
80 if (caches & CACRF_ClearD)
81 Supervisor((ULONG_FUNC)Exec_Wbinvd);
83 AROS_LIBFUNC_EXIT
84 } /* CacheClearE */