This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [patch] darwin signal handler implementation
- From: Andreas Tobler <toa at pop dot agri dot ch>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Tue, 20 Jan 2004 22:41:37 +0100
- Subject: Re: [patch] darwin signal handler implementation
- References: <400D9F1D.8020802@pop.agri.ch>
Andreas Tobler wrote:
this is the follow up patch to this one:
http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02053.html
It depends heavily on it :)
Any comments?
Ok for mainline if the above patch gets approved?
Test results will be available by tomorrow morning.
And here the missed patch, sorry!
Andreas
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.178
diff -u -r1.178 configure.in
--- configure.in 15 Jan 2004 03:41:47 -0000 1.178
+++ configure.in 20 Jan 2004 21:09:43 -0000
@@ -1146,6 +1146,9 @@
powerpc-*-linux*)
SIGNAL_HANDLER=include/powerpc-signal.h
;;
+ powerpc-apple-darwin7*)
+ SIGNAL_HANDLER=include/darwin-signal.h
+ ;;
alpha*-*-linux*)
SIGNAL_HANDLER=include/dwarf2-signal.h
;;
Index: configure.host
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.host,v
retrieving revision 1.54
diff -u -r1.54 configure.host
--- configure.host 22 Oct 2003 16:35:15 -0000 1.54
+++ configure.host 20 Jan 2004 21:09:43 -0000
@@ -227,6 +227,11 @@
;;
esac
;;
+ powerpc-apple-darwin7*)
+ enable_hash_synchronization_default=no
+ slow_pthread_self=
+ can_unwind_signal=yes
+ ;;
*-*-darwin*)
enable_hash_synchronization_default=no
slow_pthread_self=
--- /dev/null Tue Jan 20 22:10:08 2004
+++ include/darwin-signal.h Tue Jan 20 22:08:23 2004
@@ -0,0 +1,64 @@
+/* darwin-signal.h - Catch runtime signals and turn them into exceptions.
+ on a PowerPC based darwin system. */
+
+/* Copyright (C) 2004 Free Software Foundation
+
+ 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 <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+typedef void (* SIG_PF)(int);
+
+# define HANDLE_SEGV 1
+# undef HANDLE_FPE
+
+# define SIGNAL_HANDLER(_name) \
+ static void _name (int _dummy, siginfo_t *_info, ucontext_t *_uc)
+
+# define MAKE_THROW_FRAME(_exception) \
+ do \
+ { \
+ /* Skip over faulting instruction. */ \
+ _uc->uc_mcontext->ss.srr0 += 4; \
+ \
+ } \
+ while (0)
+
+# define INIT_SEGV \
+ do \
+ { \
+ struct sigaction sa; \
+ sa.sa_handler = (SIG_PF)catch_segv; \
+ sigemptyset(&sa.sa_mask); \
+ sa.sa_flags = SA_NODEFER | SA_SIGINFO; \
+ sigaction(SIGBUS, &sa, NULL); \
+ sigaction(SIGSEGV, &sa, NULL); \
+ \
+ } \
+ while (0)
+
+# define INIT_FPE \
+ do \
+ { \
+ struct sigaction sa; \
+ sa.sa_handler = (SIG_PF)catch_fpe; \
+ sigemptyset(&sa.sa_mask); \
+ sa.sa_flags = SA_NODEFER |SA_SIGINFO; \
+ sigaction(SIGFPE, &sa, NULL); \
+ } \
+while (0)
+
+
+#endif /* JAVA_SIGNAL_H */