1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm64/kernel/return_address.c
5 * Copyright (C) 2013 Linaro Limited
6 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
9 #include <linux/export.h>
10 #include <linux/ftrace.h>
11 #include <linux/kprobes.h>
12 #include <linux/stacktrace.h>
14 #include <asm/stack_pointer.h>
16 struct return_address_data
{
21 static bool save_return_addr(void *d
, unsigned long pc
)
23 struct return_address_data
*data
= d
;
26 data
->addr
= (void *)pc
;
33 NOKPROBE_SYMBOL(save_return_addr
);
35 void *return_address(unsigned int level
)
37 struct return_address_data data
;
39 data
.level
= level
+ 2;
42 arch_stack_walk(save_return_addr
, &data
, current
, NULL
);
49 EXPORT_SYMBOL_GPL(return_address
);
50 NOKPROBE_SYMBOL(return_address
);