From 83e6df26f9a728353e7d135ae4bd17cb790ca4b2 Mon Sep 17 00:00:00 2001 From: Benjamin Walsh Date: Sun, 20 Nov 2016 11:49:07 -0500 Subject: [PATCH] arc: use one of the interrupt stacks during early init Same issue as with ARM. ARC can use _Swap() though, because the call to it is serial, not generating a low-priority exception and interrupts are locked until the main() thread is context-switched into and the interrupt stack is released. Fixes ZEP-1310. Change-Id: Ie1f27f7ad0502191ca2867b5400d6e0bfb7f0fc6 Signed-off-by: Benjamin Walsh --- arch/arc/core/reset.S | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/arch/arc/core/reset.S b/arch/arc/core/reset.S index 57fa28ea2a5..c6c432cc2f9 100644 --- a/arch/arc/core/reset.S +++ b/arch/arc/core/reset.S @@ -28,11 +28,25 @@ #include #include -#ifdef CONFIG_HARVARD -#define _TOP_OF_MEMORY (CONFIG_DCCM_BASE_ADDRESS + CONFIG_DCCM_SIZE * 1024) -/* harvard places the initial stack in the dccm memory */ +GDATA(_interrupt_stack) +GDATA(_firq_stack) + +/* use one of the available interrupt stacks during init */ + +/* FIRQ only ? */ +#if CONFIG_NUM_IRQ_PRIO_LEVELS == 1 + + /* FIRQ, but uses _interrupt_stack ? */ + #if CONFIG_RGF_NUM_BANKS == 1 + #define INIT_STACK _interrupt_stack + #define INIT_STACK_SIZE CONFIG_ISR_STACK_SIZE + #else + #define INIT_STACK _firq_stack + #define INIT_STACK_SIZE CONFIG_FIRQ_STACK_SIZE + #endif #else -#define _TOP_OF_MEMORY (CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_SIZE * 1024) + #define INIT_STACK _interrupt_stack + #define INIT_STACK_SIZE CONFIG_ISR_STACK_SIZE #endif GTEXT(__reset) @@ -58,7 +72,7 @@ SECTION_FUNC(TEXT,__start) /* lock interrupts: will get unlocked when switch to main task */ clri - /* setup a stack at the end of MEMORY */ - mov sp, _TOP_OF_MEMORY + mov sp, INIT_STACK + add sp, sp, INIT_STACK_SIZE j @_PrepC