revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / initcode.c
blob02f934918c7ed4e3610497437b9013121ae8040e
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Initialize resident modules
6 Lang: english
7 */
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 /*****************************************************************************
17 NAME */
19 AROS_LH2(void, InitCode,
21 /* SYNOPSIS */
22 AROS_LHA(ULONG, startClass, D0),
23 AROS_LHA(ULONG, version, D1),
25 /* LOCATION */
26 struct ExecBase *, SysBase, 12, Exec)
28 /* FUNCTION
29 Traverse the ResModules array and InitResident() all modules with
30 versions greater than or equal to version, and of a class equal to
31 startClass.
33 INPUTS
34 startClass - which type of module to start
35 version - a version number
37 RESULT
39 NOTES
40 This is actually internal function. There's no sense to call it from
41 within user software.
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 IPTR *list;
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
63 * KickTags.
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;
72 if (list)
74 while (*list)
76 struct Resident *res;
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
83 * 0 instead
85 if (*list & RESLIST_NEXT)
87 list = (IPTR *)(*list & ~RESLIST_NEXT);
88 continue;
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);
106 AROS_LIBFUNC_EXIT
107 } /* InitCode */