linux-mips
[Top] [All Lists]

Re: Cannot unwind through MIPS signal frames with ICACHE_REFILLS_WORKARO

To: linux-mips@linux-mips.org
Subject: Re: Cannot unwind through MIPS signal frames with ICACHE_REFILLS_WORKAROUND_WAR
From: David Daney <ddaney@avtrex.com>
Date: Tue, 13 Nov 2007 08:12:06 -0800
Cc: Richard Sandiford <rsandifo@nildram.co.uk>, gcc@gcc.gnu.org
In-reply-to: <473957B6.3030202@avtrex.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <473957B6.3030202@avtrex.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.5 (X11/20070727)
David Daney wrote:
With the current kernel (2.6.23.1) in my R5000 based O2 it seems impossible for GCC's exception unwinding machinery to unwind through signal frames. The cause of the problems is the ICACHE_REFILLS_WORKAROUND_WAR which puts the sigcontext at an almost impossible to determine offset from the signal return trampoline. The unwinder depends on being able to find the sigcontext given a known location of the trampoline.

It seems there are a couple of possible solutions:

1) The comments in war.h indicate the problem only exists in R7000 and E9000 processors. We could turn off the workaround if the kernel is configured for R5000. That would help me, but not those with the effected systems.

2) In the non-workaround case, the siginfo immediately follows the trampoline and the first member is the signal number. For the workaround case the first word following the trampoline is zero. We could replace this with the offset to the sigcontext which is always a small negative value. The unwinder could then distinguish the two cases (signal numbers are positive and the offset negative). If we did this, the change would have to be coordinated with GCC's unwinder (in libgcc_s.so.1).

I think I have found a solution that doesn't require kernel changes.

The CFA (i.e. the stack pointer of the signal handler) of the the context when calling mips_fallback_frame_state is at a constant offset from the sigcontext. I can just use the CFA instead of the trampoline's address.

Does this seem plausible?

Thanks,
David Daney

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