1/* 2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7#include <asm_macros.S> 8 9.macro push ra, rb, sp=sp 10 stp \ra, \rb, [\sp,#-16]! 11.endm 12 13.macro pop ra, rb, sp=sp 14 ldp \ra, \rb, [\sp], #16 15.endm 16 17 .global trusty_context_switch_helper 18func trusty_context_switch_helper 19 push x8, xzr 20 push x19, x20 21 push x21, x22 22 push x23, x24 23 push x25, x26 24 push x27, x28 25 push x29, x30 26 27 mov x9, sp 28 ldr x10, [x0] 29 mov sp, x10 30 str x9, [x0] 31 32 pop x29, x30 33 pop x27, x28 34 pop x25, x26 35 pop x23, x24 36 pop x21, x22 37 pop x19, x20 38 pop x8, xzr 39 40 ldr x2, [x1] 41 ldr x3, [x1, #0x08] 42 ldr x4, [x1, #0x10] 43 ldr x5, [x1, #0x18] 44 ldr x6, [x1, #0x20] 45 ldr x7, [x1, #0x28] 46 ldr x10, [x1, #0x30] 47 ldr x11, [x1, #0x38] 48 49 stp x2, x3, [x8] 50 stp x4, x5, [x8, #16] 51 stp x6, x7, [x8, #32] 52 stp x10, x11, [x8, #48] 53 54 ret 55endfunc trusty_context_switch_helper 56 57 .global trusty_init_context_stack 58func trusty_init_context_stack 59 push x8, xzr, x1 60 push xzr, xzr, x1 61 push xzr, xzr, x1 62 push xzr, xzr, x1 63 push xzr, xzr, x1 64 push xzr, xzr, x1 65 adr x9, el3_exit 66 push xzr, x9, x1 67 str x1, [x0] 68 ret 69endfunc trusty_init_context_stack 70