2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Initialize resident modules
8 #include <aros/debug.h>
9 #include <exec/resident.h>
10 #include <proto/exec.h>
12 #include "exec_debug.h"
13 #include "exec_intern.h"
15 /*****************************************************************************
19 AROS_LH2(void, InitCode
,
22 AROS_LHA(ULONG
, startClass
, D0
),
23 AROS_LHA(ULONG
, version
, D1
),
26 struct ExecBase
*, SysBase
, 12, Exec
)
29 Traverse the ResModules array and InitResident() all modules with
30 versions greater than or equal to version, and of a class equal to
34 startClass - which type of module to start
35 version - a version number
40 This is actually internal function. There's no sense to call it from
51 *****************************************************************************/
57 DINITCODE("enter InitCode(0x%02lx, %ld)", startClass
, version
);
59 if (startClass
== RTF_COLDSTART
)
62 * When the system enters RTF_COLDSTART level, it's a nice time to pick up
64 * We could call this from within exec init code, but InitKickTags() function
65 * will replace SysBase->ResModules if it finds some KickTags. In order to
66 * simplify things down, we keep it here, before we start using the list.
68 InitKickTags(SysBase
);
71 list
= SysBase
->ResModules
;
79 * On Amiga(tm), if bit 31 is set then this points to another list of
80 * modules rather than pointing to a single module. bit 31 is
81 * inconvenient on architectures where code may be loaded above
82 * 2GB. on these platforms we assume aligned pointers and use bit
85 if (*list
& RESLIST_NEXT
)
87 list
= (IPTR
*)(*list
& ~RESLIST_NEXT
);
91 res
= (struct Resident
*)*list
++;
93 if ((res
->rt_Version
>= version
) && (res
->rt_Flags
& startClass
))
95 DINITCODE("calling InitResident (%ld %02lx \"%s\")",
96 res
->rt_Pri
, res
->rt_Flags
, res
->rt_Name
);
97 InitResident(res
, BNULL
);
99 D(else bug("NOT calling InitResident (%d %02x \"%s\")\n",
100 res
->rt_Pri
, res
->rt_Flags
, res
->rt_Name
));
104 DINITCODE("leave InitCode(0x%02lx, %ld)", startClass
, version
);