From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23626 invoked by alias); 10 Mar 2004 14:33:08 -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 23605 invoked from network); 10 Mar 2004 14:33:07 -0000 Received: from unknown (HELO Cantor.suse.de) (195.135.220.2) by sources.redhat.com with SMTP; 10 Mar 2004 14:33:07 -0000 Received: from hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id 131B22CB74B; Wed, 10 Mar 2004 15:33:07 +0100 (CET) To: Jakub Jelinek Cc: Ulrich Drepper , Glibc hackers Subject: Re: [PATCH] getpid/vfork/raise fix 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> <20040310101515.GS3822@sunsite.ms.mff.cuni.cz> From: Andreas Schwab X-Yow: Why don't you ever enter any CONTESTS, Marvin?? Don't you know your own ZIPCODE? Date: Wed, 10 Mar 2004 14:33:00 -0000 In-Reply-To: <20040310101515.GS3822@sunsite.ms.mff.cuni.cz> (Jakub Jelinek's message of "Wed, 10 Mar 2004 11:15:15 +0100") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2004-03/txt/msg00045.txt.bz2 Jakub Jelinek writes: > 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. I think you are right. > 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; That doesn't seem to work, though. I'm getting p3 != p4 in the posix vfork tests. Or do you see any error in my implementation? ENTRY(__vfork) alloc r2=ar.pfs,0,0,2,0 adds r14=PID,r13 ;; ld4 r16=[r14] ;; sub r15=0,r16 cmp.eq p0,p6=0,r16 ;; (p6) movl r15=0x80000000 mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD mov out1=0 /* Standard sp value. */ ;; st4 [r14]=r15 DO_CALL_VIA_BREAK (SYS_ify (clone)) cmp.eq p6,p0=0,r8 adds r14=PID,r13 (p6) br.cond.dptk 1f ;; ld4 r15=[r14] ;; extr.u r16=r15,0,31 ;; cmp.eq p0,p6=0,r16 ;; (p6) sub r16=0,r15 ;; st4 [r14]=r16 1: cmp.eq p6,p0=-1,r10 (p6) br.cond.spnt.few __syscall_error ret PSEUDO_END(__vfork) Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."