Root/arch/s390/kernel/mcount.S

1/*
2 * Copyright IBM Corp. 2008,2009
3 *
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
5 *
6 */
7
8#include <asm/asm-offsets.h>
9
10    .globl ftrace_stub
11ftrace_stub:
12    br %r14
13
14    .globl _mcount
15_mcount:
16#ifdef CONFIG_DYNAMIC_FTRACE
17    br %r14
18
19    .data
20    .globl ftrace_dyn_func
21ftrace_dyn_func:
22    .long ftrace_stub
23    .previous
24
25    .globl ftrace_caller
26ftrace_caller:
27#endif
28    stm %r2,%r5,16(%r15)
29    bras %r1,2f
30#ifdef CONFIG_DYNAMIC_FTRACE
310: .long ftrace_dyn_func
32#else
330: .long ftrace_trace_function
34#endif
351: .long function_trace_stop
362: l %r2,1b-0b(%r1)
37    icm %r2,0xf,0(%r2)
38    jnz 3f
39    st %r14,56(%r15)
40    lr %r0,%r15
41    ahi %r15,-96
42    l %r3,100(%r15)
43    la %r2,0(%r14)
44    st %r0,__SF_BACKCHAIN(%r15)
45    la %r3,0(%r3)
46    l %r14,0b-0b(%r1)
47    l %r14,0(%r14)
48    basr %r14,%r14
49#ifdef CONFIG_FUNCTION_GRAPH_TRACER
50#ifdef CONFIG_DYNAMIC_FTRACE
51    .globl ftrace_graph_caller
52ftrace_graph_caller:
53    # This unconditional branch gets runtime patched. Change only if
54    # you know what you are doing. See ftrace_enable_graph_caller().
55    j 1f
56#endif
57    bras %r1,0f
58    .long prepare_ftrace_return
590: l %r2,152(%r15)
60    l %r4,0(%r1)
61    l %r3,100(%r15)
62    basr %r14,%r4
63    st %r2,100(%r15)
641:
65#endif
66    ahi %r15,96
67    l %r14,56(%r15)
683: lm %r2,%r5,16(%r15)
69    br %r14
70
71#ifdef CONFIG_FUNCTION_GRAPH_TRACER
72
73    .globl return_to_handler
74return_to_handler:
75    stm %r2,%r5,16(%r15)
76    st %r14,56(%r15)
77    lr %r0,%r15
78    ahi %r15,-96
79    st %r0,__SF_BACKCHAIN(%r15)
80    bras %r1,0f
81    .long ftrace_return_to_handler
820: l %r2,0b-0b(%r1)
83    basr %r14,%r2
84    lr %r14,%r2
85    ahi %r15,96
86    lm %r2,%r5,16(%r15)
87    br %r14
88
89#endif
90

Archive Download this file



interactive