summaryrefslogtreecommitdiffstats
path: root/libjava/include
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-20 06:27:11 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-20 06:27:11 +0000
commit95ef33d1772a9cc5a602b9a671ed84e45558eb3c (patch)
treeadd4675eb0e1e75e84638aec16fc821fcc469627 /libjava/include
parent88c94fa7ef5bd50ad02043a8ad57dd210e84169d (diff)
downloadppe42-gcc-95ef33d1772a9cc5a602b9a671ed84e45558eb3c.tar.gz
ppe42-gcc-95ef33d1772a9cc5a602b9a671ed84e45558eb3c.zip
1999-04-20 Andrew Haley <aph@cygnus.com>
* include/sparc-signal.h: new file. * configure.in: include/sparc-signal.h added. * configure: regenerated. * prims.cc (JvRunMain): signal handling code rewritten to be more portable. (catch_segv): ditto. (catch_fpe): ditto. * include/i386-signal.h: reorganized. * include/default-signal.h: reorganized. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26560 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/include')
-rw-r--r--libjava/include/default-signal.h3
-rw-r--r--libjava/include/i386-signal.h32
-rw-r--r--libjava/include/sparc-signal.h63
3 files changed, 95 insertions, 3 deletions
diff --git a/libjava/include/default-signal.h b/libjava/include/default-signal.h
index 63ba129320c..71545c06aca 100644
--- a/libjava/include/default-signal.h
+++ b/libjava/include/default-signal.h
@@ -14,5 +14,8 @@ details. */
#undef HANDLE_SEGV
#undef HANDLE_FPE
+#define INIT_SEGV do {} while (0)
+#define INIT_FPE do {} while (0)
+
#endif /* JAVA_SIGNAL_H */
diff --git a/libjava/include/i386-signal.h b/libjava/include/i386-signal.h
index de893afbbf3..73d8bbbbfc0 100644
--- a/libjava/include/i386-signal.h
+++ b/libjava/include/i386-signal.h
@@ -9,8 +9,8 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* This technique should work for all i386 based Unices which conform
- to iBCS2. This includes all versions of Linux more recent than
- version 1.3 */
+ * to iBCS2. This includes all versions of Linux more recent than 1.3
+ */
#ifndef JAVA_SIGNAL_H
@@ -21,8 +21,10 @@ details. */
#define HANDLE_SEGV 1
#define HANDLE_FPE 1
+#define SIGNAL_HANDLER(_name) \
+static void _name (int _dummy)
-#define MAKE_THROW_FRAME(_dummy) \
+#define MAKE_THROW_FRAME \
{ \
void **_p = (void **)&_dummy; \
struct sigcontext_struct *_regs = (struct sigcontext_struct *)++_p; \
@@ -34,5 +36,29 @@ details. */
: : "r"(_ebp), "r"(_eip)); \
}
+#define INIT_SEGV \
+do \
+ { \
+ nullp = new java::lang::NullPointerException (); \
+ struct sigaction act; \
+ act.sa_handler = catch_segv; \
+ sigemptyset (&act.sa_mask); \
+ act.sa_flags = 0; \
+ sigaction (SIGSEGV, &act, NULL); \
+ } \
+while (0)
+
+#define INIT_FPE \
+do \
+ { \
+ arithexception = new java::lang::ArithmeticException (); \
+ struct sigaction act; \
+ act.sa_handler = catch_fpe; \
+ sigemptyset (&act.sa_mask); \
+ act.sa_flags = 0; \
+ sigaction (SIGFPE, &act, NULL); \
+ } \
+while (0)
+
#endif /* JAVA_SIGNAL_H */
diff --git a/libjava/include/sparc-signal.h b/libjava/include/sparc-signal.h
new file mode 100644
index 00000000000..dfe8635e3eb
--- /dev/null
+++ b/libjava/include/sparc-signal.h
@@ -0,0 +1,63 @@
+// sparc-signal.h - Catch runtime signals and turn them into exceptions.
+
+/* Copyright (C) 1998, 1999 Cygnus Solutions
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#ifndef JAVA_SIGNAL_H
+#define JAVA_SIGNAL_H 1
+
+#include <signal.h>
+#include <ucontext.h>
+
+#define HANDLE_SEGV 1
+#define HANDLE_FPE 1
+
+#define SIGNAL_HANDLER(_name) \
+static void _name (int _dummy, siginfo_t *_info, ucontext_t *_context)
+
+#define FLUSH_REGISTER_WINDOWS \
+ asm volatile ("ta 3");
+
+#define MAKE_THROW_FRAME \
+do \
+{ \
+ (void)_dummy; \
+ (void)_info; \
+ register int sp = _context->uc_mcontext.gregs[REG_SP]; \
+ register int retaddr = _context->uc_mcontext.gregs[REG_O7]; \
+ FLUSH_REGISTER_WINDOWS; \
+ asm volatile ("mov %0, %%i6; mov %1, %%i7" \
+ : : "r"(sp), "r"(retaddr)); \
+} \
+while (0)
+
+#define INIT_SEGV \
+do \
+ { \
+ nullp = new java::lang::NullPointerException (); \
+ struct sigaction act; \
+ act.sa_sigaction = catch_segv; \
+ act.sa_flags = SA_SIGINFO; \
+ sigemptyset (&act.sa_mask); \
+ sigaction (SIGSEGV, &act, NULL); \
+ } \
+while (0)
+
+#define INIT_FPE \
+do \
+ { \
+ arithexception = new java::lang::ArithmeticException (); \
+ struct sigaction act; \
+ act.sa_flags = SA_SIGINFO; \
+ act.sa_sigaction = catch_fpe; \
+ sigemptyset (&act.sa_mask); \
+ sigaction (SIGFPE, &act, NULL); \
+ } \
+while (0)
+
+#endif /* JAVA_SIGNAL_H */
OpenPOWER on IntegriCloud