1 // pa-signal.h - Catch runtime signals and turn them into exceptions.
3 /* Copyright (C) 1998, 1999, 2000 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
12 #define JAVA_SIGNAL_H 1
16 #include <sys/syscall.h>
21 #define SIGNAL_HANDLER(_name) \
22 static void _Jv_##_name (int _dummy, siginfo_t *_info, void *arg)
24 #define MAKE_THROW_FRAME(_exception) \
27 struct ucontext *uc = (struct ucontext *)arg; \
28 struct sigcontext *sc = &uc->uc_mcontext; \
31 /* Advance the program counter so that it is after the start \
32 of the instruction: the exception handler expects \
33 the PC to point to the instruction after a call. */ \
34 sc->sc_iaoq[0] = sc->sc_iaoq[1]; \
35 sc->sc_iaoq[1] += 4; \
42 struct sigaction act; \
43 act.sa_sigaction = _Jv_catch_segv; \
44 sigemptyset (&act.sa_mask); \
45 act.sa_flags = SA_SIGINFO; \
46 syscall (SYS_rt_sigaction, SIGSEGV, &act, NULL, _NSIG / 8); \
53 struct sigaction act; \
54 act.sa_sigaction = _Jv_catch_fpe; \
55 sigemptyset (&act.sa_mask); \
56 act.sa_flags = SA_SIGINFO; \
57 syscall (SYS_rt_sigaction, SIGFPE, &act, NULL, _NSIG / 8); \
61 #endif /* JAVA_SIGNAL_H */