]> git.ipfire.org Git - thirdparty/glibc.git/blame - nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S
Remove unused pseudo_end label
[thirdparty/glibc.git] / nptl / sysdeps / unix / sysv / linux / i386 / pt-vfork.S
CommitLineData
842a39cd 1/* Copyright (C) 1999-2012 Free Software Foundation, Inc.
76a50749
UD
2 This file is part of the GNU C Library.
3 Contributed by Andreas Schwab <schwab@gnu.org>.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
76a50749
UD
18
19#include <sysdep.h>
20#define _ERRNO_H 1
21#include <bits/errno.h>
22#include <kernel-features.h>
8b9d6054
UD
23#include <tcb-offsets.h>
24
25/* Save the PID value. */
26#define SAVE_PID \
27 movl %gs:PID, %edx; \
28 movl %edx, %eax; \
29 negl %eax; \
30 movl %eax, %gs:PID
31
32/* Restore the old PID value in the parent. */
33#define RESTORE_PID \
34 testl %eax, %eax; \
35 je 1f; \
36 movl %edx, %gs:PID; \
371:
76a50749
UD
38
39/* Clone the calling process, but without copying the whole address space.
40 The calling process is suspended until the new process exits or is
41 replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
42 and the process ID of the new process to the old process. */
43
44ENTRY (__vfork)
45 /* Pop the return PC value into ECX. */
46 popl %ecx
47
8b9d6054
UD
48 SAVE_PID
49
76a50749
UD
50 /* Stuff the syscall number in EAX and enter into the kernel. */
51 movl $SYS_ify (vfork), %eax
52 int $0x80
53
8b9d6054
UD
54 RESTORE_PID
55
76a50749
UD
56 /* Jump to the return PC. Don't jump directly since this
57 disturbs the branch target cache. Instead push the return
58 address back on the stack. */
59 pushl %ecx
60
61 cmpl $-4095, %eax
62 jae SYSCALL_ERROR_LABEL /* Branch forward if it failed. */
76a50749
UD
63 ret
64PSEUDO_END (__vfork)
65
66weak_alias (__vfork, vfork)