about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-04-08 07:06:57 +0000
committerRoland McGrath <roland@gnu.org>2002-04-08 07:06:57 +0000
commitf899db60945ef4c080ffe4393e55ef2fbcbbf6c0 (patch)
tree159ec00fc213be47a80546f25d90320fd8c1aaba
parent7ce93726fb9f02c45e45df15d923faabaa8951d3 (diff)
downloadglibc-f899db60945ef4c080ffe4393e55ef2fbcbbf6c0.tar.gz
glibc-f899db60945ef4c080ffe4393e55ef2fbcbbf6c0.tar.xz
glibc-f899db60945ef4c080ffe4393e55ef2fbcbbf6c0.zip
* sysdeps/mach/hurd/alpha/trampoline.c: Don't include
	<mach/machine/alpha_instruction.h>.
	(_hurd_setup_sighandler): Take proper arguments for current decls.
	Update code to use _hurdsig_catch_fault.
	Use `callsys' instruction instead of `call_pal'.
	* sysdeps/mach/hurd/alpha/intr-msg.h: New file.

	* sysdeps/mach/alpha/sysdep.h: Include <mach/alpha/asm.h>.
	(ALIGN, at, AT, fp): New macros.
-rw-r--r--ChangeLog12
-rw-r--r--sysdeps/mach/alpha/sysdep.h15
-rw-r--r--sysdeps/mach/hurd/alpha/intr-msg.h100
-rw-r--r--sysdeps/mach/hurd/alpha/trampoline.c30
4 files changed, 137 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 4adce53bb9..775bac79df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2002-04-07  Roland McGrath  <roland@frob.com>
+
+	* sysdeps/mach/hurd/alpha/trampoline.c: Don't include
+	<mach/machine/alpha_instruction.h>.
+	(_hurd_setup_sighandler): Take proper arguments for current decls.
+	Update code to use _hurdsig_catch_fault.
+	Use `callsys' instruction instead of `call_pal'.
+	* sysdeps/mach/hurd/alpha/intr-msg.h: New file.
+
+	* sysdeps/mach/alpha/sysdep.h: Include <mach/alpha/asm.h>.
+	(ALIGN, at, AT, fp): New macros.
+
 2002-04-06  Roland McGrath  <roland@frob.com>
 
 	* mach/setup-thread.c (__mach_setup_thread): int -> natural_t
diff --git a/sysdeps/mach/alpha/sysdep.h b/sysdeps/mach/alpha/sysdep.h
index 9e7ace0eed..ddd98d666a 100644
--- a/sysdeps/mach/alpha/sysdep.h
+++ b/sysdeps/mach/alpha/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1994,97,2002 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
@@ -34,8 +34,17 @@
      asm volatile ("mov %0,$30; jmp $31, (%1); ldgp $29, 0(%1)" \
 		   : : "r" (__sp), "r" (__fn)); })
 
-#define ENTRY(name) LEAF(name, ***loser no arg count***)
-
 #define STACK_GROWTH_DOWN
 
+#define RETURN_TO(sp, pc, retval) \
+  asm volatile ("mov %0,$30; jmp $31, (%1); mov %2,$0" \
+		: : "r" (sp), "r" (pc), "r" ((long int) (retval)));
+
+#define ALIGN 3
 #include <sysdeps/mach/sysdep.h>
