blob: aa8644cb98011a108049b44e15bbd7ca065a4ec4 [file] [log] [blame]
Jorge Ramirez-Ortiz5ff5eee2018-09-23 09:41:10 +02001/*
Toshiyuki Ogasaharab67a8ca2019-03-22 16:14:00 +09002 * Copyright (c) 2015-2019, Renesas Electronics Corporation. All rights reserved.
Jorge Ramirez-Ortiz5ff5eee2018-09-23 09:41:10 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
Jorge Ramirez-Ortiz5ff5eee2018-09-23 09:41:10 +02009
10.global rcar_pwrc_switch_stack
Jorge Ramirez-Ortiz5ff5eee2018-09-23 09:41:10 +020011
12/*
13 * x0 : jump address,
14 * x1 : stack address,
15 * x2 : arg,
16 * x3 : stack address (temporary)
17 */
18func rcar_pwrc_switch_stack
19
20 /* lr to stack */
21 stp x29, x30, [sp,#-16]
22
23 /* change stack pointer */
24 mov x3, sp
25 mov sp, x1
26
27 /* save stack pointer */
28 sub sp, sp, #16
29 stp x0, x3, [sp]
30
31 /* data synchronization barrier */
32 dsb sy
33
34 /* jump to code */
35 mov x1, x0
36 mov x0, x2
37 blr x1
38
39 /* load stack pointer */
40 ldp x0, x2, [sp,#0]
41
42 /* change stack pointer */
43 mov sp, x2
44
45 /* return */
46 ldp x29, x30, [sp,#-16]
47 ret
48endfunc rcar_pwrc_switch_stack