2 * Copyright IBM Corp. 2008, 2009
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
8 #include <linux/linkage.h>
9 #include <asm/asm-offsets.h>
10 #include <asm/ftrace.h>
11 #include <asm/ptrace.h>
12 #include <asm/export.h>
14 .section .kprobes.text, "ax"
19 #define STACK_FRAME_SIZE (STACK_FRAME_OVERHEAD + __PT_SIZE)
20 #define STACK_PTREGS (STACK_FRAME_OVERHEAD)
21 #define STACK_PTREGS_GPRS (STACK_PTREGS + __PT_GPRS)
22 #define STACK_PTREGS_PSW (STACK_PTREGS + __PT_PSW)
27 EXPORT_SYMBOL(_mcount)
30 .globl ftrace_regs_caller
31 .set ftrace_regs_caller,ftrace_caller
33 #ifndef CC_USING_HOTPATCH
34 aghi %r0,MCOUNT_RETURN_FIXUP
36 aghi %r15,-STACK_FRAME_SIZE
37 stg %r1,__SF_BACKCHAIN(%r15)
38 stg %r1,(STACK_PTREGS_GPRS+15*8)(%r15)
39 stg %r0,(STACK_PTREGS_PSW+8)(%r15)
40 stmg %r2,%r14,(STACK_PTREGS_GPRS+2*8)(%r15)
41 #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
42 aghik %r2,%r0,-MCOUNT_INSN_SIZE
43 lgrl %r4,function_trace_op
44 lgrl %r1,ftrace_trace_function
47 aghi %r2,-MCOUNT_INSN_SIZE
48 larl %r4,function_trace_op
50 larl %r1,ftrace_trace_function
54 la %r5,STACK_PTREGS(%r15)
56 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
57 # The j instruction gets runtime patched to a nop instruction.
58 # See ftrace_enable_ftrace_graph_caller.
59 ENTRY(ftrace_graph_caller)
60 j ftrace_graph_caller_end
61 lg %r2,(STACK_PTREGS_GPRS+14*8)(%r15)
62 lg %r3,(STACK_PTREGS_PSW+8)(%r15)
63 brasl %r14,prepare_ftrace_return
64 stg %r2,(STACK_PTREGS_GPRS+14*8)(%r15)
65 ftrace_graph_caller_end:
66 .globl ftrace_graph_caller_end
68 lg %r1,(STACK_PTREGS_PSW+8)(%r15)
69 lmg %r2,%r15,(STACK_PTREGS_GPRS+2*8)(%r15)
72 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
74 ENTRY(return_to_handler)
77 aghi %r15,-STACK_FRAME_OVERHEAD
78 stg %r1,__SF_BACKCHAIN(%r15)
79 brasl %r14,ftrace_return_to_handler
80 aghi %r15,STACK_FRAME_OVERHEAD