OSDN Git Service

ChangeLog:
[pf3gnuchains/gcc-fork.git] / libjava / include / s390-signal.h
1 // s390-signal.h - Catch runtime signals and turn them into exceptions
2 // on an s390 based Linux system.
3
4 /* Copyright (C) 2002  Free Software Foundation
5
6    This file is part of libgcj.
7
8 This software is copyrighted work licensed under the terms of the
9 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
10 details.  */
11
12
13 #ifndef JAVA_SIGNAL_H
14 #define JAVA_SIGNAL_H 1
15
16 #include <signal.h>
17 #include <sys/syscall.h>
18
19 #define HANDLE_SEGV 1
20 #undef HANDLE_FPE
21
22 #define SIGNAL_HANDLER(_name)   \
23 static void _name (int, siginfo_t *, void *)
24
25 /* We no longer need to fiddle with the PSW address in the signal handler;
26    this is now all handled correctly in MD_FALLBACK_FRAME_STATE_FOR.  */
27 #define MAKE_THROW_FRAME(_exception)
28
29
30 /* For an explanation why we cannot simply use sigaction to
31    install the handlers, see i386-signal.h.  */
32
33 /* We use old_kernel_sigaction here because we're calling the kernel
34    directly rather than via glibc.  The sigaction structure that the
35    syscall uses is a different shape from the one in userland and not
36    visible to us in a header file so we define it here.  */
37
38 struct old_s390_kernel_sigaction {
39         void (*k_sa_handler) (int, siginfo_t *, void *);
40         unsigned long k_sa_mask;
41         unsigned long k_sa_flags;
42         void (*sa_restorer) (void);
43 };
44
45 #define INIT_SEGV                                       \
46 do                                                      \
47   {                                                     \
48     struct old_s390_kernel_sigaction kact;              \
49     kact.k_sa_handler = catch_segv;                     \
50     kact.k_sa_mask = 0;                                 \
51     kact.k_sa_flags = SA_SIGINFO;                       \
52     syscall (SYS_sigaction, SIGSEGV, &kact, NULL);      \
53   }                                                     \
54 while (0)  
55
56 #define INIT_FPE                                                \
57 do                                                              \
58   {                                                             \
59     struct old_s390_kernel_sigaction kact;                      \
60     kact.k_sa_handler = catch_fpe;                              \
61     kact.k_sa_mask = 0;                                         \
62     kact.k_sa_flags = SA_SIGINFO;                               \
63     syscall (SYS_sigaction, SIGFPE, &kact, NULL);               \
64   }                                                             \
65 while (0)  
66
67 #endif /* JAVA_SIGNAL_H */
68