import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm64 / lib / call_with_stack.S
1 /*
2 * arch/arm64/lib/call_with_stack.S
3 *
4 */
5
6 #include <linux/linkage.h>
7 #include <asm/assembler.h>
8
9 /*
10 * void call_with_stack(void (*fn)(void *), void *arg, void *sp)
11 *
12 * Change the stack to that pointed at by sp, then invoke fn(arg) with
13 * the new stack.
14 */
15 ENTRY(call_with_stack)
16 mov x3, sp
17 str x3, [x2, #-8]!
18 str lr, [x2, #-8]!
19
20 mov sp, x2
21 mov x2, x0
22 mov x0, x1
23
24 adr lr, 1f
25 br x2
26
27 1: ldr lr, [sp]
28 ldr x3, [sp, #8]
29 mov sp, x3
30 br lr
31 ENDPROC(call_with_stack)