/* SPDX-License-Identifier: GPL-2.0-only */1/*2* arch/arm/lib/call_with_stack.S3*4* Copyright (C) 2011 ARM Ltd.5* Written by Will Deacon <[email protected]>6*/78#include <linux/linkage.h>9#include <asm/assembler.h>10#include <asm/unwind.h>1112/*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) with16* the new stack.17*18* The sequence below follows the APCS frame convention for frame pointer19* unwinding, and implements the unwinder annotations needed by the EABI20* unwinder.21*/2223ENTRY(call_with_stack)24#if defined(CONFIG_UNWINDER_FRAME_POINTER) && defined(CONFIG_CC_IS_GCC)25mov ip, sp26push {fp, ip, lr, pc}27sub fp, ip, #428#else29UNWIND( .fnstart )30UNWIND( .save {fpreg, lr} )31push {fpreg, lr}32UNWIND( .setfp fpreg, sp )33mov fpreg, sp34#endif35mov sp, r236mov r2, r037mov r0, r13839bl_r r24041#if defined(CONFIG_UNWINDER_FRAME_POINTER) && defined(CONFIG_CC_IS_GCC)42ldmdb fp, {fp, sp, pc}43#else44mov sp, fpreg45pop {fpreg, pc}46UNWIND( .fnend )47#endif48.globl call_with_stack_end49call_with_stack_end:50ENDPROC(call_with_stack)515253