PR c++/5247
[official-gcc.git] / libjava / include / hppa-signal.h
blobac4cac5a5bbefc375871c8ea8efbc364a469c584
1 /* hppa-signal.h - Catch runtime signals and turn them into exceptions,
2 on a HP-UX 11 PA system. */
4 /* Copyright (C) 2006 Free Software Foundation
6 This file is part of libgcj.
8 This software is copyrighted work licensed under the terms of the
9 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
10 details. */
12 /* This file is really more of a specification. The rest of the system
13 should be arranged so that this Just Works. */
15 #ifndef JAVA_SIGNAL_H
16 # define JAVA_SIGNAL_H 1
18 #include <sys/types.h>
19 #include <signal.h>
20 #include <sys/syscall.h>
21 #include <unistd.h>
23 # define HANDLE_SEGV 1
24 # undef HANDLE_FPE
26 #define SIGNAL_HANDLER(_name) \
27 static void _name (int _dummy __attribute__ ((unused)), \
28 siginfo_t *_info __attribute__ ((__unused__)), \
29 void *arg __attribute__ ((__unused__)))
31 #define MAKE_THROW_FRAME(_exception) \
32 do \
33 { \
34 ucontext_t *_context = (ucontext_t *) arg; \
35 (void)_dummy; \
36 (void)_info; \
37 mcontext_t *mc = &(_context->uc_mcontext); \
38 SetSSReg (mc, ss_pcoq_head, GetSSReg (mc, ss_pcoq_tail)); \
39 SetSSReg (mc, ss_pcsq_head, GetSSReg (mc, ss_pcsq_tail)); \
40 /* This part is not quit right if the head pc was pointing \
41 at a branch. The tail needs to be adjusted to the branch \
42 target if the branch is taken. The tail space register \
43 may need adjustment as well if the branch is an interspace \
44 branch. */ \
45 SetSSReg (mc, ss_pcoq_tail, (GetSSReg (mc, ss_pcoq_tail) + 4)); \
47 } \
48 while (0)
50 # define INIT_SEGV \
51 do { \
52 struct sigaction sa; \
53 sa.sa_sigaction = catch_segv; \
54 sigemptyset (&sa.sa_mask); \
55 sa.sa_flags = SA_SIGINFO | SA_NODEFER; \
56 sigaction (SIGSEGV, &sa, NULL); \
57 } while (0)
59 # define INIT_FPE \
60 do { \
61 struct sigaction sa; \
62 sa.sa_sigaction = catch_fpe; \
63 sigemptyset (&sa.sa_mask); \
64 sa.sa_flags = SA_SIGINFO | SA_NODEFER; \
65 sigaction (SIGFPE, &sa, NULL); \
66 } while (0)
68 #endif /* JAVA_SIGNAL_H */