From 38e30b398a33ecaf1c17aa5cef9520564d41d4ef Mon Sep 17 00:00:00 2001
From: Roland McGrath <roland@gnu.org>
Date: Sun, 22 Aug 1999 22:23:58 +0000
Subject: 1999-08-19  Roland McGrath  <roland@baalperazim.frob.com>

	* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Mark OPTION and
	TIMEOUT as outputs of the asm to indicate that the signal thread
	might mutate them.
	* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Short circuit to plain
	mach_msg if only sending or only receiving (i.e., not an RPC).  When
	making an RPC that might get interrupted, save OPTION and the portion
	of the message buffer that gets clobbered by an EINTR reply message,
	and properly restore them before attempting to retry the request
	message send.
---
 sysdeps/mach/hurd/i386/intr-msg.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'sysdeps')

diff --git a/sysdeps/mach/hurd/i386/intr-msg.h b/sysdeps/mach/hurd/i386/intr-msg.h
index c011447..a12b2f2 100644
--- a/sysdeps/mach/hurd/i386/intr-msg.h
+++ b/sysdeps/mach/hurd/i386/intr-msg.h
@@ -1,5 +1,5 @@
 /* Machine-dependent details of interruptible RPC messaging.  i386 version.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1999 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
@@ -18,6 +18,9 @@
    Boston, MA 02111-1307, USA.  */
 
 
+/* Note that we must mark OPTION and TIMEOUT as outputs of this operation,
+   to indicate that the signal thread might mutate them as part
+   of sending us to a signal handler.  */
 #define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
 ({									      \
   error_t err;								      \
@@ -26,12 +29,14 @@
        ".globl _hurd_intr_rpc_msg_cx_sp\n"				      \
        ".globl _hurd_intr_rpc_msg_sp_restored\n"			      \
        "				movl %%esp, %%ecx\n"		      \
-       "				leal %1, %%esp\n"		      \
+       "				leal %3, %%esp\n"		      \
        "_hurd_intr_rpc_msg_cx_sp:	movl $-25, %%eax\n"		      \
        "_hurd_intr_rpc_msg_do_trap:	lcall $7, $0 # status in %0\n"	      \
        "_hurd_intr_rpc_msg_in_trap:	movl %%ecx, %%esp\n"		      \
        "_hurd_intr_rpc_msg_sp_restored:"				      \
-       : "=a" (err) : "m" ((&msg)[-1]) : "%ecx");			      \
+       : "=a" (err), "=m" (option), "=m" (timeout)			      \
+       : "m" ((&msg)[-1]), "1" (option), "2" (timeout)			      \
+       : "%ecx");							      \
   err;									      \
 })
 
-- 
cgit v1.1