blob: f70cadec68fccbcc12e60776aaa092fdc6239a05 [file] [log] [blame]
Martin Schwidefsky6ac2a4d2009-09-11 10:28:33 +02001/*
2 * Copyright IBM Corp. 2008,2009
3 *
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
5 *
6 */
7
Jan Glauber144d6342011-07-24 10:48:19 +02008#include <linux/linkage.h>
Martin Schwidefsky6ac2a4d2009-09-11 10:28:33 +02009#include <asm/asm-offsets.h>
10
Martin Schwidefsky860dba42011-01-05 12:47:25 +010011 .section .kprobes.text, "ax"
12
Jan Glauber144d6342011-07-24 10:48:19 +020013ENTRY(ftrace_stub)
Martin Schwidefsky6ac2a4d2009-09-11 10:28:33 +020014 br %r14
15
Jan Glauber144d6342011-07-24 10:48:19 +020016ENTRY(_mcount)
Martin Schwidefsky6ac2a4d2009-09-11 10:28:33 +020017#ifdef CONFIG_DYNAMIC_FTRACE
18 br %r14
19
Jan Glauber144d6342011-07-24 10:48:19 +020020ENTRY(ftrace_caller)
Martin Schwidefsky6ac2a4d2009-09-11 10:28:33 +020021#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)
Martin Schwidefsky6ac2a4d2009-09-11 10:28:33 +020032 larl %r14,ftrace_trace_function
Martin Schwidefsky6ac2a4d2009-09-11 10:28:33 +020033 lg %r14,0(%r14)
34 basr %r14,%r14
35#ifdef CONFIG_FUNCTION_GRAPH_TRACER
Martin Schwidefsky4cc9bed2011-01-05 12:48:11 +010036 lg %r2,168(%r15)
37 lg %r3,272(%r15)
Jan Glauber144d6342011-07-24 10:48:19 +020038ENTRY(ftrace_graph_caller)
Martin Schwidefsky4cc9bed2011-01-05 12:48:11 +010039# 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)
Martin Schwidefsky6ac2a4d2009-09-11 10:28:33 +020044#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
Jan Glauber144d6342011-07-24 10:48:19 +020052ENTRY(return_to_handler)
Martin Schwidefsky6ac2a4d2009-09-11 10:28:33 +020053 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