diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-03-10 05:25:48 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-03-10 05:25:48 +0000 |
commit | 8b9d605485be779bb03778e780e9875525ec2ca4 (patch) | |
tree | 38c566c233a1d11a10b2bb68a488dfd9e17e9b04 /nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S | |
parent | 9363dbb847a7e29d1abfffabc59fb142cf956df2 (diff) | |
download | glibc-8b9d605485be779bb03778e780e9875525ec2ca4.tar.gz glibc-8b9d605485be779bb03778e780e9875525ec2ca4.tar.xz glibc-8b9d605485be779bb03778e780e9875525ec2ca4.zip |
Update.
2004-02-09 Jakub Jelinek <jakub@redhat.com> * posix/Makefile (tests): Add tst-vfork2. * posix/tst-vfork1.c (do_test): Fix comment. * posix/tst-vfork2.c: New test.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S b/nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S index 6994c0d7fa..24f5a1d292 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@gnu.org>. @@ -21,6 +21,21 @@ #define _ERRNO_H 1 #include <bits/errno.h> #include <kernel-features.h> +#include <tcb-offsets.h> + +/* Save the PID value. */ +#define SAVE_PID \ + movl %gs:PID, %edx; \ + movl %edx, %eax; \ + negl %eax; \ + movl %eax, %gs:PID + +/* Restore the old PID value in the parent. */ +#define RESTORE_PID \ + testl %eax, %eax; \ + je 1f; \ + movl %edx, %gs:PID; \ +1: /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is @@ -31,10 +46,14 @@ ENTRY (__vfork) /* Pop the return PC value into ECX. */ popl %ecx + SAVE_PID + /* Stuff the syscall number in EAX and enter into the kernel. */ movl $SYS_ify (vfork), %eax int $0x80 + RESTORE_PID + /* Jump to the return PC. Don't jump directly since this disturbs the branch target cache. Instead push the return address back on the stack. */ |