This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: MIPS support for libjava.
Andrew Haley wrote:
David Daney writes:
> Here is a patch against 3.3.1 that adds SIGSEGV handling of
> NullPointerExceptions for a MIPS host. It also contains a custom
> backtrace function as the version we have in our libc is broken.
Greetings.
Do we have copyright assignment papers from you?
I finally mailed them in last week. If you don't already have them, you
should have them soon.
I think you can just call your version backtrace() -- link precedence
will sort out the ordering, so you don't need any heavy configury
changes.
I will try that.
From what I can see, you jump to the magic code that restores some
registers form the signal frame and then that code jumps to
_Jv_MipselThrowNPE.
The unwinder sees that the return address points to the middle of
__sig2exdummy and unwinds from there. The return address of
__sig2exdummy points just after the faulting insn.
That was the general idea.
What I can't quite see is how scratch registers that are destroyed by
the signal handler will be restored. As far as I can see there's
nothing to restore them. $16..$23 are restored, but not $12..$15 or
$31, and the compiler won't expect these to be trashed by a faulting
memory access.
For some reason I thought that -fnon-call-exceptions might take care of
those.
The official way to do this is to define MD_FALLBACK_FRAME_STATE_FOR
in arch/linux.h. See gcc/config/rs6000/linux.h for an example.
I knew there must be a better way, but did not want to start hacking in
the "core" of gcc. Perhaps it is time to revisit that decision.
David.