Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / arm / lib / call_with_stack.S
blob28b0341ae786fbd73aa5d4fe9a43e49bee3e910c
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * arch/arm/lib/call_with_stack.S
4  *
5  * Copyright (C) 2011 ARM Ltd.
6  * Written by Will Deacon <will.deacon@arm.com>
7  */
9 #include <linux/linkage.h>
10 #include <asm/assembler.h>
13  * void call_with_stack(void (*fn)(void *), void *arg, void *sp)
14  *
15  * Change the stack to that pointed at by sp, then invoke fn(arg) with
16  * the new stack.
17  */
18 ENTRY(call_with_stack)
19         str     sp, [r2, #-4]!
20         str     lr, [r2, #-4]!
22         mov     sp, r2
23         mov     r2, r0
24         mov     r0, r1
26         badr    lr, 1f
27         ret     r2
29 1:      ldr     lr, [sp]
30         ldr     sp, [sp, #4]
31         ret     lr
32 ENDPROC(call_with_stack)