]> xenbits.xensource.com Git - people/julieng/boot-wrapper-aarch64.git/commitdiff
AArch64: add a small stack for each CPU
authorJean-Philippe Brucker <jean-philippe.brucker@arm.com>
Thu, 26 Nov 2015 17:49:41 +0000 (17:49 +0000)
committerMark Rutland <mark.rutland@arm.com>
Tue, 14 Jun 2016 16:49:29 +0000 (17:49 +0100)
When rewriting some bits of the boot-wrapper in C, we will need tiny
per-CPU stacks. This patch reserves 256 bytes of stack for each CPU
defined in the CPU_IDS macro.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Makefile.am
arch/aarch64/boot.S
arch/aarch64/stack.S [new file with mode: 0644]
model.lds.S

index 8a2069dc96a4f36d59ce82387e9c0eb767cb7e52..d74b361bf7ce1ea3a64b444cfb9a9e1b1fd81683 100644 (file)
@@ -20,6 +20,7 @@ DEFINES               += -DCPU_IDS=$(CPU_IDS)
 DEFINES                += -DNR_CPUS=$(NR_CPUS)
 DEFINES                += -DSYSREGS_BASE=$(SYSREGS_BASE)
 DEFINES                += -DUART_BASE=$(UART_BASE)
+DEFINES                += -DSTACK_SIZE=256
 
 OFILES         =
 ARCH_SRC       := arch/aarch64/
@@ -84,7 +85,7 @@ endif
 
 CPPFLAGS       += $(INITRD_FLAGS)
 
-OFILES         += $(addprefix $(ARCH_SRC),boot.o cache.o $(GIC) mmu.o ns.o $(BOOTMETHOD) utils.o)
+OFILES         += $(addprefix $(ARCH_SRC),boot.o stack.o cache.o $(GIC) mmu.o ns.o $(BOOTMETHOD) utils.o)
 
 all: $(IMAGE)
 
index 9e3a2351069ed5bb11b84b58bb4af23cb6512dd0..72c33a9a7d1dae3311df053e45f267a0a9a70324 100644 (file)
 
        .globl  _start
 _start:
+       mrs     x0, mpidr_el1
+       ldr     x1, =MPIDR_ID_BITS
+       and     x0, x0, x1
+       bl      find_logical_id
+       cmp     x0, #MPIDR_INVALID
+       beq     err_invalid_id
+       bl      setup_stack
+
        /*
         * EL3 initialisation
         */
@@ -35,4 +43,6 @@ _start:
 
        b       start_el3
 
+err_invalid_id:
+       b       .
        .ltorg
diff --git a/arch/aarch64/stack.S b/arch/aarch64/stack.S
new file mode 100644 (file)
index 0000000..8fb38ba
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * arch/aarch64/stack.S - stack handling
+ *
+ * Copyright (C) 2015 ARM Limited. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE.txt file.
+ */
+
+       .globl setup_stack
+       .globl stack_top
+       .globl stack_bottom
+
+       .text
+       /*
+        * Setup initial stack pointer
+        * x0: logical CPU ID
+        * Clobbers x1 and x2
+        */
+setup_stack:
+       mov     w1, #STACK_SIZE
+       ldr     x2, =stack_top
+       umsubl  x0, w0, w1, x2                  // sp = st_base - cpu * st_size
+       mov     sp, x0
+       ret
+
+       .section .stack
+       .align 4
+stack_bottom:
+       .irp cpu, CPU_IDS
+       .space STACK_SIZE
+       .endr
+stack_top:
index 504f3b969c7f43ac0742aba3bd0f1319188d725e..235d8c99021be9585f84b2460689a0e7dfc042d4 100644 (file)
@@ -48,6 +48,7 @@ SECTIONS
                *(.init)
                *(.text .data .rodata* .bss COMMON)
                *(.vectors)
+               *(.stack)
                *(.pgtables)
        }