public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Ulrich Drepper <drepper@redhat.com>,
	Glibc hackers <libc-hacker@sources.redhat.com>
Subject: Re: [PATCH] getpid/vfork/raise fix
Date: Wed, 10 Mar 2004 14:33:00 -0000	[thread overview]
Message-ID: <jeznaoixge.fsf@sykes.suse.de> (raw)
In-Reply-To: <20040310101515.GS3822@sunsite.ms.mff.cuni.cz> (Jakub Jelinek's message of "Wed, 10 Mar 2004 11:15:15 +0100")

Jakub Jelinek <jakub@redhat.com> 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."

  reply	other threads:[~2004-03-10 14:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-07 23:18 getpid/vfork broken Andreas Schwab
2004-03-07 23:30 ` Ulrich Drepper
2004-03-08  2:22   ` Roland McGrath
2004-03-08  2:28     ` Ulrich Drepper
2004-03-08  2:37       ` Roland McGrath
2004-03-08 13:10         ` Jakub Jelinek
2004-03-09  1:28           ` Roland McGrath
2004-03-09  2:04             ` Ulrich Drepper
2004-03-09  3:50               ` Richard Henderson
2004-03-09  7:48           ` Ulrich Drepper
2004-03-09 13:01             ` Andreas Schwab
2004-03-09 13:59               ` [PATCH] getpid/vfork/raise fix Jakub Jelinek
2004-03-09 16:44                 ` Andreas Schwab
2004-03-09 19:38                   ` Jakub Jelinek
2004-03-10  5:53                 ` Ulrich Drepper
2004-03-10 10:37                 ` Andreas Schwab
2004-03-10 12:24                   ` Jakub Jelinek
2004-03-10 14:33                     ` Andreas Schwab [this message]
2004-03-10 15:01                       ` Jakub Jelinek
2004-03-10 15:06                         ` Andreas Schwab
2004-03-10 16:56                       ` David Mosberger
2004-03-10 17:02                         ` Jakub Jelinek
2004-03-10 17:45                           ` David Mosberger
2004-03-10 18:19                             ` Jakub Jelinek
2004-03-10 19:24                               ` David Mosberger
2004-03-10 18:44                   ` Ulrich Drepper
2004-03-10 19:18                     ` [PATCH] IA-64 pt-vfork fix Jakub Jelinek
2004-03-10 23:10                       ` Ulrich Drepper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jeznaoixge.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=drepper@redhat.com \
    --cc=jakub@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).