aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorWu Zhangjin <wuzhangjin@gmail.com>2010-05-14 07:08:30 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-07-05 12:17:28 -0400
commit3a2af2dc1bcbfe86b1f39e9e5f9c2c5447943f16 (patch)
tree3c94d93dadcf93ffea7881a7ba0e5a84bda355a3 /arch/mips
parent56b49cd35fd56e29adb8f97ba051a1670d24d133 (diff)
MIPS: Tracing: Fix 32-bit support with -mmcount-ra-address
For 32-bit kernel the -mmcount-ra-address option of gcc 4.5 emits one extra instruction before calling to _mcount so we need to use a different "b 1f" for it. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Cc: linux-mips <linux-mips@linux-mips.org> Cc: David Daney <david.s.daney@gmail.com> Patchwork: http://patchwork.linux-mips.org/patch/1228/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/ftrace.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index e9e64e0ff7a..37aa7677e76 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -62,14 +62,26 @@ int ftrace_make_nop(struct module *mod,
62 return -EFAULT; 62 return -EFAULT;
63 } 63 }
64 64
65#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
66 /* lui v1, hi_16bit_of_mcount --> b 1f (0x10000005)
67 * addiu v1, v1, low_16bit_of_mcount
68 * move at, ra
69 * move $12, ra_address
70 * jalr v1
71 * sub sp, sp, 8
72 * 1: offset = 5 instructions
73 */
74 new = 0x10000005;
75#else
65 /* lui v1, hi_16bit_of_mcount --> b 1f (0x10000004) 76 /* lui v1, hi_16bit_of_mcount --> b 1f (0x10000004)
66 * addiu v1, v1, low_16bit_of_mcount 77 * addiu v1, v1, low_16bit_of_mcount
67 * move at, ra 78 * move at, ra
68 * jalr v1 79 * jalr v1
69 * nop 80 * nop | move $12, ra_address | sub sp, sp, 8
70 * 1f: (ip + 12) 81 * 1: offset = 4 instructions
71 */ 82 */
72 new = 0x10000004; 83 new = 0x10000004;
84#endif
73 } else { 85 } else {
74 /* record/calculate it for ftrace_make_call */ 86 /* record/calculate it for ftrace_make_call */
75 if (jal_mcount == 0) { 87 if (jal_mcount == 0) {