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>
This commit is contained in:
Wu Zhangjin 2010-05-14 19:08:30 +08:00 коммит произвёл Ralf Baechle
Родитель 56b49cd35f
Коммит 3a2af2dc1b
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -62,14 +62,26 @@ int ftrace_make_nop(struct module *mod,
return -EFAULT; return -EFAULT;
} }
#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
/* lui v1, hi_16bit_of_mcount --> b 1f (0x10000005)
* addiu v1, v1, low_16bit_of_mcount
* move at, ra
* move $12, ra_address
* jalr v1
* sub sp, sp, 8
* 1: offset = 5 instructions
*/
new = 0x10000005;
#else
/* lui v1, hi_16bit_of_mcount --> b 1f (0x10000004) /* lui v1, hi_16bit_of_mcount --> b 1f (0x10000004)
* addiu v1, v1, low_16bit_of_mcount * addiu v1, v1, low_16bit_of_mcount
* move at, ra * move at, ra
* jalr v1 * jalr v1
* nop * nop | move $12, ra_address | sub sp, sp, 8
* 1f: (ip + 12) * 1: offset = 4 instructions
*/ */
new = 0x10000004; new = 0x10000004;
#endif
} else { } else {
/* record/calculate it for ftrace_make_call */ /* record/calculate it for ftrace_make_call */
if (jal_mcount == 0) { if (jal_mcount == 0) {