White space fixes, detab.
[AROS.git] / rom / kernel / prepareexecbase.c
blob72e2085ae1646110974a3325357bc662c31ff8a4
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 ExecBase initialization, no-MMU version.
6 */
8 #include <aros/asmcall.h>
9 #include <exec/execbase.h>
10 #include <exec/memory.h>
11 #include <exec/resident.h>
12 #include <proto/exec.h>
14 #include <kernel_base.h>
15 #include <kernel_debug.h>
16 #include <kernel_romtags.h>
18 struct ExecBase *krnPrepareExecBase(UWORD *ranges[], struct MemHeader *mh, struct TagItem *bootMsg)
20 struct Resident *exec;
21 struct ExecBase *sysBase;
22 struct Resident **resList = krnRomTagScanner(mh, ranges);
24 if (!resList)
26 krnPanic(NULL, "Failed to create initial resident list\n"
27 "Not enough memory space provided");
28 return NULL;
31 exec = krnFindResident(resList, "exec.library");
32 if (!exec)
34 krnPanic(NULL, "Failed to create ExecBase\n"
35 "exec.library is not found");
36 return NULL;
39 /* Magic. Described in rom/exec/exec_init.c. */
40 sysBase = krnInitExecBase(exec, mh, bootMsg);
42 if (!sysBase)
44 krnPanic(NULL, "Failed to create ExecBase\n"
45 "\n"
46 "MemHeader 0x%p, First chunk 0x%p, %u bytes free",
47 mh, mh->mh_First, mh->mh_Free);
49 return NULL;
52 sysBase->ResModules = resList;
54 #ifndef NO_RUNTIME_DEBUG
55 /* Print out modules list if requested by the user */
56 if (SysBase->ex_DebugFlags & EXECDEBUGF_INITCODE)
58 ULONG i;
60 nbug("Resident modules (addr: pri flags version name):\n");
62 for (i = 0; resList[i]; i++)
64 nbug("+ %p: %4d %02x %3d \"%s\"\n", resList[i], resList[i]->rt_Pri,
65 resList[i]->rt_Flags, resList[i]->rt_Version, resList[i]->rt_Name);
68 #endif
69 return sysBase;