aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/entry-common.S
diff options
context:
space:
mode:
authorRabin Vincent <rabin@rab.in>2010-08-10 14:37:21 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-09-02 10:26:12 -0400
commita3ba87a614992500cf2c47e6f788e74a971ce91f (patch)
tree5b644570cf2d93e6216a0c308e1fbf72efda2913 /arch/arm/kernel/entry-common.S
parent72fa62fa5dff0e2e06491dd99c429adb137f299b (diff)
ARM: 6316/1: ftrace: add Thumb-2 support
Fix the mcount routines to build and run on a kernel built with the Thumb-2 instruction set by correcting the following errors using the fixes suggested by Catalin Marinas: - Problem: The following assembler errors appear at the "adr r0, ftrace_stub" instruction: entry-common.S: Assembler messages: entry-common.S:179: Error: invalid immediate for address calculation (value = 0x00000004) Fix: The errors don't occur with a non-global symbol, so use one. - Problem: The "mov lr, pc" does not set the lsb when storing the pc in lr. The called function returns with "bx lr", and the mode changes to ARM. Fix: Add a label on the return address and use "adr lr, BSYM(label)". We don't modify the old mcount because it won't be built when using Thumb-2. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/entry-common.S')
-rw-r--r--arch/arm/kernel/entry-common.S6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index c7a8c208a45c..f5e75de0203e 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -167,7 +167,7 @@ ENTRY(__gnu_mcount_nc)
167 stmdb sp!, {r0-r3, lr} 167 stmdb sp!, {r0-r3, lr}
168 ldr r0, =ftrace_trace_function 168 ldr r0, =ftrace_trace_function
169 ldr r2, [r0] 169 ldr r2, [r0]
170 adr r0, ftrace_stub 170 adr r0, .Lftrace_stub
171 cmp r0, r2 171 cmp r0, r2
172 bne gnu_trace 172 bne gnu_trace
173 ldmia sp!, {r0-r3, ip, lr} 173 ldmia sp!, {r0-r3, ip, lr}
@@ -177,8 +177,9 @@ gnu_trace:
177 ldr r1, [sp, #20] @ lr of instrumented routine 177 ldr r1, [sp, #20] @ lr of instrumented routine
178 mov r0, lr 178 mov r0, lr
179 sub r0, r0, #MCOUNT_INSN_SIZE 179 sub r0, r0, #MCOUNT_INSN_SIZE
180 mov lr, pc 180 adr lr, BSYM(1f)
181 mov pc, r2 181 mov pc, r2
1821:
182 ldmia sp!, {r0-r3, ip, lr} 183 ldmia sp!, {r0-r3, ip, lr}
183 mov pc, ip 184 mov pc, ip
184ENDPROC(__gnu_mcount_nc) 185ENDPROC(__gnu_mcount_nc)
@@ -213,6 +214,7 @@ ENDPROC(mcount)
213#endif /* CONFIG_DYNAMIC_FTRACE */ 214#endif /* CONFIG_DYNAMIC_FTRACE */
214 215
215ENTRY(ftrace_stub) 216ENTRY(ftrace_stub)
217.Lftrace_stub:
216 mov pc, lr 218 mov pc, lr
217ENDPROC(ftrace_stub) 219ENDPROC(ftrace_stub)
218 220