1 // sh-signal.h - Catch runtime signals and turn them into exceptions
2 // on a SuperH based Linux system.
4 /* Copyright (C) 2004, 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
14 #define JAVA_SIGNAL_H 1
17 #include <sys/syscall.h>
22 /* The third parameter to the signal handler points to something with
23 * this structure defined in asm/ucontext.h, but the name clashes with
24 * struct ucontext from sys/ucontext.h so this private copy is used. */
25 typedef struct _sig_ucontext
{
26 unsigned long uc_flags
;
27 struct _sig_ucontext
*uc_link
;
29 struct sigcontext uc_mcontext
;
33 #define SIGNAL_HANDLER(_name) \
34 static void _name (int , siginfo_t *, sig_ucontext_t *_uc)
36 #define MAKE_THROW_FRAME(_exception)
38 /* For an explanation why we cannot simply use sigaction to
39 install the handlers, see i386-signal.h. */
41 /* We use kernel_old_sigaction here because we're calling the kernel
42 directly rather than via glibc. The sigaction structure that the
43 syscall uses is a different shape from the one in userland and not
44 visible to us in a header file so we define it here. */
46 struct kernel_old_sigaction
{
47 void (*k_sa_handler
) (int, siginfo_t
*, sig_ucontext_t
*);
48 unsigned long k_sa_mask
;
49 unsigned long k_sa_flags
;
50 void (*k_sa_restorer
) (void);
56 struct kernel_old_sigaction kact; \
57 kact.k_sa_handler = catch_segv; \
59 kact.k_sa_flags = SA_SIGINFO | SA_NODEFER; \
60 syscall (SYS_sigaction, SIGSEGV, &kact, NULL); \
67 struct kernel_old_sigaction kact; \
68 kact.k_sa_handler = catch_fpe; \
70 kact.k_sa_flags = SA_SIGINFO | SA_NODEFER; \
71 syscall (SYS_sigaction, SIGFPE, &kact, NULL); \
75 #endif /* JAVA_SIGNAL_H */