OSDN Git Service

PR target/43742
[pf3gnuchains/gcc-fork.git] / libjava / include / pa-signal.h
1 // pa-signal.h - Catch runtime signals and turn them into exceptions.
2
3 /* Copyright (C) 1998, 1999, 2000, 2009  Free Software Foundation
4
5    This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10
11 #ifndef JAVA_SIGNAL_H
12 #define JAVA_SIGNAL_H 1
13
14 #include <signal.h>
15 #include <sys/syscall.h>
16
17 #define HANDLE_SEGV 1
18 #define HANDLE_FPE 1
19
20 #define SIGNAL_HANDLER(_name)                                           \
21 static void _Jv_##_name (int _dummy __attribute__ ((unused)),           \
22                          siginfo_t *_info __attribute__ ((__unused__)), \
23                          void *arg __attribute__ ((__unused__)))
24
25 #define MAKE_THROW_FRAME(_exception)
26
27 #define INIT_SEGV                                               \
28 do                                                              \
29   {                                                             \
30     struct sigaction act;                                       \
31     act.sa_sigaction = _Jv_catch_segv;                          \
32     sigemptyset (&act.sa_mask);                                 \
33     act.sa_flags = SA_SIGINFO;                                  \
34     syscall (SYS_rt_sigaction, SIGSEGV, &act, NULL, _NSIG / 8); \
35   }                                                             \
36 while (0)  
37
38 #define INIT_FPE                                                \
39 do                                                              \
40   {                                                             \
41     struct sigaction act;                                       \
42     act.sa_sigaction = _Jv_catch_fpe;                           \
43     sigemptyset (&act.sa_mask);                                 \
44     act.sa_flags = SA_SIGINFO;                                  \
45     syscall (SYS_rt_sigaction, SIGFPE, &act, NULL, _NSIG / 8);  \
46   }                                                             \
47 while (0)  
48
49 #endif /* JAVA_SIGNAL_H */