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 /arch | |
parent | 8fe23b296fb92637458e8f05c3f02efb58367fec (diff) |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/aarch64/boot.S | 10 | ||||
-rw-r--r-- | arch/aarch64/stack.S | 33 |
2 files changed, 43 insertions, 0 deletions
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: |