diff options
Diffstat (limited to 'arch/arm/kernel/entry-common.S')
-rw-r--r-- | arch/arm/kernel/entry-common.S | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 520889cf1b5b..9fd0ba90c1d2 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -149,6 +149,11 @@ ENDPROC(ret_from_fork) | |||
149 | #endif | 149 | #endif |
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | .macro mcount_adjust_addr rd, rn | ||
153 | bic \rd, \rn, #1 @ clear the Thumb bit if present | ||
154 | sub \rd, \rd, #MCOUNT_INSN_SIZE | ||
155 | .endm | ||
156 | |||
152 | .macro __mcount suffix | 157 | .macro __mcount suffix |
153 | mcount_enter | 158 | mcount_enter |
154 | ldr r0, =ftrace_trace_function | 159 | ldr r0, =ftrace_trace_function |
@@ -173,8 +178,7 @@ ENDPROC(ret_from_fork) | |||
173 | mcount_exit | 178 | mcount_exit |
174 | 179 | ||
175 | 1: mcount_get_lr r1 @ lr of instrumented func | 180 | 1: mcount_get_lr r1 @ lr of instrumented func |
176 | mov r0, lr @ instrumented function | 181 | mcount_adjust_addr r0, lr @ instrumented function |
177 | sub r0, r0, #MCOUNT_INSN_SIZE | ||
178 | adr lr, BSYM(2f) | 182 | adr lr, BSYM(2f) |
179 | mov pc, r2 | 183 | mov pc, r2 |
180 | 2: mcount_exit | 184 | 2: mcount_exit |
@@ -184,8 +188,7 @@ ENDPROC(ret_from_fork) | |||
184 | mcount_enter | 188 | mcount_enter |
185 | 189 | ||
186 | mcount_get_lr r1 @ lr of instrumented func | 190 | mcount_get_lr r1 @ lr of instrumented func |
187 | mov r0, lr @ instrumented function | 191 | mcount_adjust_addr r0, lr @ instrumented function |
188 | sub r0, r0, #MCOUNT_INSN_SIZE | ||
189 | 192 | ||
190 | .globl ftrace_call\suffix | 193 | .globl ftrace_call\suffix |
191 | ftrace_call\suffix: | 194 | ftrace_call\suffix: |
@@ -205,11 +208,11 @@ ftrace_graph_call\suffix: | |||
205 | #ifdef CONFIG_DYNAMIC_FTRACE | 208 | #ifdef CONFIG_DYNAMIC_FTRACE |
206 | @ called from __ftrace_caller, saved in mcount_enter | 209 | @ called from __ftrace_caller, saved in mcount_enter |
207 | ldr r1, [sp, #16] @ instrumented routine (func) | 210 | ldr r1, [sp, #16] @ instrumented routine (func) |
211 | mcount_adjust_addr r1, r1 | ||
208 | #else | 212 | #else |
209 | @ called from __mcount, untouched in lr | 213 | @ called from __mcount, untouched in lr |
210 | mov r1, lr @ instrumented routine (func) | 214 | mcount_adjust_addr r1, lr @ instrumented routine (func) |
211 | #endif | 215 | #endif |
212 | sub r1, r1, #MCOUNT_INSN_SIZE | ||
213 | mov r2, fp @ frame pointer | 216 | mov r2, fp @ frame pointer |
214 | bl prepare_ftrace_return | 217 | bl prepare_ftrace_return |
215 | mcount_exit | 218 | mcount_exit |