Merged in MorphOS-specific improvements from MorphOS team.
[AROS.git] / rom / utility / utility_init.c
blob60847b57d8c94b00a5c4a7d169dd58d76749ba15
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Utility Resident and initialization.
6 Lang: english
7 */
9 #include <aros/symbolsets.h>
11 #include "intern.h"
12 #include LC_LIBDEFS_FILE
14 extern ULONG AROS_SLIB_ENTRY(SMult32_020,Utility,23)();
15 extern ULONG AROS_SLIB_ENTRY(UMult32_020,Utility,24)();
16 extern ULONG AROS_SLIB_ENTRY(SDivMod32_020,Utility,25)();
17 extern ULONG AROS_SLIB_ENTRY(UDivMod32_020,Utility,26)();
18 extern ULONG AROS_SLIB_ENTRY(SMult64_020,Utility,33)();
19 extern ULONG AROS_SLIB_ENTRY(UMult64_020,Utility,34)();
21 #define SetFunc(a,b) SetFunction((struct Library *)LIBBASE, a * -LIB_VECTSIZE, AROS_SLIB_ENTRY(b,Utility,a))
23 static int UtilityInit(LIBBASETYPEPTR LIBBASE)
25 GetIntUtilityBase(LIBBASE)->ub_LastID = 0;
28 I no longer allocate memory here for the global namespace, since
29 that is not quite legal. (AllocMem is not Forbid() protected).
31 Also makes this a little bit shorter. (In time and length).
33 InitSemaphore(&GetIntUtilityBase(LIBBASE)->ub_NameSpace.ns_Lock);
34 NEWLIST((struct List *)&GetIntUtilityBase(LIBBASE)->ub_NameSpace.ns_List);
35 GetIntUtilityBase(LIBBASE)->ub_NameSpace.ns_Flags = NSF_NODUPS;
37 #if defined(__mc68000__)
38 /* Are we running on a m68020 or higher?
39 If so we should setfunction all the relevant functions to use
40 native code.
42 if(SysBase->AttnFlags & AFF_68020)
44 SetFunc(23, SMult32_020);
45 SetFunc(24, UMult32_020);
46 SetFunc(25, SDivMod32_020);
47 SetFunc(26, UDivMod32_020);
49 /* The 060 doesn't have some of the instructions I use... */
50 if((SysBase->AttnFlags & AFF_68060) == 0)
52 SetFunc(33, SMult64_020);
53 SetFunc(34, UMult64_020);
56 #endif
58 return TRUE;
61 ADD2INITLIB(UtilityInit, 0);