diff options
author | Jean-Philippe Brucker <jean-philippe.brucker@arm.com> | 2015-11-26 17:49:41 +0000 |
---|---|---|
committer | Mark Rutland <mark.rutland@arm.com> | 2016-06-14 17:49:29 +0100 |
commit | 3c1a7c71729fd18242ac420c136afdfa337dc0b1 (patch) | |
tree | 315d97d3b09da000deead314c0531ad6a5bd7ba5 | |
parent | 8fe23b296fb92637458e8f05c3f02efb58367fec (diff) | |
download | boot-wrapper-aarch64-3c1a7c71729fd18242ac420c136afdfa337dc0b1.tar.gz |
AArch64: add a small stack for each CPU
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>
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | arch/aarch64/boot.S | 10 | ||||
-rw-r--r-- | arch/aarch64/stack.S | 33 | ||||
-rw-r--r-- | model.lds.S | 1 |
4 files changed, 46 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index 8a2069d..d74b361 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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) diff --git a/arch/aarch64/boot.S b/arch/aarch64/boot.S index 9e3a235..72c33a9 100644 --- a/arch/aarch64/boot.S +++ b/arch/aarch64/boot.S @@ -13,6 +13,14 @@ .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 index 0000000..8fb38ba --- /dev/null +++ b/arch/aarch64/stack.S @@ -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: diff --git a/model.lds.S b/model.lds.S index 504f3b9..235d8c9 100644 --- a/model.lds.S +++ b/model.lds.S @@ -48,6 +48,7 @@ SECTIONS *(.init) *(.text .data .rodata* .bss COMMON) *(.vectors) + *(.stack) *(.pgtables) } |