From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21625 invoked by alias); 10 Mar 2004 12:24:24 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 21601 invoked from network); 10 Mar 2004 12:24:23 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.19.66) by sources.redhat.com with SMTP; 10 Mar 2004 12:24:23 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i2AAFFnd006455; Wed, 10 Mar 2004 11:15:15 +0100 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i2AAFF1x006453; Wed, 10 Mar 2004 11:15:15 +0100 Date: Wed, 10 Mar 2004 12:24:00 -0000 From: Jakub Jelinek To: Andreas Schwab Cc: Ulrich Drepper , Glibc hackers Subject: Re: [PATCH] getpid/vfork/raise fix Message-ID: <20040310101515.GS3822@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek References: <404BDA36.6000202@redhat.com> <200403080237.i282bXG6004322@magilla.sf.frob.com> <20040308110105.GN3822@sunsite.ms.mff.cuni.cz> <404D76CA.4010500@redhat.com> <20040309115038.GO3822@sunsite.ms.mff.cuni.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-SW-Source: 2004-03/txt/msg00043.txt.bz2 On Wed, Mar 10, 2004 at 11:37:43AM +0100, Andreas Schwab wrote: > --- nptl/sysdeps/unix/sysv/linux/ia64/pt-vfork.S.~1.2.~ 2003-12-11 11:35:12.000000000 +0100 > +++ nptl/sysdeps/unix/sysv/linux/ia64/pt-vfork.S 2004-03-10 11:28:34.057587179 +0100 > @@ -1,4 +1,4 @@ > -/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. > +/* Copyright (C) 2000, 2002, 2003, 2004 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 > @@ -32,13 +32,22 @@ > ENTRY(__vfork) > .prologue // work around a GAS bug which triggers if > .body // first .prologue is not at the beginning of proc. > - alloc r2=ar.pfs,0,0,2,0 > + alloc r2=ar.pfs,0,1,2,0 > + adds r14=PID,r13 > + ;; > + ld4 loc0=[r14] > + ;; > + sub r15=0,loc0 > mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD > mov out1=0 /* Standard sp value. */ > ;; > + st4 [r14]=r15 > DO_CALL (SYS_ify (clone)) > + cmp.eq p0,p7=0,r8 > cmp.eq p6,p0=-1,r10 > + adds r14=PID,r13 > ;; > +(p7) st4 [r14]=loc0 Can you use a local register for saving oldval accross the syscall though? Registers in the register window can be saved to the backing store, if that happens, vfork child restores it from the backing store, calls some routine and something else is stored into that location in backing store, vfork parent will afterwards restore a different value. E.g. IA-32 vfork saves return address in a register and not on the stack for a reason. IMHO only a call clobbered register preserved accross system call can be used, and is it is not available, vfork has to choose a slower way: int oldval = self->pid; int newval = oldval ? -oldval : 0x80000000; self->pid = newval; vfork syscall newval = self->pid; oldval = (newval & 0x7fffffff) ? -newval : 0; self->pid = oldval; (and with pt-vfork just self->pid = -self->pid; before and after). Jakub