diff options
Diffstat (limited to 'arch/arm/kernel/entry-common.S')
-rw-r--r-- | arch/arm/kernel/entry-common.S | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 597ed00a08d8..84694e88b428 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <asm/unistd.h> | 11 | #include <asm/unistd.h> |
12 | #include <asm/ftrace.h> | ||
12 | #include <asm/arch/entry-macro.S> | 13 | #include <asm/arch/entry-macro.S> |
13 | 14 | ||
14 | #include "entry-header.S" | 15 | #include "entry-header.S" |
@@ -99,6 +100,56 @@ ENTRY(ret_from_fork) | |||
99 | #undef CALL | 100 | #undef CALL |
100 | #define CALL(x) .long x | 101 | #define CALL(x) .long x |
101 | 102 | ||
103 | #ifdef CONFIG_FTRACE | ||
104 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
105 | ENTRY(mcount) | ||
106 | stmdb sp!, {r0-r3, lr} | ||
107 | mov r0, lr | ||
108 | sub r0, r0, #MCOUNT_INSN_SIZE | ||
109 | |||
110 | .globl mcount_call | ||
111 | mcount_call: | ||
112 | bl ftrace_stub | ||
113 | ldmia sp!, {r0-r3, pc} | ||
114 | |||
115 | ENTRY(ftrace_caller) | ||
116 | stmdb sp!, {r0-r3, lr} | ||
117 | ldr r1, [fp, #-4] | ||
118 | mov r0, lr | ||
119 | sub r0, r0, #MCOUNT_INSN_SIZE | ||
120 | |||
121 | .globl ftrace_call | ||
122 | ftrace_call: | ||
123 | bl ftrace_stub | ||
124 | ldmia sp!, {r0-r3, pc} | ||
125 | |||
126 | #else | ||
127 | |||
128 | ENTRY(mcount) | ||
129 | stmdb sp!, {r0-r3, lr} | ||
130 | ldr r0, =ftrace_trace_function | ||
131 | ldr r2, [r0] | ||
132 | adr r0, ftrace_stub | ||
133 | cmp r0, r2 | ||
134 | bne trace | ||
135 | ldmia sp!, {r0-r3, pc} | ||
136 | |||
137 | trace: | ||
138 | ldr r1, [fp, #-4] | ||
139 | mov r0, lr | ||
140 | sub r0, r0, #MCOUNT_INSN_SIZE | ||
141 | mov lr, pc | ||
142 | mov pc, r2 | ||
143 | ldmia sp!, {r0-r3, pc} | ||
144 | |||
145 | #endif /* CONFIG_DYNAMIC_FTRACE */ | ||
146 | |||
147 | .globl ftrace_stub | ||
148 | ftrace_stub: | ||
149 | mov pc, lr | ||
150 | |||
151 | #endif /* CONFIG_FTRACE */ | ||
152 | |||
102 | /*============================================================================= | 153 | /*============================================================================= |
103 | * SWI handler | 154 | * SWI handler |
104 | *----------------------------------------------------------------------------- | 155 | *----------------------------------------------------------------------------- |