entry-common.S (a3ba87a614992500cf2c47e6f788e74a971ce91f) entry-common.S (3b6c223b1b97ad60bbb0f4efda57d649414ac2a2)
1/*
2 * linux/arch/arm/kernel/entry-common.S
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

--- 113 unchanged lines hidden (view full) ---

122 *
123 * mcount can be thought of as a function called in the middle of a subroutine
124 * call. As such, it needs to be transparent for both the caller and the
125 * callee: the original lr needs to be restored when leaving mcount, and no
126 * registers should be clobbered. (In the __gnu_mcount_nc implementation, we
127 * clobber the ip register. This is OK because the ARM calling convention
128 * allows it to be clobbered in subroutines and doesn't use it to hold
129 * parameters.)
1/*
2 * linux/arch/arm/kernel/entry-common.S
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

--- 113 unchanged lines hidden (view full) ---

122 *
123 * mcount can be thought of as a function called in the middle of a subroutine
124 * call. As such, it needs to be transparent for both the caller and the
125 * callee: the original lr needs to be restored when leaving mcount, and no
126 * registers should be clobbered. (In the __gnu_mcount_nc implementation, we
127 * clobber the ip register. This is OK because the ARM calling convention
128 * allows it to be clobbered in subroutines and doesn't use it to hold
129 * parameters.)
130 *
131 * When using dynamic ftrace, we patch out the mcount call by a "mov r0, r0"
132 * for the mcount case, and a "pop {lr}" for the __gnu_mcount_nc case (see
133 * arch/arm/kernel/ftrace.c).
130 */
131
132#ifndef CONFIG_OLD_MCOUNT
133#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
134#error Ftrace requires CONFIG_FRAME_POINTER=y with GCC older than 4.4.0.
135#endif
136#endif
137
138#ifdef CONFIG_DYNAMIC_FTRACE
134 */
135
136#ifndef CONFIG_OLD_MCOUNT
137#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
138#error Ftrace requires CONFIG_FRAME_POINTER=y with GCC older than 4.4.0.
139#endif
140#endif
141
142#ifdef CONFIG_DYNAMIC_FTRACE
139ENTRY(mcount)
143ENTRY(__gnu_mcount_nc)
144 mov ip, lr
145 ldmia sp!, {lr}
146 mov pc, ip
147ENDPROC(__gnu_mcount_nc)
148
149ENTRY(ftrace_caller)
140 stmdb sp!, {r0-r3, lr}
141 mov r0, lr
142 sub r0, r0, #MCOUNT_INSN_SIZE
150 stmdb sp!, {r0-r3, lr}
151 mov r0, lr
152 sub r0, r0, #MCOUNT_INSN_SIZE
153 ldr r1, [sp, #20]
143
154
144 .globl mcount_call
145mcount_call:
155 .global ftrace_call
156ftrace_call:
146 bl ftrace_stub
157 bl ftrace_stub
147 ldr lr, [fp, #-4] @ restore lr
148 ldmia sp!, {r0-r3, pc}
158 ldmia sp!, {r0-r3, ip, lr}
159 mov pc, ip
160ENDPROC(ftrace_caller)
161
162#ifdef CONFIG_OLD_MCOUNT
163ENTRY(mcount)
164 stmdb sp!, {lr}
165 ldr lr, [fp, #-4]
166 ldmia sp!, {pc}
149ENDPROC(mcount)
150
167ENDPROC(mcount)
168
151ENTRY(ftrace_caller)
169ENTRY(ftrace_caller_old)
152 stmdb sp!, {r0-r3, lr}
153 ldr r1, [fp, #-4]
154 mov r0, lr
155 sub r0, r0, #MCOUNT_INSN_SIZE
156
170 stmdb sp!, {r0-r3, lr}
171 ldr r1, [fp, #-4]
172 mov r0, lr
173 sub r0, r0, #MCOUNT_INSN_SIZE
174
157 .globl ftrace_call
158ftrace_call:
175 .globl ftrace_call_old
176ftrace_call_old:
159 bl ftrace_stub
160 ldr lr, [fp, #-4] @ restore lr
161 ldmia sp!, {r0-r3, pc}
177 bl ftrace_stub
178 ldr lr, [fp, #-4] @ restore lr
179 ldmia sp!, {r0-r3, pc}
162ENDPROC(ftrace_caller)
180ENDPROC(ftrace_caller_old)
181#endif
163
164#else
165
166ENTRY(__gnu_mcount_nc)
167 stmdb sp!, {r0-r3, lr}
168 ldr r0, =ftrace_trace_function
169 ldr r2, [r0]
170 adr r0, .Lftrace_stub

--- 363 unchanged lines hidden ---
182
183#else
184
185ENTRY(__gnu_mcount_nc)
186 stmdb sp!, {r0-r3, lr}
187 ldr r0, =ftrace_trace_function
188 ldr r2, [r0]
189 adr r0, .Lftrace_stub

--- 363 unchanged lines hidden ---