2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
9 #include <utility/tagitem.h>
10 #include <proto/arossupport.h>
16 #include <aros/arm/cpucontext.h>
17 #include <aros/arm/cpu.h>
19 #include <kernel_base.h>
20 #include <kernel_debug.h>
25 #define STR(x) _STR(x)
27 #define SYS_STACK_SIZE (16384)
31 asm(".section .aros.init,\"ax\"\n\t"
33 ".type start,%function\n"
34 "start: ldr sp, tmp_stack_end \n" // Load address of top of stack pointer
36 " bl clear_bss \n" // clear bss regions
37 " mov r0, r4 \n" // restore boot msg parameter
38 " cps #" STR(CPUMODE_SYSTEM
) "\n" // Enter System mode
39 " ldr sp, sys_stack_end \n" // Load system mode stack
40 " cps #" STR(CPUMODE_IRQ
) "\n"
41 " ldr sp, irq_stack_end \n"
42 " cps #" STR(CPUMODE_ABORT
) "\n"
43 " ldr sp, abt_stack_end \n"
44 " cps #" STR(CPUMODE_SUPERVISOR
) "\n"
45 " ldr sp, svc_stack_end \n"
46 " ldr pc, 2f \n" // jump to the kernel
47 "1: b 1b \n" // we never return from here
49 "tmp_stack_end: .word temporary + " STR(127*4) "\n"
50 "sys_stack_end: .word sys_stack + " STR((SYS_STACK_SIZE
- 4)) "\n"
51 "svc_stack_end: .word svc_stack + " STR((SYS_STACK_SIZE
- 4)) "\n"
52 "irq_stack_end: .word irq_stack + " STR((SYS_STACK_SIZE
- 4)) "\n"
53 "abt_stack_end: .word abt_stack + " STR((SYS_STACK_SIZE
- 4)) "\n"
57 * Temporary stack for very early init. It's used only during clearing of
58 * .bss sections in all modules. Rest of this space is occupied by TagItem
59 * boot message. prepared by the bootstrap.
63 struct TagItem tags
[64];
64 } temporary
__attribute__((aligned(32),used
,section(".data")));
66 static uint8_t sys_stack
[SYS_STACK_SIZE
] __attribute__((used
,aligned(16)));
67 static uint8_t svc_stack
[SYS_STACK_SIZE
] __attribute__((used
,aligned(16)));
68 static uint8_t abt_stack
[SYS_STACK_SIZE
] __attribute__((used
,aligned(16)));
69 static uint8_t irq_stack
[SYS_STACK_SIZE
] __attribute__((used
,aligned(16)));
71 static char CmdLine
[200] __attribute__((used
, section(".data")));
73 __attribute__((section(".data"))) struct ExecBase
*SysBase
= NULL
;
75 struct TagItem
*BootMsg
;
77 static void __used
__attribute__((section(".aros.init"))) clear_bss(struct TagItem
*msg
)
79 struct TagItem
*tag
= LibFindTagItem(KRN_KernelBss
, msg
);
83 struct KernelBSS
*bss
= (struct KernelBSS
*)tag
->ti_Data
;
92 void startup(struct TagItem
*tags
)
94 bug("\n[KRN] AROS for EfikaMX built on %s starting...\n", __DATE__
);
95 bug("[KRN] BootMsg @ %08x\n", tags
);
96 bug("[KRN] Kernel entry @ %08x\n", start
);
98 /* Check if the taglist is copied into safe place */
99 if (tags
!= temporary
.tags
)
101 /* Nope, copy taglist... */
102 struct TagItem
*msg
= tags
;
103 struct TagItem
*tmp
= temporary
.tags
;
105 while(msg
->ti_Tag
!= TAG_DONE
)
110 if (tmp
->ti_Tag
== KRN_CmdLine
)
112 strcpy(CmdLine
, (char*) msg
->ti_Data
);
113 tmp
->ti_Data
= (STACKIPTR
) CmdLine
;
114 D(bug("[KRN] CmdLine: %s\n", tmp
->ti_Data
));
116 else if (tmp
->ti_Tag
== KRN_MEMLower
)
118 D(bug("[KRN] MemLower: %08x\n", tmp
->ti_Data
));
120 else if (tmp
->ti_Tag
== KRN_MEMUpper
)
122 D(bug("[KRN] MemUpper: %08x\n", tmp
->ti_Data
));
125 else if (tmp
->ti_Tag
== KRN_KernelLowest
)
127 D(bug("[KRN] KernelLowest: %08x\n", tmp
->ti_Data
));
130 else if (tmp
->ti_Tag
== KRN_KernelHighest
)
132 D(bug("[KRN] KernelHighest: %08x\n", tmp
->ti_Data
));
135 else if (tmp
->ti_Tag
== KRN_KernelBss
)
137 D(bug("[KRN] kernelBSS: %08x\n", tmp
->ti_Data
));