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>
9 #include <asm/export.h>
12 * This is the main variant and is called by C code. GCC's -pg option
13 * automatically instruments every C function with a call to this.
19 .type _mcount,#function
20 EXPORT_SYMBOL(_mcount)
22 .type mcount,#function
25 #ifdef CONFIG_FUNCTION_TRACER
26 #ifdef CONFIG_DYNAMIC_FTRACE
27 /* Do nothing, the retl/nop below is all we need. */
29 sethi %hi(ftrace_trace_function), %g1
30 sethi %hi(ftrace_stub), %g2
31 ldx [%g1 + %lo(ftrace_trace_function)], %g1
32 or %g2, %lo(ftrace_stub), %g2
44 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
45 sethi %hi(ftrace_graph_return), %g1
46 ldx [%g1 + %lo(ftrace_graph_return)], %g3
49 sethi %hi(ftrace_graph_entry_stub), %g2
50 sethi %hi(ftrace_graph_entry), %g1
51 or %g2, %lo(ftrace_graph_entry_stub), %g2
52 ldx [%g1 + %lo(ftrace_graph_entry)], %g1
60 ba,pt %xcc, ftrace_graph_caller
68 .size _mcount,.-_mcount
71 #ifdef CONFIG_FUNCTION_TRACER
73 .type ftrace_stub,#function
77 .size ftrace_stub,.-ftrace_stub
78 #ifdef CONFIG_DYNAMIC_FTRACE
80 .type ftrace_caller,#function
92 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
93 .globl ftrace_graph_call
100 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
101 .size ftrace_graph_call,.-ftrace_graph_call
103 .size ftrace_call,.-ftrace_call
104 .size ftrace_caller,.-ftrace_caller
108 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
109 ENTRY(ftrace_graph_caller)
112 call prepare_ftrace_return
116 END(ftrace_graph_caller)
118 ENTRY(return_to_handler)
120 call ftrace_return_to_handler
124 END(return_to_handler)