1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2013 Linaro Limited
4 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
5 * Copyright (C) 2017 Andes Technology Corporation
8 #include <linux/ftrace.h>
11 * Most of this file is copied from arm64.
13 void prepare_ftrace_return(unsigned long *parent
, unsigned long self_addr
,
14 unsigned long frame_pointer
)
16 unsigned long return_hooker
= (unsigned long)&return_to_handler
;
18 struct ftrace_graph_ent trace
;
21 if (unlikely(atomic_read(¤t
->tracing_graph_pause
)))
25 * We don't suffer access faults, so no extra fault-recovery assembly
30 trace
.func
= self_addr
;
31 trace
.depth
= current
->curr_ret_stack
+ 1;
33 if (!ftrace_graph_entry(&trace
))
36 err
= ftrace_push_return_trace(old
, self_addr
, &trace
.depth
,
40 *parent
= return_hooker
;