• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright IBM Corp. 2008,2009
3 *
4 *   Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
5 *
6 */
7
8#include <linux/linkage.h>
9#include <asm/asm-offsets.h>
10
11	.section .kprobes.text, "ax"
12
13ENTRY(ftrace_stub)
14	br	%r14
15
16ENTRY(_mcount)
17#ifdef CONFIG_DYNAMIC_FTRACE
18	br	%r14
19
20ENTRY(ftrace_caller)
21#endif
22	larl	%r1,function_trace_stop
23	icm	%r1,0xf,0(%r1)
24	bnzr	%r14
25	stmg	%r2,%r5,32(%r15)
26	stg	%r14,112(%r15)
27	lgr	%r1,%r15
28	aghi	%r15,-160
29	stg	%r1,__SF_BACKCHAIN(%r15)
30	lgr	%r2,%r14
31	lg	%r3,168(%r15)
32	larl	%r14,ftrace_trace_function
33	lg	%r14,0(%r14)
34	basr	%r14,%r14
35#ifdef CONFIG_FUNCTION_GRAPH_TRACER
36	lg	%r2,168(%r15)
37	lg	%r3,272(%r15)
38ENTRY(ftrace_graph_caller)
39# The bras instruction gets runtime patched to call prepare_ftrace_return.
40# See ftrace_enable_ftrace_graph_caller. The patched instruction is:
41#	bras	%r14,prepare_ftrace_return
42	bras	%r14,0f
430:	stg	%r2,168(%r15)
44#endif
45	aghi	%r15,160
46	lmg	%r2,%r5,32(%r15)
47	lg	%r14,112(%r15)
48	br	%r14
49
50#ifdef CONFIG_FUNCTION_GRAPH_TRACER
51
52ENTRY(return_to_handler)
53	stmg	%r2,%r5,32(%r15)
54	lgr	%r1,%r15
55	aghi	%r15,-160
56	stg	%r1,__SF_BACKCHAIN(%r15)
57	brasl	%r14,ftrace_return_to_handler
58	aghi	%r15,160
59	lgr	%r14,%r2
60	lmg	%r2,%r5,32(%r15)
61	br	%r14
62
63#endif
64