2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
9 #include <utility/tagitem.h>
10 #include <proto/arossupport.h>
14 #include <aros/arm/cpucontext.h>
16 #include <kernel_base.h>
17 #include <kernel_debug.h>
20 #define STR(x) _STR(x)
22 #define SYS_STACK_SIZE (16384)
24 asm(".section .aros.init,\"ax\"\n\t"
26 ".type start,%function\n"
27 "start: ldr sp, tmp_stack_end \n" // Load address of top of stack pointer
29 " bl clear_bss \n" // clear bss regions
30 " mov r0, r4 \n" // restore boot msg parameter
31 " cps #" STR(CPUMODE_SYSTEM
) "\n" // Enter System mode
32 " ldr sp, sys_stack_end \n" // Load system mode stack
33 " cps #" STR(CPUMODE_IRQ
) "\n"
34 " ldr sp, irq_stack_end \n"
35 " cps #" STR(CPUMODE_ABORT
) "\n"
36 " ldr sp, abt_stack_end \n"
37 " cps #" STR(CPUMODE_SUPERVISOR
) "\n"
38 " ldr sp, svc_stack_end \n"
39 " ldr pc, 2f \n" // jump to the kernel
40 "1: b 1b \n" // we never return from here
42 "tmp_stack_end: .word temporary + " STR(127*4) "\n"
43 "sys_stack_end: .word sys_stack + " STR((SYS_STACK_SIZE
- 4)) "\n"
44 "svc_stack_end: .word svc_stack + " STR((SYS_STACK_SIZE
- 4)) "\n"
45 "irq_stack_end: .word irq_stack + " STR((SYS_STACK_SIZE
- 4)) "\n"
46 "abt_stack_end: .word abt_stack + " STR((SYS_STACK_SIZE
- 4)) "\n"
50 * Temporary stack for very early init. It's used only during clearing of
51 * .bss sections in all modules. Rest of this space is occupied by TagItem
52 * boot message. prepared by the bootstrap.
56 struct TagItem tags
[64];
57 } temporary
__attribute__((aligned(32),used
,section(".data")));
59 static uint8_t sys_stack
[SYS_STACK_SIZE
] __attribute__((used
,aligned(16)));
60 static uint8_t svc_stack
[SYS_STACK_SIZE
] __attribute__((used
,aligned(16)));
61 static uint8_t abt_stack
[SYS_STACK_SIZE
] __attribute__((used
,aligned(16)));
62 static uint8_t irq_stack
[SYS_STACK_SIZE
] __attribute__((used
,aligned(16)));
64 //static uint32_t * const sys_stack_end __attribute__((used,section(".aros.init"))) = &sys_stack[SYS_STACK_SIZE-1];
65 //static uint32_t * const svc_stack_end __attribute__((used,section(".aros.init"))) = &svc_stack[SYS_STACK_SIZE-1];
66 //static uint32_t * const abt_stack_end __attribute__((used,section(".aros.init"))) = &abt_stack[SYS_STACK_SIZE-1];
67 //static uint32_t * const irq_stack_end __attribute__((used,section(".aros.init"))) = &irq_stack[SYS_STACK_SIZE-1];
69 //static uint32_t * const tmp_stack_end __attribute__((used,section(".aros.init"))) = &temporary.stack[128 - 1];
71 struct TagItem
*BootMsg
;
73 static void __used
__attribute__((section(".aros.init"))) clear_bss(struct TagItem
*msg
)
75 struct TagItem
*tag
= LibFindTagItem(KRN_KernelBss
, msg
);
79 struct KernelBSS
*bss
= (struct KernelBSS
*)tag
->ti_Data
;
88 void startup(struct TagItem
*tags
)
90 bug("\n[KRN] AROS for EfikaMX built on %s starting...\n", __DATE__
);
91 bug("[KRN] BootMsg @ %08x\n", tags
);