diff options
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: |