linux-mips
[Top] [All Lists]

Re: [PATCH 7/7] Allow unwind_stack() to return ra for leaf function

To: vagabon.xyz@gmail.com
Subject: Re: [PATCH 7/7] Allow unwind_stack() to return ra for leaf function
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Wed, 02 Aug 2006 20:25:40 +0900 (JST)
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org
In-reply-to: <44D07C97.2040008@innova-card.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <cda58cb80608011238q5b0e0eacje28f921d6e1c7700@mail.gmail.com> <20060802.105126.88700874.nemoto@toshiba-tops.co.jp> <44D07C97.2040008@innova-card.com>
Sender: linux-mips-bounce@linux-mips.org
On Wed, 02 Aug 2006 12:21:11 +0200, Franck Bui-Huu <vagabon.xyz@gmail.com> 
wrote:
> does something like this on top of this patch make you feel better ?
> 
> -- >8 --
> 
> diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
> index 4ceddfa..8a9db45 100644
> --- a/arch/mips/kernel/process.c
> +++ b/arch/mips/kernel/process.c
> @@ -480,7 +480,13 @@ unsigned long unwind_stack(struct task_s
>               return 0;
>  
>       if (leaf)
> -             pc = regs->regs[31];
> +             /*
> +              * For some extreme cases, get_frame_info() can
> +              * consider wrongly a nested function as a leaf
> +              * one. In that cases avoid to return always the
> +              * same value.
> +              */
> +             pc = pc != regs->regs[31] ? regs->regs[31] : 0;

Yes, it should be safe.  But still I'm not sure unwind_stack() should
take "regs" as its argument...

---
Atsushi Nemoto

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