about summary refs log tree commit diff
path: root/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'hurd')
-rw-r--r--hurd/exc2signal.c71
-rw-r--r--hurd/hurdmalloc.c58
-rw-r--r--hurd/longjmp-ts.c32
-rw-r--r--hurd/trampoline.c37
4 files changed, 141 insertions, 57 deletions
diff --git a/hurd/exc2signal.c b/hurd/exc2signal.c
new file mode 100644
index 0000000000..de044bbcf4
--- /dev/null
+++ b/hurd/exc2signal.c
@@ -0,0 +1,71 @@
+/* Translate Mach exception codes into signal numbers.  Stub version.
+   Copyright (C) 1991, 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <hurd.h>
+
+/* This file must be modified with machine-dependent details.  */
+#error "need to write sysdeps/mach/hurd/MACHINE/exc2signal.c"
+
+/* Translate the Mach exception codes, as received in an `exception_raise' RPC,
+   into a signal number and signal subcode.  */
+
+void
+_hurd_exception2signal (int exception, int code, int subcode,
+			int *signo, int *sigcode, int *error)
+{
+  *error = 0;
+
+  switch (exception)
+    {
+    default:
+      *signo = SIGIOT;
+      *sigcode = exception;
+      break;
+
+    case EXC_BAD_ACCESS:
+      if (code == KERN_PROTECTION_FAILURE)
+	*signo = SIGSEGV;
+      else
+	*signo = SIGBUS;
+      *sigcode = subcode;
+      *error = code;
+      break;
+
+    case EXC_BAD_INSTRUCTION:
+      *signo = SIGILL;
+      *sigcode = 0;
+      break;
+
+    case EXC_ARITHMETIC:
+      *signo = SIGFPE;
+      *sigcode = 0;
+      break;
+
+    case EXC_EMULATION:
+    case EXC_SOFTWARE:
+      *signo = SIGEMT;
+      *sigcode = 0;
+      break;
+
+    case EXC_BREAKPOINT:
+      *signo = SIGTRAP;
+      *sigcode = 0;
+      break;
+    }
+}
diff --git a/hurd/hurdmalloc.c b/hurd/hurdmalloc.c
index 4839d98535..12da1f2abc 100644
--- a/hurd/hurdmalloc.c
+++ b/hurd/hurdmalloc.c
@@ -33,63 +33,7 @@
  * the rights to redistribute these changes.
  */
 /*
- * HISTORY
- * $Log$
- * Revision 1.15  2001/09/19 03:04:09  drepper
- * (bcopy): Removed.
- * (realloc): Replace bcopy with memcpy.
- *
- * Revision 1.14  2001/04/01 05:03:14  roland
- * 2001-03-11  Roland McGrath  <roland@frob.com>
- *
- * 	* mach/mach_error.h: Fix ancient #endif syntax.
- * 	* hurd/hurdmalloc.c: Likewise.
- *
- * Revision 1.13  1996/12/20 01:32:01  drepper
- * Update from main archive 961219
- *
- * Revision 1.12  1996/11/15 19:44:13  thomas
- * Tue Nov 12 16:58:41 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
- *
- * 	* mach/msg-destroy.c (mach_msg_destroy_port,
- * 	mach_msg_destroy_memory): Use prototype	syntax.
- * 	* hurd/hurdmalloc.c (more_memory, malloc_fork_prepare,
- * 	malloc_fork_parent, malloc_fork_child): Likewise.
- *
- * Revision 1.11  1996/06/06 15:13:47  miles
- * Changes to bring in line with the hurd libthreads/malloc.c:
- *   (more_memory): Use assert_perror instead of MACH_CALL.
- *   "cthread_internals.h": Include removed.
- *   (realloc): Use LOG2_MIN_SIZE.
- *   (LOG2_MIN_SIZE): New macro.
- *   (realloc): Don't bother allocating a new block if the
- *     new size request fits in the old one and doesn't waste any space.
- *     Only free the old block if we successfully got a new one.
- *   [MCHECK] (struct header): New type.
- *   (union header): Only define if !MCHECK.
- *   (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros.
- *   [MCHECK] (MIN_SIZE): Add correct definition for this case.
- *   (more_memory, malloc, free, realloc): Use above macros, and add
- *     appropriate checks & frobs in MCHECK case.
- *
- * Revision 1.6  1996/03/07 21:13:08  miles
- * (realloc):
- *   Use LOG2_MIN_SIZE.
- *   Don't bother allocating a new block if the new size request fits in the old
- *     one and doesn't waste any space.
- *   Only free the old block if we successfully got a new one.
- * (LOG2_MIN_SIZE): New macro.
- *
- * Revision 1.5  1996/03/06 23:51:04  miles
- * [MCHECK] (struct header): New type.
- * (union header): Only define if !MCHECK.
- * (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros.
- * [MCHECK] (MIN_SIZE): Add correct definition for this case.
- * (more_memory, malloc, free, realloc):
- *   Use above macros, and add appropriate checks & frobs in MCHECK case.
- *
- * Revision 1.4  1994/05/05 11:21:42  roland
- * entered into RCS
+ * (pre-GNU) HISTORY
  *
  * Revision 2.7  91/05/14  17:57:34  mrt
  * 	Correcting copyright
diff --git a/hurd/longjmp-ts.c b/hurd/longjmp-ts.c
new file mode 100644
index 0000000000..e9c297a20b
--- /dev/null
+++ b/hurd/longjmp-ts.c
@@ -0,0 +1,32 @@
+/* Perform a `longjmp' on a Mach thread_state.  Stub version.
+   Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <mach/thread_status.h>
+
+/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'.  */
+
+void
+_hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
+{
+  /* Set all the registers in *STATE to the values described by ENV and
+     RETVAL.  After this, setting that thread's state to STATE should be
+     just like calling `longjmp (ENV, RETVAL)'.  */
+  #error "Need to write sysdeps/mach/hurd/MACHINE/longjmp-ctx.c"
+}
diff --git a/hurd/trampoline.c b/hurd/trampoline.c
new file mode 100644
index 0000000000..7045a0d0ab
--- /dev/null
+++ b/hurd/trampoline.c
@@ -0,0 +1,37 @@
+/* Set thread_state for sighandler, and sigcontext to recover.  Stub version.
+   Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <hurd.h>
+#include <mach/thread_status.h>
+
+/* Set up STATE to run a signal handler in the thread it describes.
+   This should save the original state in a `struct sigcontext' on the
+   thread's stack (or possibly a signal stack described by SIGALTSTACK,
+   if the SA_ONSTACK bit is set in FLAGS), and return the address of
+   that structure.  */
+
+struct sigcontext *
+_hurd_setup_sighandler (int flags,
+			__sighandler_t handler,
+			struct sigaltstack *sigaltstack,
+			int signo, int sigcode,
+			void *state)
+{
+#error "Need to write sysdeps/mach/hurd/MACHINE/trampoline.c"
+}