OSDN Git Service

* jvmti.cc (_Jv_JVMTI_DisposeEnvironment): Check for enabled
[pf3gnuchains/gcc-fork.git] / libjava / include / mips-signal.h
1 // mips-signal.h - Catch runtime signals and turn them into exceptions
2 // on an mips based Linux system. 
3
4 /* Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2006
5    Free Software Foundation
6
7    This file is part of libgcj.
8
9 This software is copyrighted work licensed under the terms of the
10 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
11 details.  */
12
13 /* Adapted from sparc-signal.h and powerpc-signal.h
14    by David Daney <ddaney@avtrex.com> */
15
16 #ifndef JAVA_SIGNAL_H
17 #define JAVA_SIGNAL_H 1
18
19 #include <signal.h>
20 #include <unistd.h>
21 #include <sys/syscall.h>
22 /* #include <asm/ucontext.h> structures we use are here but clash with
23    sys/ucontext.h included by java-signal.h from prims.cc */
24
25 #define HANDLE_SEGV 1
26 #define HANDLE_FPE 1
27
28 /* The third parameter to the signal handler points to something with
29  * this structure defined in asm/ucontext.h, but the name clashes with
30  * struct ucontext from sys/ucontext.h so this private copy is used. */
31 typedef struct _sig_ucontext {
32     unsigned long         uc_flags;
33     struct _sig_ucontext  *uc_link;
34     stack_t               uc_stack;
35     struct sigcontext uc_mcontext;
36     sigset_t      uc_sigmask;
37 } sig_ucontext_t;
38
39 #define SIGNAL_HANDLER(_name) \
40 static void _name (int _dummy __attribute__ ((__unused__)), \
41                    siginfo_t *_info __attribute__ ((__unused__)), \
42                    void *_arg __attribute__ ((__unused__)))
43
44 /*
45  *  MIPS leaves pc pointing at the faulting instruction, but the
46  *  unwinder expects it to point to the following instruction
47  */
48
49 #define MAKE_THROW_FRAME(_exception) \
50 do                                   \
51 {                                    \
52   ((sig_ucontext_t *)_arg)->uc_mcontext.sc_pc += 4;      \
53   (void)_dummy;                      \
54   (void)_info;                       \
55 }                                    \
56 while (0)
57
58 #define INIT_SEGV                            \
59 do                                           \
60   {                                          \
61     struct sigaction act;                    \
62     act.sa_sigaction = catch_segv;           \
63     act.sa_flags = SA_SIGINFO | SA_NODEFER;  \
64     sigemptyset (&act.sa_mask);              \
65     sigaction(SIGSEGV, &act, NULL);          \
66   }                                          \
67 while (0)
68
69 #define INIT_FPE                             \
70 do                                           \
71   {                                          \
72     struct sigaction act;                    \
73     act.sa_sigaction = catch_fpe;            \
74     act.sa_flags = SA_SIGINFO | SA_NODEFER;  \
75     sigemptyset (&act.sa_mask);              \
76     sigaction(SIGFPE, &act, NULL);           \
77   }                                          \
78 while (0)
79
80 #undef HANDLE_DIVIDE_OVERFLOW
81
82 #endif /* JAVA_SIGNAL_H */
83