linux-mips
[Top] [All Lists]

[PATCH 5/9] tracing: MIPS: Fixup of the 32bit support with -mmcount-ra-a

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 5/9] tracing: MIPS: Fixup of the 32bit support with -mmcount-ra-address
From: Wu Zhangjin <wuzhangjin@gmail.com>
Date: Fri, 14 May 2010 19:08:30 +0800
Cc: linux-mips <linux-mips@linux-mips.org>, David Daney <david.s.daney@gmail.com>, Wu Zhangjin <wuzhangjin@gmail.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:in-reply-to:references; bh=slwv/bbbjYCgVQoh39DAkg7F3zvkX2DSoVwGj1DVlS8=; b=MnVkeZFAm4Er3uW/hc4752yp3nQKCXG8Idh1pKK4GSu5IeN2wTzi4BWEmVY/8ofzs2 d0qJ/DprniNJqnl0XXWK2PHeeC1Ib4k0uxTShB4NZwzLLAxZC2SxEbWx+IobPRhtJoTb 6vzr96Pjo0pPbhQet4gA0sQdrz4yOBf7h/rH0=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=x5Z4W6AV/8nKTL3sMgMqskm8PUgZra9OFzlozLq2+v5Bx+dLSmfuyOqPpsXLLpY3MZ ApbVaMyp6RIszgwGQmHu8hrVP+NWBpT9gd+GJsuDuFBihqsYZHcPz17x4khW4BmBcoVr AN68FvJM1J6JhSpXdZwuvDS42Sq9a7ahch+bI=
In-reply-to: <cover.1273834561.git.wuzhangjin@gmail.com>
In-reply-to: <cover.1273834561.git.wuzhangjin@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <cover.1273834561.git.wuzhangjin@gmail.com>
References: <cover.1273834561.git.wuzhangjin@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
From: Wu Zhangjin <wuzhangjin@gmail.com>

For 32bit kernel, the -mmcount-ra-address option of gcc 4.5 has
introduced one more instruction before calling to _mcount, so we need to
use a different "b 1f" for it.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/kernel/ftrace.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index e9e64e0..37aa767 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -62,14 +62,26 @@ int ftrace_make_nop(struct module *mod,
                                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)
                 * addiu v1, v1, low_16bit_of_mcount
                 * move at, ra
                 * jalr v1
-                * nop
-                *                                   1f: (ip + 12)
+                *  nop | move $12, ra_address | sub sp, sp, 8
+                *                                  1: offset = 4 instructions
                 */
                new = 0x10000004;
+#endif
        } else {
                /* record/calculate it for ftrace_make_call */
                if (jal_mcount == 0) {
-- 
1.7.0.4


<Prev in Thread] Current Thread [Next in Thread>