Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: David Daney <david.s.daney@gmail.com>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH 2/9] tracing: MIPS: mcount.S: Fixup of the 32bit support with gcc 4.5
Date: Wed, 12 May 2010 10:16:16 -0700	[thread overview]
Message-ID: <4BEAE260.9060805@gmail.com> (raw)
In-Reply-To: <fd8a13e37a33c1075da184f4fe92b0d9afc51c09.1273669419.git.wuzhangjin@gmail.com>

On 05/12/2010 06:23 AM, Wu Zhangjin wrote:
> From: Wu Zhangjin<wuzhangjin@gmail.com>
>
> As the doc[1] of gcc-4.5 shows, the -mmcount-ra-address uses register
> $12 to transfer the stack offset of the return address to the _mcount
> function. in 64bit kernel, $12 is t0, but in 32bit kernel, it is t4, so,
> we need to use $12 instead of t0 here to cover the 64bit and 32bit
> support.
>
> [1] Gcc doc: MIPS Options
> http://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html
>
> Signed-off-by: Wu Zhangjin<wuzhangjin@gmail.com>

Would it be better to do?:

#define MCOUNT_RA_ADDRESS_REG $12

s/t0/MCOUNT_RA_ADDRESS_REG/g

David Daney

> ---
>   arch/mips/kernel/mcount.S |   10 +++++-----
>   1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
> index e256bf9..92d1540 100644
> --- a/arch/mips/kernel/mcount.S
> +++ b/arch/mips/kernel/mcount.S
> @@ -69,7 +69,7 @@ _mcount:
>
>   	MCOUNT_SAVE_REGS
>   #ifdef KBUILD_MCOUNT_RA_ADDRESS
> -	PTR_S	t0, PT_R12(sp)	/* t0 saved the location of the return address(at) by -mmcount-ra-address */
> +	PTR_S	$12, PT_R12(sp)	/* $12 saved the location of the return address(at) by -mmcount-ra-address */
>   #endif
>
>   	move	a0, ra		/* arg1: next ip, selfaddr */
> @@ -135,7 +135,7 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra)
>   #ifdef CONFIG_DYNAMIC_FTRACE
>   	PTR_L	a1, PT_R31(sp)	/* load the original ra from the stack */
>   #ifdef KBUILD_MCOUNT_RA_ADDRESS
> -	PTR_L	t0, PT_R12(sp)	/* load the original t0 from the stack */
> +	PTR_L	$12, PT_R12(sp)	/* load the original $12 from the stack */
>   #endif
>   #else
>   	MCOUNT_SAVE_REGS
> @@ -143,10 +143,10 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra)
>   #endif
>
>   #ifdef KBUILD_MCOUNT_RA_ADDRESS
> -	bnez	t0, 1f		/* non-leaf func: t0 saved the location of the return address */
> +	bnez	$12, 1f		/* non-leaf func: $12 saved the location of the return address */
>   	 nop
> -	PTR_LA	t0, PT_R1(sp)	/* leaf func: get the location of at(old ra) from our own stack */
> -1:	move	a0, t0		/* arg1: the location of the return address */
> +	PTR_LA	$12, PT_R1(sp)	/* leaf func: get the location of at(old ra) from our own stack */
> +1:	move	a0, $12		/* arg1: the location of the return address */
>   #else
>   	PTR_LA	a0, PT_R1(sp)	/* arg1:&AT ->  a0 */
>   #endif

  reply	other threads:[~2010-05-12 17:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 13:23 [PATCH v6 0/9] tracing: MIPS: add misc fixups and cleanups Wu Zhangjin
2010-05-12 13:23 ` [PATCH 1/9] tracing: MIPS: mcount.S: merge the same continuous #ifdefs Wu Zhangjin
2010-05-12 13:23 ` [PATCH 2/9] tracing: MIPS: mcount.S: Fixup of the 32bit support with gcc 4.5 Wu Zhangjin
2010-05-12 17:16   ` David Daney [this message]
2010-05-13  1:35     ` Wu Zhangjin
2010-05-12 13:23 ` [PATCH 3/9] tracing: MIPS: mcount.S: cleanup the arguments of prepare_ftrace_return Wu Zhangjin
2010-05-12 13:23 ` [PATCH 4/9] tracing: MIPS: mcount.S: cleanup of the comments Wu Zhangjin
2010-05-12 13:23 ` [PATCH 5/9] tracing: MIPS: Fixup of the 32bit support with -mmcount-ra-address Wu Zhangjin
2010-05-12 13:23 ` [PATCH 6/9] tracing: MIPS: cleanup of the instructions Wu Zhangjin
2010-05-12 13:23 ` [PATCH 7/9] tracing: MIPS: Reduce the overhead of dynamic Function Tracer Wu Zhangjin
2010-05-12 13:23 ` [PATCH 8/9] tracing: MIPS: cleanup of function graph tracer Wu Zhangjin
2010-05-12 13:23 ` [PATCH 9/9] tracing: MIPS: cleanup of the address space checking Wu Zhangjin
2010-05-12 17:13   ` David Daney
2010-05-13  2:19     ` Wu Zhangjin
2010-05-13 16:13     ` Ralf Baechle
2010-05-13 16:17       ` David Daney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BEAE260.9060805@gmail.com \
    --to=david.s.daney@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=wuzhangjin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox