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 */ 8 9#include <linux/linkage.h> 10#include <asm/assembler.h> 11 12/* 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 */ 18ENTRY(call_with_stack) 19 str sp, [r2, #-4]! 20 str lr, [r2, #-4]! 21 22 mov sp, r2 23 mov r2, r0 24 mov r0, r1 25 26 badr lr, 1f 27 ret r2 28 291: ldr lr, [sp] 30 ldr sp, [sp, #4] 31 ret lr 32ENDPROC(call_with_stack) 33