2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 Desc: CacheClearU - Simple way of clearing the caches.
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
13 extern void AROS_SLIB_ENTRY(CacheClearU_00
,Exec
,106)(void);
14 extern void AROS_SLIB_ENTRY(CacheClearU_20
,Exec
,106)(void);
15 extern void AROS_SLIB_ENTRY(CacheClearU_40
,Exec
,106)(void);
16 extern void AROS_SLIB_ENTRY(CacheClearU_60
,Exec
,106)(void);
18 #include <proto/exec.h>
20 /* See rom/exec/cacheclearu.c for documentation */
22 AROS_LH0(void, CacheClearU
,
23 struct ExecBase
*, SysBase
, 106, Exec
)
28 if (SysBase
->LibNode
.lib_OpenCnt
== 0)
29 /* We were called from PrepareExecBase. AttnFlags isn't set yet.
30 * Do nothing or we would always install 68000 routine.
31 * No harm done, caches are disabled at this point.
35 /* When called the first time, this patches up the
36 * Exec syscall table to directly point to the right routine.
37 * NOTE: We may have been originally called from SetFunction()
38 * We must clear caches before calling SetFunction()
42 if (SysBase
->AttnFlags
& AFF_68060
) {
44 func
= AROS_SLIB_ENTRY(CacheClearU_60
, Exec
, 106);
45 } else if (SysBase
->AttnFlags
& AFF_68040
) {
47 func
= AROS_SLIB_ENTRY(CacheClearU_40
, Exec
, 106);
48 } else if (SysBase
->AttnFlags
& AFF_68020
) {
50 func
= AROS_SLIB_ENTRY(CacheClearU_20
, Exec
, 106);
52 /* Everybody else (68000, 68010) */
53 func
= AROS_SLIB_ENTRY(CacheClearU_00
, Exec
, 106);
56 SetFunction((struct Library
*)SysBase
, -LIB_VECTSIZE
* 106, func
);