dcf498a61356252b0afc3a9ea1fb9fcb1be37d5a
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: CacheClearE() - Clear the caches with extended control.
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
13 extern void AROS_SLIB_ENTRY(CacheClearE_00
,Exec
,107)(void);
14 extern void AROS_SLIB_ENTRY(CacheClearE_20
,Exec
,107)(void);
15 extern void AROS_SLIB_ENTRY(CacheClearE_4060
,Exec
,107)(void);
17 /*****************************************************************************
20 #include <proto/exec.h>
22 AROS_LH3(void, CacheClearE
,
25 AROS_LHA(APTR
, address
, A0
),
26 AROS_LHA(ULONG
, length
, D0
),
27 AROS_LHA(ULONG
, caches
, D1
),
30 struct ExecBase
*, SysBase
, 107, Exec
)
33 Flush the contents of the CPU instruction or data caches. If some
34 of the cache contains dirty data, push it to memory first.
36 For most systems DMA will not effect processor caches. If *any*
37 external (non-processor) event changes system memory, you MUST
38 clear the cache. For example:
41 Code relocation to run at a different address
43 Loading code from disk
46 address - Address to start the operation. This address may be
47 rounded DOWN due to hardware granularity.
48 length - Length of the memory to flush. This will be rounded
49 up, of $FFFFFFFF to indicate that all addresses
51 caches - Bit flags to indicate which caches should be cleared
53 CACRF_ClearI - Clear the instruction cache
54 CACRF_ClearD - Clear the data cache
56 All other bits are reserved.
59 The caches will be flushed.
62 It is possible that on some systems the entire cache will be
63 even if this was not the specific request.
70 CacheClearU(), CacheControl()
73 This is a rather CPU dependant function.
75 ******************************************************************************/
81 if (SysBase
->LibNode
.lib_OpenCnt
== 0)
85 if (SysBase
->AttnFlags
& AFF_68060
) {
87 func
= AROS_SLIB_ENTRY(CacheClearE_4060
, Exec
, 107);
88 } else if (SysBase
->AttnFlags
& AFF_68040
) {
90 func
= AROS_SLIB_ENTRY(CacheClearE_4060
, Exec
, 107);
91 } else if (SysBase
->AttnFlags
& AFF_68020
) {
93 func
= AROS_SLIB_ENTRY(CacheClearE_20
, Exec
, 107);
95 /* Everybody else (68000, 68010) */
96 func
= AROS_SLIB_ENTRY(CacheClearE_00
, Exec
, 107);
98 AROS_UFC3NR(void, func
,
99 AROS_UFCA(APTR
, address
, A0
),
100 AROS_UFCA(ULONG
, length
, D0
),
101 AROS_UFCA(ULONG
, caches
, D1
));
102 SetFunction((struct Library
*)SysBase
, -LIB_VECTSIZE
* 107, func
);