2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Initialize resident modules
8 #include "exec_intern.h"
9 #include <exec/resident.h>
10 #include <proto/exec.h>
12 #include "exec_debug.h"
13 #ifndef DEBUG_InitCode
14 # define DEBUG_InitCode 0
20 #include <aros/debug.h>
22 /*****************************************************************************
26 AROS_LH2(void, InitCode
,
29 AROS_LHA(ULONG
, startClass
, D0
),
30 AROS_LHA(ULONG
, version
, D1
),
33 struct ExecBase
*, SysBase
, 12, Exec
)
36 Traverse the ResModules array and InitResident() all modules with
37 versions greater than or equal to version, and of a class equal to
41 startClass - which type of module to start
42 version - a version number
56 *****************************************************************************/
60 IPTR
*list
= SysBase
->ResModules
;
62 D(bug("enter InitCode(0x%x, %d)\n", startClass
, version
));
68 /* on amiga, if bit 31 is set then this points to another list of
69 * modules rather than pointing to a single module. bit 31 is
70 * inconvenient on architectures where code may be loaded above
71 * 2GB. on these platforms we assume aligned pointers and use bit
74 if(*list
& 0x80000000) list
= (IPTR
*)(*list
& 0x7fffffff);
76 if(*list
& 0x1) list
= (IPTR
*)(*list
& ~(IPTR
)0x1);
79 if( (((struct Resident
*)*list
)->rt_Version
>= (UBYTE
)version
)
80 && (((struct Resident
*)*list
)->rt_Flags
& (UBYTE
)startClass
) )
82 D(bug("calling InitResident(\"%s\", NULL)\n",
83 ((struct Resident
*)(*list
))->rt_Name
));
84 InitResident((struct Resident
*)*list
, 0);
87 D(bug("NOT calling InitResident(\"%s\", NULL)\n",
88 ((struct Resident
*)(*list
))->rt_Name
)
94 D(bug("leave InitCode(0x%x, %d)\n", startClass
, version
));