2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <aros/libcall.h>
8 #include <aros/symbolsets.h>
10 #include <proto/exec.h>
11 #include <proto/dos.h>
14 extern UBYTE copymem_040
, copymeme_040
;
15 extern UBYTE copymemquick_040
, copymemquicke_040
;
16 extern UBYTE copymem_060
, copymeme_060
;
17 extern UBYTE copymemquick_060
, copymemquicke_060
;
19 static void patch_function(UBYTE
*start
, UBYTE
*end
, void *library
, WORD lvo
)
25 mem
= AllocMem(size
, MEMF_PUBLIC
);
28 CopyMem(start
, mem
, size
);
29 CacheClearE(mem
, size
, CACRF_ClearI
|CACRF_ClearD
);
30 SetFunction(library
, lvo
* -LIB_VECTSIZE
, mem
);
33 void patches(BOOL quiet
, ULONG flags
)
37 if (SysBase
->AttnFlags
& AFF_68060
) {
38 patch_function(©mem_060
, ©meme_060
, SysBase
, 104);
39 patch_function(©memquick_060
, ©memquicke_060
, SysBase
, 105);
41 Printf("Replaced CopyMem() and CopyMemQuick() with 68060 optimized versions.\n");
42 } else if (SysBase
->AttnFlags
& AFF_68040
) {
43 patch_function(©mem_040
, ©meme_040
, SysBase
, 104);
44 patch_function(©memquick_040
, ©memquicke_040
, SysBase
, 105);
46 Printf("Replaced CopyMem() and CopyMemQuick() with 68040 optimized versions.\n");