0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/linkage.h>
0010 #include <asm/export.h>
0011
0012
0013
0014
0015
0016
0017 .text
0018 .align 32
0019 .globl _mcount
0020 .type _mcount,#function
0021 EXPORT_SYMBOL(_mcount)
0022 .globl mcount
0023 .type mcount,#function
0024 _mcount:
0025 mcount:
0026 #ifdef CONFIG_FUNCTION_TRACER
0027 #ifdef CONFIG_DYNAMIC_FTRACE
0028
0029 #else
0030 sethi %hi(ftrace_trace_function), %g1
0031 sethi %hi(ftrace_stub), %g2
0032 ldx [%g1 + %lo(ftrace_trace_function)], %g1
0033 or %g2, %lo(ftrace_stub), %g2
0034 cmp %g1, %g2
0035 be,pn %icc, 1f
0036 mov %i7, %g3
0037 save %sp, -176, %sp
0038 mov %g3, %o1
0039 jmpl %g1, %o7
0040 mov %i7, %o0
0041 ret
0042 restore
0043
0044 1:
0045 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
0046 sethi %hi(ftrace_graph_return), %g1
0047 ldx [%g1 + %lo(ftrace_graph_return)], %g3
0048 cmp %g2, %g3
0049 bne,pn %xcc, 5f
0050 sethi %hi(ftrace_graph_entry_stub), %g2
0051 sethi %hi(ftrace_graph_entry), %g1
0052 or %g2, %lo(ftrace_graph_entry_stub), %g2
0053 ldx [%g1 + %lo(ftrace_graph_entry)], %g1
0054 cmp %g1, %g2
0055 be,pt %xcc, 2f
0056 nop
0057 5: mov %i7, %g2
0058 mov %fp, %g3
0059 save %sp, -176, %sp
0060 mov %g2, %l0
0061 ba,pt %xcc, ftrace_graph_caller
0062 mov %g3, %l1
0063 #endif
0064 2:
0065 #endif
0066 #endif
0067 retl
0068 nop
0069 .size _mcount,.-_mcount
0070 .size mcount,.-mcount
0071
0072 #ifdef CONFIG_FUNCTION_TRACER
0073 .globl ftrace_stub
0074 .type ftrace_stub,#function
0075 ftrace_stub:
0076 retl
0077 nop
0078 .size ftrace_stub,.-ftrace_stub
0079 #ifdef CONFIG_DYNAMIC_FTRACE
0080 .globl ftrace_caller
0081 .type ftrace_caller,#function
0082 ftrace_caller:
0083 mov %i7, %g2
0084 mov %fp, %g3
0085 save %sp, -176, %sp
0086 mov %g2, %o1
0087 mov %g2, %l0
0088 mov %g3, %l1
0089 .globl ftrace_call
0090 ftrace_call:
0091 call ftrace_stub
0092 mov %i7, %o0
0093 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
0094 .globl ftrace_graph_call
0095 ftrace_graph_call:
0096 call ftrace_stub
0097 nop
0098 #endif
0099 ret
0100 restore
0101 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
0102 .size ftrace_graph_call,.-ftrace_graph_call
0103 #endif
0104 .size ftrace_call,.-ftrace_call
0105 .size ftrace_caller,.-ftrace_caller
0106 #endif
0107 #endif
0108
0109 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
0110 ENTRY(ftrace_graph_caller)
0111 mov %l0, %o0
0112 mov %i7, %o1
0113 call prepare_ftrace_return
0114 mov %l1, %o2
0115 ret
0116 restore %o0, -8, %i7
0117 END(ftrace_graph_caller)
0118
0119 ENTRY(return_to_handler)
0120 save %sp, -176, %sp
0121 call ftrace_return_to_handler
0122 mov %fp, %o0
0123 jmpl %o0 + 8, %g0
0124 restore
0125 END(return_to_handler)
0126 #endif