2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: CacheControl() - Global control of the system caches.
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
13 extern void AROS_SLIB_ENTRY(CacheControl_00
,Exec
,108)(void);
14 extern void AROS_SLIB_ENTRY(CacheControl_20
,Exec
,108)(void);
15 extern void AROS_SLIB_ENTRY(CacheControl_40
,Exec
,108)(void);
17 /*****************************************************************************
20 #include <proto/exec.h>
22 AROS_LH2(ULONG
, CacheControl
,
25 AROS_LHA(ULONG
, cacheBits
, D0
),
26 AROS_LHA(ULONG
, cacheMask
, D1
),
29 struct ExecBase
*, SysBase
, 108, Exec
)
32 This function will provide global control of all the processor
33 instruction and data caches. It is not possible to have per
36 The actions undertaken by this function are very CPU dependant,
37 however the actions performed will match the specified options
38 as close as is possible.
40 The commands currently defined in the include file exec/execbase.h
41 are closely related to the cache control register of the Motorola
45 cacheBits - The new state of the bits
46 cacheMask - A mask of the bits you wish to change.
49 oldBits - The complete value of the cache control bits
50 prior to the call of this function.
52 Your requested actions will have been performed. As a side effect
53 this function will also cause the caches to be cleared.
56 On CPU's without a separate instruction and data cache, these will
57 be considered as equal.
64 CacheClearE(), CacheClearU()
67 This function requires replacing in $(KERNEL), or possibly
68 even $(ARCH) in some cases.
70 ******************************************************************************/
76 if (SysBase
->AttnFlags
& AFF_68040
) {
77 /* 68040/68060 support */
78 func
= AROS_SLIB_ENTRY(CacheControl_40
, Exec
, 108);
79 } else if (SysBase
->AttnFlags
& AFF_68020
) {
80 /* 68020/68030 support */
81 func
= AROS_SLIB_ENTRY(CacheControl_20
, Exec
, 108);
83 /* Everybody else (68000, 68010) */
84 func
= AROS_SLIB_ENTRY(CacheControl_00
, Exec
, 108);
86 SetFunction((struct Library
*)SysBase
, -LIB_VECTSIZE
* 108, func
);
89 return CacheControl(cacheBits
, cacheMask
);