2 * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com)
4 * This file implements mcount(), which is used to collect profiling data.
5 * This can also be tweaked for kernel stack overflow detection.
8 #include <linux/linkage.h>
11 * This is the main variant and is called by C code. GCC's -pg option
12 * automatically instruments every C function with a call to this.
18 .type _mcount,#function
20 .type mcount,#function
23 #ifdef CONFIG_FUNCTION_TRACER
24 #ifdef CONFIG_DYNAMIC_FTRACE
25 /* Do nothing, the retl/nop below is all we need. */
27 sethi %hi(ftrace_trace_function), %g1
28 sethi %hi(ftrace_stub), %g2
29 ldx [%g1 + %lo(ftrace_trace_function)], %g1
30 or %g2, %lo(ftrace_stub), %g2
42 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
43 sethi %hi(ftrace_graph_return), %g1
44 ldx [%g1 + %lo(ftrace_graph_return)], %g3
47 sethi %hi(ftrace_graph_entry_stub), %g2
48 sethi %hi(ftrace_graph_entry), %g1
49 or %g2, %lo(ftrace_graph_entry_stub), %g2
50 ldx [%g1 + %lo(ftrace_graph_entry)], %g1
58 ba,pt %xcc, ftrace_graph_caller
66 .size _mcount,.-_mcount
69 #ifdef CONFIG_FUNCTION_TRACER
71 .type ftrace_stub,#function
75 .size ftrace_stub,.-ftrace_stub
76 #ifdef CONFIG_DYNAMIC_FTRACE
78 .type ftrace_caller,#function
90 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
91 .globl ftrace_graph_call
98 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
99 .size ftrace_graph_call,.-ftrace_graph_call
101 .size ftrace_call,.-ftrace_call
102 .size ftrace_caller,.-ftrace_caller
106 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
107 ENTRY(ftrace_graph_caller)
110 call prepare_ftrace_return
114 END(ftrace_graph_caller)
116 ENTRY(return_to_handler)
118 call ftrace_return_to_handler
122 END(return_to_handler)