2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Search a resident module by name
10 #include <exec/resident.h>
11 #include <proto/exec.h>
13 #include "exec_debug.h"
14 #include "exec_intern.h"
15 #include "exec_util.h"
17 /*****************************************************************************
21 AROS_LH1(struct Resident
*, FindResident
,
24 AROS_LHA(const UBYTE
*, name
, A1
),
27 struct ExecBase
*, SysBase
, 16, Exec
)
30 Search for a Resident module in the system resident list.
33 name - pointer to the name of a Resident module to find
36 pointer to the Resident module (struct Resident *), or null if
49 *****************************************************************************/
55 DFINDRESIDENT("FindResident(\"%s\")", name
);
57 ptr
= InternalFindResident(name
, SysBase
->ResModules
);
60 DFINDRESIDENT("Found at 0x%p", *ptr
);
61 return (struct Resident
*)*ptr
;
64 DFINDRESIDENT("Not found");
70 IPTR
*InternalFindResident(const UBYTE
*name
, IPTR
*list
)
77 * On amiga, if bit 31 is set then this points to another list of
78 * modules rather than pointing to a single module. bit 31 is
79 * inconvenient on architectures where code may be loaded above
80 * 2GB. on these platforms we assume aligned pointers and use bit
83 if (*list
& RESLIST_NEXT
)
85 list
= (IPTR
*)(*list
& ~RESLIST_NEXT
);
89 if (!(strcmp( ((struct Resident
*)*list
)->rt_Name
, name
)))