+
+#include <mach/alpha/asm.h>
+#undef	at
+#define at	28
+#define AT	$28
+#define fp	s6
diff --git a/sysdeps/mach/hurd/alpha/intr-msg.h b/sysdeps/mach/hurd/alpha/intr-msg.h
new file mode 100644
index 0000000000..4f172124e3
--- /dev/null
+++ b/sysdeps/mach/hurd/alpha/intr-msg.h
@@ -0,0 +1,100 @@
+/* Machine-dependent details of interruptible RPC messaging.  Alpha version.
+   Copyright (C) 2002 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.  */
+
+#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
+({									\
+  error_t err;								\
+  asm (".globl _hurd_intr_rpc_msg_do_trap\n"				\
+       ".globl _hurd_intr_rpc_msg_in_trap\n"				\
+       "				mov %1, $16\n"			\
+       "				mov %2, $17\n"			\
+       "				mov %3, $18\n"			\
+       "				mov %4, $19\n"			\
+       "				mov %5, $20\n"			\
+       "				mov %6, $21\n"			\
+       "				mov %7, $1\n"			\
+       "				lda $0, -25\n"			\
+       "_hurd_intr_rpc_msg_do_trap:	callsys\n"			\
+       "_hurd_intr_rpc_msg_in_trap:	ret\n"				\
+       : "=r" (err)							\
+       : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size),	\
+	 "r" (rcv_name), "r" (timeout), "r" (notify)			\
+       : "16", "17", "18", "19", "20", "21", "1", "0");			\
+  err;									\
+})
+
+static void inline
+INTR_MSG_BACK_OUT (struct alpha_thread_state *state)
+{
+  return;
+}
+
+#include "hurdfault.h"
+
+/* This cannot be an inline function because it calls setjmp.  */
+#define SYSCALL_EXAMINE(state, callno)					    \
+({									    \
+  u_int32_t *p = (void *) ((state)->pc - 4);				    \
+  int result;								    \
+  _hurdsig_catch_memory_fault (p) ? 0 :					    \
+  ({									    \
+    result = (*p == 0x00000083);					    \
+    _hurdsig_end_catch_fault ();					    \
+    if (result)								    \
+      /* The PC is just after a `callsys' instruction.			    \
+         This is a system call in progress; v0 holds the call number.  */   \
+      *(callno) = (state)->r0;						    \
+    result;								    \
+  });									    \
+})
+
+struct mach_msg_trap_args
+  {
+    /* This is the order of arguments to mach_msg_trap.  */
+    mach_msg_header_t *msg;
+    mach_msg_option_t option;
+    mach_msg_size_t send_size;
+    mach_msg_size_t rcv_size;
+    mach_port_t rcv_name;
+    mach_msg_timeout_t timeout;
+    mach_port_t notify;
+  };
+
+/* This cannot be an inline function because it calls setjmp.  */
+#define MSG_EXAMINE(state, msgid, rcv_name, send_name, option, timeout)   \
+({									  \
+  mach_msg_header_t *msg = (mach_msg_header_t *) (state)->r16;		  \
+  *(option) = (mach_msg_option_t) (state)->r17;				  \
+  *(rcv_name) = (mach_port_t) (state)->r18;				  \
+  *(timeout) = (mach_msg_timeout_t) (state)->r19;			  \
+  (msg == 0) ?								  \
+    ({									  \
+      *(send_name) = MACH_PORT_NULL;					  \
+      *(msgid) = 0;							  \
+      0;								  \
+    }) :								  \
+    (_hurdsig_catch_memory_fault (msg) ? -1 :				  \
+	({								  \
+	  *(send_name) = msg->msgh_remote_port;				  \
+	  *(msgid) = msg->msgh_id;					  \
+	  _hurdsig_end_catch_fault ();					  \
+	  0;								  \
+	})								  \
+    );									  \
+})
diff --git a/sysdeps/mach/hurd/alpha/trampoline.c b/sysdeps/mach/hurd/alpha/trampoline.c
index 152f935b13..2360cbb469 100644
--- a/sysdeps/mach/hurd/alpha/trampoline.c
+++ b/sysdeps/mach/hurd/alpha/trampoline.c
@@ -1,5 +1,5 @@
 /* Set thread_state for sighandler, and sigcontext to recover.  Alpha version.
-   Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1994,95,97,98,2002 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
@@ -19,7 +19,6 @@
 
 #include <hurd/signal.h>
 #include "thread_state.h"
-#include <mach/machine/alpha_instruction.h>
 #include "hurdfault.h"
 #include <assert.h>
 
@@ -38,9 +37,8 @@ struct mach_msg_trap_args
 
 struct sigcontext *
 _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
-			int signo, long int sigcode,
-			int rpc_wait,
-			struct machine_thread_all_state *state)
+			int signo, struct hurd_signal_detail *detail,
+			int rpc_wait, struct machine_thread_all_state *state)
 {
   __label__ trampoline, rpc_wait_trampoline;
   void *sigsp;
@@ -51,10 +49,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
       /* We have a previous sigcontext that sigreturn was about
 	 to restore when another signal arrived.  We will just base
 	 our setup on that.  */
-      if (_hurdsig_catch_fault (SIGSEGV))
-	assert (_hurdsig_fault_sigcode >= (long int) ss->context &&
-		_hurdsig_fault_sigcode < (long int) (ss->context + 1));
-      else
+      if (! _hurdsig_catch_memory_fault (ss->context))
 	{
 	  memcpy (&state->basic, &ss->context->sc_alpha_thread_state,
 		  sizeof (state->basic));
@@ -79,6 +74,8 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 	     later.  */
 	  ss->intr_port = ss->context->sc_intr_port;
 	}
+      _hurdsig_end_catch_fault ();
+
       /* If the sigreturn context was bogus, just ignore it.  */
       ss->context = NULL;
     }
@@ -101,10 +98,8 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
   sigsp -= sizeof (*scp);
   scp = sigsp;
 
-  if (_hurdsig_catch_fault (SIGSEGV))
+  if (_hurdsig_catch_memory_fault (scp))
     {
-      assert (_hurdsig_fault_sigcode >= (long int) scp &&
-	      _hurdsig_fault_sigcode < (long int) (scp + 1));
       /* We got a fault trying to write the stack frame.
 	 We cannot set up the signal handler.
 	 Returning NULL tells our caller, who will nuke us with a SIGILL.  */
@@ -137,6 +132,8 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 			       &scp->sc_alpha_float_state,
 			       sizeof (state->fpu)))
 	return NULL;
+
+      _hurdsig_end_catch_fault ();
     }
 
   /* Modify the thread state to call the trampoline code on the new stack.  */
@@ -176,14 +173,14 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 	 ($16..$21, $1).  Pass the handler args to the trampoline code in
 	 t8..t10 ($22.$24).  */
       state->basic.r22 = signo;
-      state->basic.r23 = sigcode;
+      state->basic.r23 = detail->code;
       state->basic.r24 = (long int) scp;
     }
   else
     {
       state->basic.pc = (long int) &&trampoline;
       state->basic.r16 = signo;
-      state->basic.r17 = sigcode;
+      state->basic.r17 = detail->code;
       state->basic.r18 = (long int) scp;
     }
 
@@ -212,7 +209,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
   asm volatile
     (/* Retry the interrupted mach_msg system call.  */
      "lda $0, -25($31)\n"	/* mach_msg_trap */
-     "call_pal %0\n"		/* Magic system call instruction.  */
+     "callsys\n"		/* Magic system call instruction.  */
      /* When the sigcontext was saved, v0 was MACH_RCV_INTERRUPTED.  But
 	now the message receive has completed and the original caller of
 	the RPC (i.e. the code running when the signal arrived) needs to
@@ -225,8 +222,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 	in registers t8..t10 ($22..$24).  */
      "mov $22, $16\n"
      "mov $23, $17\n"
-     "mov $24, $18\n"
-     : : "i" (op_chmk));
+     "mov $24, $18\n");
 
  trampoline:
   /* Entry point for running the handler normally.  The arguments to the