summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorGrissiom <[email protected]>2013-11-17 12:13:25 +0800
committerGrissiom <[email protected]>2013-11-17 12:49:07 +0800
commita8520ed383e9557993d647f477ecb4d6658c3ccd (patch)
tree2e6ace23f4d3b4c217599689f5201a69cd8e2831 /libcpu
parent394657979dcbac390d320cfbed57cacfbc631581 (diff)
cortex-r4: let svc mode reuse the stack of IRQ on startup
As the svc stack is the stack of threads, there is no need to allocate a separate stack for the startup. Reuse the IRQ stack should be OK. Tested on rm48 board.
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/arm/cortex-r4/start_gcc.S18
1 files changed, 7 insertions, 11 deletions
diff --git a/libcpu/arm/cortex-r4/start_gcc.S b/libcpu/arm/cortex-r4/start_gcc.S
index 20a1ccfc0f..3d679d0a22 100644
--- a/libcpu/arm/cortex-r4/start_gcc.S
+++ b/libcpu/arm/cortex-r4/start_gcc.S
@@ -18,11 +18,10 @@
.equ F_Bit, 0x40 @ when F bit is set, FIQ is disabled
.equ UND_Stack_Size, 0x00000000
-.equ SVC_Stack_Size, 0x00000100
+.equ SVC_Stack_Size, 0x00000000
.equ ABT_Stack_Size, 0x00000000
-.equ FIQ_Stack_Size, 0x00000000
-.equ IRQ_Stack_Size, 0x00000100
-.equ USR_Stack_Size, 0x00000100
+.equ FIQ_Stack_Size, 0x00001000
+.equ IRQ_Stack_Size, 0x00001000
.section .bss.noinit
/* stack */
@@ -63,6 +62,9 @@ _reset:
@ Initialize Stack Pointers
ldr r0, =stack_top
+ @ Set the startup stack for svc
+ mov sp, r0
+
@ Enter Undefined Instruction Mode and set its Stack Pointer
msr cpsr_c, #Mode_UND|I_Bit|F_Bit
mov sp, r0
@@ -83,14 +85,8 @@ _reset:
mov sp, r0
sub r0, r0, #IRQ_Stack_Size
- @ Enter Supervisor Mode and set its Stack Pointer
+ @ Switch back to SVC
msr cpsr_c, #Mode_SVC|I_Bit|F_Bit
- mov sp, r0
- sub r0, r0, #SVC_Stack_Size
-
- @ Enter User Mode and set its Stack Pointer
- mov sp, r0
- sub sl, sp, #USR_Stack_Size
bl next1
next1: