Patch: MIPS support for libjava.

Andrew Haley aph@redhat.com
Tue Sep 9 13:41:00 GMT 2003


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 think you can just call your version backtrace() -- link precedence
will sort out the ordering, so you don't need any heavy configury
changes.


>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.

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.

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.

Andrew.



More information about the Java-patches mailing list