2 Copyright © 2010-2011, The AROS Development Team. All rights reserved.
5 Desc: Main kernel.resource initialization.
9 #include <aros/asmcall.h>
10 #include <aros/kernel.h>
11 #include <aros/symbolsets.h>
12 #include <exec/resident.h>
13 #include <proto/arossupport.h>
14 #include <proto/exec.h>
20 #include LC_LIBDEFS_FILE
22 #include <kernel_debug.h>
24 /* We have own bug(), so don't use aros/debug.h to avoid conflicts */
27 static const UBYTE version
[];
28 extern const char LIBEND
;
30 AROS_UFP3S(struct KernelBase
*, Kernel_Init
,
31 AROS_UFPA(ULONG
, dummy
, D0
),
32 AROS_UFPA(BPTR
, segList
, A0
),
33 AROS_UFPA(struct ExecBase
*, sysBase
, A6
));
35 const struct Resident Kernel_resident
=
38 (struct Resident
*)&Kernel_resident
,
49 static const UBYTE version
[] = VERSION_STRING
;
51 void __clear_bss(const struct KernelBSS
*bss
)
55 bzero((void*)bss
->addr
, bss
->len
);
60 extern const APTR
GM_UNIQUENAME(FuncTable
)[];
62 THIS_PROGRAM_HANDLES_SYMBOLSETS
66 * Init routine is intentionally written by hands.
67 * It can use kernel's own memory allocator (if implemented) for KernelBase creation.
68 * This allows not to rely on working exec's memory management before kernel.resource
69 * is set up. This can simplify exec.library code on MMU-aware systems.
70 * exec.library catches our AddResource() and sets up its pooled memory manager.
73 AROS_UFH3S(struct KernelBase
*, Kernel_Init
,
74 AROS_UFHA(ULONG
, dummy
, D0
),
75 AROS_UFHA(BPTR
, segList
, A0
),
76 AROS_UFHA(struct ExecBase
*, SysBase
, A6
)
81 struct KernelBase
*KernelBase
;
84 D(bug("[KRN] Kernel_Init()\n"));
86 KernelBase
= AllocKernelBase(SysBase
);
90 KernelBase
->kb_Node
.ln_Type
= NT_RESOURCE
;
91 KernelBase
->kb_Node
.ln_Pri
= RESIDENTPRI
;
92 KernelBase
->kb_Node
.ln_Name
= MOD_NAME_STRING
;
94 MakeFunctions(KernelBase
, GM_UNIQUENAME(FuncTable
), NULL
);
96 D(bug("[KRN] KernelBase 0x%p\n", KernelBase
));
98 for (i
=0; i
< EXCEPTIONS_COUNT
; i
++)
99 NEWLIST(&KernelBase
->kb_Exceptions
[i
]);
101 for (i
=0; i
< IRQ_COUNT
; i
++)
102 NEWLIST(&KernelBase
->kb_Interrupts
[i
]);
105 * Everything is ok, add our resource.
106 * exec.library catches this call and sets up its memory management.
107 * At this point kernel.resource's debug I/O and memory management must be
108 * fully functional. After this we'll be able to safely call CreatePool() etc.
110 AddResource(KernelBase
);
112 /* Call platform-specific init code */
113 if (!set_call_libfuncs(SETNAME(INITLIB
), 1, 1, KernelBase
))
116 D(bug("[KRN] Kernel_Init() done\n"));