r4684@vps: verhaegs | 2007-05-04 21:04:10 -0400
[AROS.git] / rom / exec / initcode.c
blob892e6976dc451ff30b9e89a3660401c2b9ba0075
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Initialize resident modules
6 Lang: english
7 */
8 #include "exec_intern.h"
9 #include <exec/resident.h>
10 #include <proto/exec.h>
12 #include <aros/debug.h>
14 /*****************************************************************************
16 NAME */
18 AROS_LH2(void, InitCode,
20 /* SYNOPSIS */
21 AROS_LHA(ULONG, startClass, D0),
22 AROS_LHA(ULONG, version, D1),
24 /* LOCATION */
25 struct ExecBase *, SysBase, 12, Exec)
27 /* FUNCTION
28 Traverse the ResModules array and InitResident() all modules with
29 versions greater than or equal to version, and of a class equal to
30 startClass.
32 INPUTS
33 startClass - which type of module to start
34 version - a version number
36 RESULT
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 *****************************************************************************/
50 AROS_LIBFUNC_INIT
51 AROS_LIBBASE_EXT_DECL(struct ExecBase *,SysBase)
53 ULONG *list = SysBase->ResModules;
55 D(bug("enter InitCode(0x%x, %d)\n", startClass, version));
57 if(list)
59 while(*list)
62 If bit 31 is set, this doesn't point to a Resident module, but
63 to another list of modules.
65 if(*list & 0x80000000) list = (ULONG *)(*list & 0x7fffffff);
67 if( (((struct Resident *)*list)->rt_Version >= (UBYTE)version)
68 && (((struct Resident *)*list)->rt_Flags & (UBYTE)startClass) )
70 D(bug("calling InitResident(\"%s\", NULL)\n",
71 ((struct Resident *)(*list))->rt_Name));
72 InitResident((struct Resident *)*list, NULL);
74 else
75 D(bug("NOT calling InitResident(\"%s\", NULL)\n",
76 ((struct Resident *)(*list))->rt_Name)
78 list++;
82 D(bug("leave InitCode(0x%x, %d)\n", startClass, version));
84 AROS_LIBFUNC_EXIT
85 } /* InitCode */