]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
MIPS: Tracing: Fix argument passing of the 32bit support with gcc 4.5
authorWu Zhangjin <wuzhangjin@gmail.com>
Fri, 14 May 2010 11:08:29 +0000 (19:08 +0800)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 5 Jul 2010 16:17:28 +0000 (17:17 +0100)
As documented in the GCC 4.5 docs [1] -mmcount-ra-address uses register
$12 to pass the stack offset of the return address to the _mcount function.
On 64-bit kernels $12 is t0 but in 32-bit kernels it is t4 so we need to
use $12 instead of t0 here to be correct for both kernel types.

[1] GCC documentation: MIPS Options
http://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html

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/1227/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/mcount.S

index 9a029d40f6cfe95952ae1f3eb2ad1bd8c0de65e4..6bfcb7a00ec68bb0cc53d1250aed40451787522c 100644 (file)
         move ra, AT
        .endm
 
+/*
+ * The -mmcount-ra-address option of gcc 4.5 uses register $12 to pass
+ * the location of the parent's return address.
+ */
+#define MCOUNT_RA_ADDRESS_REG  $12
+
 #ifdef CONFIG_DYNAMIC_FTRACE
 
 NESTED(ftrace_caller, PT_SIZE, ra)
@@ -70,7 +76,7 @@ _mcount:
 
        MCOUNT_SAVE_REGS
 #ifdef KBUILD_MCOUNT_RA_ADDRESS
-       PTR_S   t0, PT_R12(sp)  /* save location of parent's return address */
+       PTR_S   MCOUNT_RA_ADDRESS_REG, PT_R12(sp)
 #endif
 
        move    a0, ra          /* arg1: self return address */
@@ -142,9 +148,9 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra)
 #ifdef CONFIG_DYNAMIC_FTRACE
        PTR_L   a0, PT_R12(sp)
 #else
-       move    a0, t0
+       move    a0, MCOUNT_RA_ADDRESS_REG
 #endif
-       bnez    a0, 1f          /* non-leaf func: stored in t0 */
+       bnez    a0, 1f  /* non-leaf func: stored in MCOUNT_RA_ADDRESS_REG */
         nop
 #endif
        PTR_LA  a0, PT_R1(sp)   /* leaf func: the location in current stack */