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 | |
parent | 9363dbb847a7e29d1abfffabc59fb142cf956df2 (diff) |
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')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S | 21 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/vfork.S | 8 |
2 files changed, 26 insertions, 3 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. */ diff --git a/nptl/sysdeps/unix/sysv/linux/i386/vfork.S b/nptl/sysdeps/unix/sysv/linux/i386/vfork.S index 2b60a5ea5e..52336102c7 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/vfork.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/vfork.S @@ -21,9 +21,13 @@ /* Save the PID value. */ #define SAVE_PID \ movl %gs:PID, %edx; \ - movl $-1, %gs:PID + movl %edx, %eax; \ + negl %eax; \ + jne 1f; \ + movl $0x80000000, %eax; \ +1: movl %eax, %gs:PID -/* Restore the old PID value in the parent. In the child store 0. */ +/* Restore the old PID value in the parent. */ #define RESTORE_PID \ testl %eax, %eax; \ je 1f; \ |