From 1688dd0358f852687cd5b77a066631ad936cd7c7 Mon Sep 17 00:00:00 2001 From: schulz Date: Thu, 13 Jun 2013 19:41:46 +0000 Subject: [PATCH] ugly fixes against gcc which does not like to mix .aros.init sections with "ax" attribute with .aros.init sections with "a" attribute... git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@47553 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/arm-efika/kernel/kernel_startup.c | 61 +++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/arch/arm-efika/kernel/kernel_startup.c b/arch/arm-efika/kernel/kernel_startup.c index c244cb4d87..af0b16ceff 100644 --- a/arch/arm-efika/kernel/kernel_startup.c +++ b/arch/arm-efika/kernel/kernel_startup.c @@ -11,24 +11,39 @@ #include #include +#include + #include #include +#define _STR(x) #x +#define STR(x) _STR(x) + +#define SYS_STACK_SIZE (16384) + asm(".section .aros.init,\"ax\"\n\t" ".globl start\n\t" ".type start,%function\n" - "start: ldr r12, 3f \n" // Load address of top of stack pointer - " ldr sp, [r12] \n" // Load temporary stack pointer - " mov r4, r0 \n" - " bl clear_bss \n" // clear bss regions - " mov r0, r4 \n" // restore boot msg parameter - " ldr r12, 4f \n" // load supervisor stack - " ldr sp, [r12] \n" - " ldr pc, 2f \n" // jump to the kernel - "1: b 1b \n" // we never return from here - "2: .word startup \n" - "3: .word tmp_stack_end \n" - "4: .word ssp_stack_end \n" + "start: ldr sp, tmp_stack_end \n" // Load address of top of stack pointer + " mov r4, r0 \n" + " bl clear_bss \n" // clear bss regions + " mov r0, r4 \n" // restore boot msg parameter + " cps #" STR(CPUMODE_SYSTEM) "\n" // Enter System mode + " ldr sp, sys_stack_end \n" // Load system mode stack + " cps #" STR(CPUMODE_IRQ) "\n" + " ldr sp, irq_stack_end \n" + " cps #" STR(CPUMODE_ABORT) "\n" + " ldr sp, abt_stack_end \n" + " cps #" STR(CPUMODE_SUPERVISOR) "\n" + " ldr sp, svc_stack_end \n" + " ldr pc, 2f \n" // jump to the kernel + "1: b 1b \n" // we never return from here + "2: .word startup \n" + "tmp_stack_end: .word temporary + " STR(127*4) "\n" + "sys_stack_end: .word sys_stack + " STR((SYS_STACK_SIZE - 4)) "\n" + "svc_stack_end: .word svc_stack + " STR((SYS_STACK_SIZE - 4)) "\n" + "irq_stack_end: .word irq_stack + " STR((SYS_STACK_SIZE - 4)) "\n" + "abt_stack_end: .word abt_stack + " STR((SYS_STACK_SIZE - 4)) "\n" ); /* @@ -36,24 +51,32 @@ asm(".section .aros.init,\"ax\"\n\t" * .bss sections in all modules. Rest of this space is occupied by TagItem * boot message. prepared by the bootstrap. */ -union { +static union { uint32_t stack[128]; - struct TagItem tags[64] + struct TagItem tags[64]; } temporary __attribute__((aligned(32),used,section(".data"))); -static uint32_t ssp_stack[4096]; -static const uint32_t *ssp_stack_end __used = &ssp_stack[4096]; -static const uint32_t *tmp_stack_end __used = &temporary.stack[128]; +static uint8_t sys_stack[SYS_STACK_SIZE] __attribute__((used,aligned(16))); +static uint8_t svc_stack[SYS_STACK_SIZE] __attribute__((used,aligned(16))); +static uint8_t abt_stack[SYS_STACK_SIZE] __attribute__((used,aligned(16))); +static uint8_t irq_stack[SYS_STACK_SIZE] __attribute__((used,aligned(16))); + +//static uint32_t * const sys_stack_end __attribute__((used,section(".aros.init"))) = &sys_stack[SYS_STACK_SIZE-1]; +//static uint32_t * const svc_stack_end __attribute__((used,section(".aros.init"))) = &svc_stack[SYS_STACK_SIZE-1]; +//static uint32_t * const abt_stack_end __attribute__((used,section(".aros.init"))) = &abt_stack[SYS_STACK_SIZE-1]; +//static uint32_t * const irq_stack_end __attribute__((used,section(".aros.init"))) = &irq_stack[SYS_STACK_SIZE-1]; + +//static uint32_t * const tmp_stack_end __attribute__((used,section(".aros.init"))) = &temporary.stack[128 - 1]; struct TagItem *BootMsg; -static void __used clear_bss(struct TagItem *msg) +static void __used __attribute__((section(".aros.init"))) clear_bss(struct TagItem *msg) { struct TagItem *tag = LibFindTagItem(KRN_KernelBss, msg); if (tag) { - struct KernelBSS *bss = (struct KernelbSS *)tag->ti_Data; + struct KernelBSS *bss = (struct KernelBSS *)tag->ti_Data; if (bss) { -- 2.11.4.GIT