From: Ralf Baechle <ralf@linux-mips.org>
To: Chris Friesen <cfriesen@nortel.com>
Cc: linux-mips@linux-mips.org
Subject: Re: questions on struct sigcontext
Date: Wed, 12 Dec 2007 18:57:26 +0000 [thread overview]
Message-ID: <20071212185726.GA26190@linux-mips.org> (raw)
In-Reply-To: <47601DEE.4090200@nortel.com>
On Wed, Dec 12, 2007 at 11:44:14AM -0600, Chris Friesen wrote:
> First, I'm not subscribed to the list so I'd appreciate being cc'd on any
> replies.
>
> We have a project getting started with MIPS, and one of the things that
> we're trying to bring in is some exception-handling code that logs various
> information about the ways that apps fail.
>
> In particular, the guys working on this have asked for the STATUS, CAUSE,
> BADVADDR, and FPC_EIR registers to be made available as part of struct
> sigcontext so that they can determine exactly why the app is failing.
The status register doesn't provide useful information about application
problems since it almost exclusivly affects kernel level operation. So
its not exported to userspace.
Cause I agree could occasionally be interesting. Historically the
Linux/MIPS stackframe is derived from the IRIX stackframe. But Linux/MIPS
did never populate the sc_cause field - no debugger or anything was using it.
So eventually the field got recycled for the DSP ASE. The hard part here
is finding place in the stackframe without breaking compatibility - and
there are other users competing ...
C0_badvaddr is available in the si_addr field of struct siginfo.
The FIR register is the "FP Implementation and Revision register" which is
read-only so the same for all processes. A debugger can access it at any
time and there is no need to waste space in the stack frame on it.
> Looking at include/asm-mips/sigcontext.h I can see that these registers
> appear to be in the struct, but are either marked as "unused" or now have
> different names.
>
> Am I correct that these registers are not currently exported to userspace
> on a fault? If this is the case, why not? Does anyone have a patch to
> enable this export?
Be very, very, very careful if you're changing struct siginfo. Applications
know about it. Iow if you change it the wrong way you break binary or
even source compatibility and usually that's in very subtle ways.
(Honestly, I hate our stackframe, especially the 32-bit one which is hell
of overbloated. I *wish* I could just scrap it but its one of those holy
cows - and I don't feel carnivorous enough yet to butcher it ;-)
Ralf
next prev parent reply other threads:[~2007-12-12 18:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-12 17:44 questions on struct sigcontext Chris Friesen
2007-12-12 18:12 ` David Daney
2007-12-12 18:34 ` Chris Friesen
2007-12-12 18:44 ` David Daney
2007-12-12 18:57 ` Ralf Baechle [this message]
2007-12-12 19:00 ` Daniel Jacobowitz
2007-12-12 19:04 ` Ralf Baechle
2007-12-12 23:47 ` Chris Friesen
2007-12-13 0:06 ` David Daney
2007-12-13 15:36 ` Daniel Jacobowitz
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=20071212185726.GA26190@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=cfriesen@nortel.com \
--cc=linux-mips@linux-mips.org \
/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