Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / include / pa-signal.h
blob0f7c05427ab3424e0919fc4d12e75699282eb487
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
9 details. */
11 #ifndef JAVA_SIGNAL_H
12 #define JAVA_SIGNAL_H 1
14 #include <signal.h>
15 #include <ucontext.h>
16 #include <sys/syscall.h>
18 #define HANDLE_SEGV 1
19 #define HANDLE_FPE 1
21 #define SIGNAL_HANDLER(_name) \
22 static void _Jv_##_name (int _dummy, siginfo_t *_info, void *arg)
24 #define MAKE_THROW_FRAME(_exception) \
25 do \
26 { \
27 struct ucontext *uc = (struct ucontext *)arg; \
28 struct sigcontext *sc = &uc->uc_mcontext; \
29 (void)_dummy; \
30 (void)_info; \
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; \
36 } \
37 while (0)
39 #define INIT_SEGV \
40 do \
41 { \
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); \
47 } \
48 while (0)
50 #define INIT_FPE \
51 do \
52 { \
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); \
58 } \
59 while (0)
61 #endif /* JAVA_SIGNAL_H */