Patch: Fix signal handlers under indirect-dispatch on MIPS

David Daney ddaney@avtrex.com
Thu Jul 20 17:16:00 GMT 2006


Andrew Haley wrote:
> David Daney writes:
>  > For some (as yet unknown) reason on MIPS with -findirect-dispatch, the 
>  > SIGSEGV and SIGFPE signal handlers were not being installed properly. 
>  > This caused the failure of any test case that triggered an 
>  > ArithmeticException or NullPointerException via the signal handling 
>  > mechanism.
> 
> Perhaps the shape of your struct kernel_sigaction was wrong.
> 

I don't think so.  It has been working well without -findirect-dispatch 
for several years on both 2.4 and 2.6 kernels.  The structures in the 
kernel source match what in in include/mips-signal.h

>  > The fix is to call libc's sigaction function instead of trying to trick 
>  > libc by doing a direct system call to the kernel.  Since the MIPS port 
>  > does not need to patch-up and restart any faulting divide instructions, 
>  > the syscall trick is not needed.  This has the added benefit of slightly 
>  > simplifying the code.
>  > 
>  > I guess it is not nice to trick glibc...
> 
> The other reason I did this with a direct syscall rather than a libc
> call was that libc didn't used to be compiled with unwind information,
> so it wasn't possible to unwind through its handlers.
> 

Due to bugs in glibc-2.2.x the current libgcj will not reliably run 
unless you are using glibc-2.3 and later.  Since it has the unwind 
information this patch should be safe.

I am still looking for that official OK.

David Daney



More information about the Java-patches mailing list