]>
Commit | Line | Data |
---|---|---|
68bfb94e AT |
1 | /* hppa-signal.h - Catch runtime signals and turn them into exceptions, |
2 | on a HP-UX 11 PA system. */ | |
3 | ||
4 | /* Copyright (C) 2006 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 | /* This file is really more of a specification. The rest of the system | |
13 | should be arranged so that this Just Works. */ | |
14 | ||
15 | #ifndef JAVA_SIGNAL_H | |
16 | # define JAVA_SIGNAL_H 1 | |
17 | ||
18 | #include <sys/types.h> | |
19 | #include <signal.h> | |
20 | #include <sys/syscall.h> | |
21 | #include <unistd.h> | |
22 | ||
23 | # define HANDLE_SEGV 1 | |
24 | # undef HANDLE_FPE | |
25 | ||
26 | #define SIGNAL_HANDLER(_name) \ | |
27 | static void _name (int _dummy __attribute__ ((unused)), \ | |
28 | siginfo_t *_info __attribute__ ((__unused__)), \ | |
29 | void *arg __attribute__ ((__unused__))) | |
30 | ||
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)); \ | |
46 | \ | |
47 | } \ | |
48 | while (0) | |
49 | ||
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) | |
58 | ||
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) | |
67 | ||
68 | #endif /* JAVA_SIGNAL_H */ |