2009-09-11 16:28:33 +08:00
|
|
|
/*
|
2012-07-20 17:15:04 +08:00
|
|
|
* Copyright IBM Corp. 2008, 2009
|
2009-09-11 16:28:33 +08:00
|
|
|
*
|
|
|
|
* Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-07-24 16:48:19 +08:00
|
|
|
#include <linux/linkage.h>
|
2009-09-11 16:28:33 +08:00
|
|
|
#include <asm/asm-offsets.h>
|
2013-05-13 20:48:52 +08:00
|
|
|
#include <asm/ftrace.h>
|
2009-09-11 16:28:33 +08:00
|
|
|
|
2011-01-05 19:47:25 +08:00
|
|
|
.section .kprobes.text, "ax"
|
|
|
|
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(ftrace_stub)
|
2009-09-11 16:28:33 +08:00
|
|
|
br %r14
|
|
|
|
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(_mcount)
|
2009-09-11 16:28:33 +08:00
|
|
|
#ifdef CONFIG_DYNAMIC_FTRACE
|
|
|
|
br %r14
|
|
|
|
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(ftrace_caller)
|
2009-09-11 16:28:33 +08:00
|
|
|
#endif
|
|
|
|
larl %r1,function_trace_stop
|
|
|
|
icm %r1,0xf,0(%r1)
|
|
|
|
bnzr %r14
|
|
|
|
stmg %r2,%r5,32(%r15)
|
|
|
|
stg %r14,112(%r15)
|
|
|
|
lgr %r1,%r15
|
|
|
|
aghi %r15,-160
|
|
|
|
stg %r1,__SF_BACKCHAIN(%r15)
|
|
|
|
lgr %r2,%r14
|
|
|
|
lg %r3,168(%r15)
|
2013-05-13 20:48:52 +08:00
|
|
|
aghi %r2,-MCOUNT_INSN_SIZE
|
2009-09-11 16:28:33 +08:00
|
|
|
larl %r14,ftrace_trace_function
|
|
|
|
lg %r14,0(%r14)
|
|
|
|
basr %r14,%r14
|
|
|
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
2011-01-05 19:48:11 +08:00
|
|
|
lg %r2,168(%r15)
|
|
|
|
lg %r3,272(%r15)
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(ftrace_graph_caller)
|
2011-01-05 19:48:11 +08:00
|
|
|
# The bras instruction gets runtime patched to call prepare_ftrace_return.
|
|
|
|
# See ftrace_enable_ftrace_graph_caller. The patched instruction is:
|
|
|
|
# bras %r14,prepare_ftrace_return
|
|
|
|
bras %r14,0f
|
|
|
|
0: stg %r2,168(%r15)
|
2009-09-11 16:28:33 +08:00
|
|
|
#endif
|
|
|
|
aghi %r15,160
|
|
|
|
lmg %r2,%r5,32(%r15)
|
|
|
|
lg %r14,112(%r15)
|
|
|
|
br %r14
|
|
|
|
|
|
|
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
|
|
|
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(return_to_handler)
|
2009-09-11 16:28:33 +08:00
|
|
|
stmg %r2,%r5,32(%r15)
|
|
|
|
lgr %r1,%r15
|
|
|
|
aghi %r15,-160
|
|
|
|
stg %r1,__SF_BACKCHAIN(%r15)
|
|
|
|
brasl %r14,ftrace_return_to_handler
|
|
|
|
aghi %r15,160
|
|
|
|
lgr %r14,%r2
|
|
|
|
lmg %r2,%r5,32(%r15)
|
|
|
|
br %r14
|
|
|
|
|
|
|
|
#endif
|