1 // mips-signal.h - Catch runtime signals and turn them into exceptions
2 // on an mips based Linux system.
4 /* Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2006
5 Free Software Foundation
7 This file is part of libgcj.
9 This software is copyrighted work licensed under the terms of the
10 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
13 /* Adapted from sparc-signal.h and powerpc-signal.h
14 by David Daney <ddaney@avtrex.com> */
17 #define JAVA_SIGNAL_H 1
21 #include <sys/syscall.h>
22 /* #include <asm/ucontext.h> structures we use are here but clash with
23 sys/ucontext.h included by java-signal.h from prims.cc */
28 /* The third parameter to the signal handler points to something with
29 * this structure defined in asm/ucontext.h, but the name clashes with
30 * struct ucontext from sys/ucontext.h so this private copy is used. */
31 typedef struct _sig_ucontext
{
32 unsigned long uc_flags
;
33 struct _sig_ucontext
*uc_link
;
35 struct sigcontext uc_mcontext
;
39 #define SIGNAL_HANDLER(_name) \
40 static void _name (int _dummy __attribute__ ((__unused__)), \
41 siginfo_t *_info __attribute__ ((__unused__)), \
42 void *_arg __attribute__ ((__unused__)))
45 * MIPS leaves pc pointing at the faulting instruction, but the
46 * unwinder expects it to point to the following instruction
49 #define MAKE_THROW_FRAME(_exception) \
52 ((sig_ucontext_t *)_arg)->uc_mcontext.sc_pc += 4; \
61 struct sigaction act; \
62 act.sa_sigaction = catch_segv; \
63 act.sa_flags = SA_SIGINFO | SA_NODEFER; \
64 sigemptyset (&act.sa_mask); \
65 sigaction(SIGSEGV, &act, NULL); \
72 struct sigaction act; \
73 act.sa_sigaction = catch_fpe; \
74 act.sa_flags = SA_SIGINFO | SA_NODEFER; \
75 sigemptyset (&act.sa_mask); \
76 sigaction(SIGFPE, &act, NULL); \
80 #undef HANDLE_DIVIDE_OVERFLOW
82 #endif /* JAVA_SIGNAL_H */