aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/lib
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-04-07 07:41:33 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-13 01:37:26 -0400
commit9960e9e8944f9b1ca6af5f7d26400ca45b429600 (patch)
tree2483b4c55f54663a8cc358fae5837e7d8232c554 /arch/sparc/lib
parenta71d1d6bb1b26e566e5c06c37857f4cdc1664780 (diff)
sparc64: Add function graph tracer support.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/lib')
-rw-r--r--arch/sparc/lib/mcount.S62
1 files changed, 56 insertions, 6 deletions
diff --git a/arch/sparc/lib/mcount.S b/arch/sparc/lib/mcount.S
index 153c80e62cf1..3753e3c6e176 100644
--- a/arch/sparc/lib/mcount.S
+++ b/arch/sparc/lib/mcount.S
@@ -26,22 +26,42 @@ mcount:
26#else 26#else
27 sethi %hi(function_trace_stop), %g1 27 sethi %hi(function_trace_stop), %g1
28 lduw [%g1 + %lo(function_trace_stop)], %g2 28 lduw [%g1 + %lo(function_trace_stop)], %g2
29 brnz,pn %g2, 1f 29 brnz,pn %g2, 2f
30 sethi %hi(ftrace_trace_function), %g1 30 sethi %hi(ftrace_trace_function), %g1
31 sethi %hi(ftrace_stub), %g2 31 sethi %hi(ftrace_stub), %g2
32 ldx [%g1 + %lo(ftrace_trace_function)], %g1 32 ldx [%g1 + %lo(ftrace_trace_function)], %g1
33 or %g2, %lo(ftrace_stub), %g2 33 or %g2, %lo(ftrace_stub), %g2
34 cmp %g1, %g2 34 cmp %g1, %g2
35 be,pn %icc, 1f 35 be,pn %icc, 1f
36 mov %i7, %g2 36 mov %i7, %g3
37 save %sp, -128, %sp 37 save %sp, -128, %sp
38 mov %g2, %o1 38 mov %g3, %o1
39 jmpl %g1, %o7 39 jmpl %g1, %o7
40 mov %i7, %o0 40 mov %i7, %o0
41 ret 41 ret
42 restore 42 restore
43 /* not reached */ 43 /* not reached */
441: 441:
45#ifdef CONFIG_FUNCTION_GRAPH_TRACER
46 sethi %hi(ftrace_graph_return), %g1
47 ldx [%g1 + %lo(ftrace_graph_return)], %g3
48 cmp %g2, %g3
49 bne,pn %xcc, 5f
50 sethi %hi(ftrace_graph_entry_stub), %g2
51 sethi %hi(ftrace_graph_entry), %g1
52 or %g2, %lo(ftrace_graph_entry_stub), %g2
53 ldx [%g1 + %lo(ftrace_graph_entry)], %g1
54 cmp %g1, %g2
55 be,pt %xcc, 2f
56 nop
575: mov %i7, %g2
58 mov %fp, %g3
59 save %sp, -128, %sp
60 mov %g2, %l0
61 ba,pt %xcc, ftrace_graph_caller
62 mov %g3, %l1
63#endif
642:
45#endif 65#endif
46#endif 66#endif
47 retl 67 retl
@@ -62,18 +82,48 @@ ftrace_stub:
62ftrace_caller: 82ftrace_caller:
63 sethi %hi(function_trace_stop), %g1 83 sethi %hi(function_trace_stop), %g1
64 mov %i7, %g2 84 mov %i7, %g2
65 lduw [%g1 + %lo(function_trace_stop)], %g3 85 lduw [%g1 + %lo(function_trace_stop)], %g1
66 brnz,pn %g3, ftrace_stub 86 brnz,pn %g1, ftrace_stub
67 nop 87 mov %fp, %g3
68 save %sp, -128, %sp 88 save %sp, -128, %sp
69 mov %g2, %o1 89 mov %g2, %o1
90 mov %g2, %l0
91 mov %g3, %l1
70 .globl ftrace_call 92 .globl ftrace_call
71ftrace_call: 93ftrace_call:
72 call ftrace_stub 94 call ftrace_stub
73 mov %i7, %o0 95 mov %i7, %o0
96#ifdef CONFIG_FUNCTION_GRAPH_TRACER
97 .globl ftrace_graph_call
98ftrace_graph_call:
99 call ftrace_stub
100 nop
101#endif
74 ret 102 ret
75 restore 103 restore
104#ifdef CONFIG_FUNCTION_GRAPH_TRACER
105 .size ftrace_graph_call,.-ftrace_graph_call
106#endif
76 .size ftrace_call,.-ftrace_call 107 .size ftrace_call,.-ftrace_call
77 .size ftrace_caller,.-ftrace_caller 108 .size ftrace_caller,.-ftrace_caller
78#endif 109#endif
79#endif 110#endif
111
112#ifdef CONFIG_FUNCTION_GRAPH_TRACER
113ENTRY(ftrace_graph_caller)
114 mov %l0, %o0
115 mov %i7, %o1
116 call prepare_ftrace_return
117 mov %l1, %o2
118 ret
119 restore %o0, -8, %i7
120END(ftrace_graph_caller)
121
122ENTRY(return_to_handler)
123 save %sp, -128, %sp
124 call ftrace_return_to_handler
125 mov %fp, %o0
126 jmpl %o0 + 8, %g0
127 restore
128END(return_to_handler)
129#endif