1 // i386-signal.h - Catch runtime signals and turn them into exceptions.
3 /* Copyright (C) 1998, 1999 Cygnus Solutions
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 /* This technique should work for all i386 based Unices which conform
12 * to iBCS2. This includes all versions of Linux more recent than 1.3
17 #define JAVA_SIGNAL_H 1
24 #define SIGNAL_HANDLER(_name) \
25 static void _name (int _dummy)
27 #define MAKE_THROW_FRAME \
29 void **_p = (void **)&_dummy; \
30 struct sigcontext_struct *_regs = (struct sigcontext_struct *)++_p; \
32 register unsigned long _ebp = _regs->ebp; \
33 register unsigned long _eip = _regs->eip; \
35 asm volatile ("mov %0, (%%ebp); mov %1, 4(%%ebp)" \
36 : : "r"(_ebp), "r"(_eip)); \
42 nullp = new java::lang::NullPointerException (); \
43 struct sigaction act; \
44 act.sa_handler = catch_segv; \
45 sigemptyset (&act.sa_mask); \
47 sigaction (SIGSEGV, &act, NULL); \
54 arithexception = new java::lang::ArithmeticException (); \
55 struct sigaction act; \
56 act.sa_handler = catch_fpe; \
57 sigemptyset (&act.sa_mask); \
59 sigaction (SIGFPE, &act, NULL); \
63 #endif /* JAVA_SIGNAL_H */