linux-mips
[Top] [All Lists]

Re: unwind_stack() and an exception at the last instruction (after the e

To: dmitry.adamushko@gmail.com
Subject: Re: unwind_stack() and an exception at the last instruction (after the epilogue)
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Thu, 14 Dec 2006 01:16:51 +0900 (JST)
Cc: ths@networkno.de, ralf@linux-mips.org, linux-mips@linux-mips.org
In-reply-to: <b647ffbd0612130640r10bedda5l491679df882fe2e@mail.gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <b647ffbd0612130445r14895d70p4ea313f94dee8b41@mail.gmail.com> <20061213135222.GB25904@networkno.de> <b647ffbd0612130640r10bedda5l491679df882fe2e@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
On Wed, 13 Dec 2006 15:40:21 +0100, "Dmitry Adamushko" 
<dmitry.adamushko@gmail.com> wrote:
> e.g. as we know the start and end address of the function
> (ksyms_lookup_size_off()), it's possible to find out a position of the
> "prologue" and "epilogue" (addiu sp,sp,SIZE - the same way it's done
> in get_frame_info()) so we would know:
> 
> function_start (1), prologue_addr (2), epilogue_addr (3), function_end (4)
> 
> and this would cover the (broken) cases when <epc> is in [1, 2] or [3, 4]
> as well as the cases when e.g. <sp> is broken in the prologue ?

It would be hard because:

* A function can have multiple epilogues.
* gcc often moves "if" block codes to end of the function.

While current unwind_stack() is not perfect, any attempt to make it
robust is welcome.  But you might have to analyze _all_ code if you
wanted to save _all_ case.  I think UNIX's "90% principle" is good
enough here.

BTW, enqueue_task() will not use stack anymore since
SCHED_NO_NO_OMIT_FRAME_POINTER is defined.

---
Atsushi Nemoto

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