]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S
Inital import
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libpthread / linuxthreads / sysdeps / unix / sysv / linux / s390 / s390-32 / vfork.S
1 /* Copyright (C) 2003 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>
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
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 #include <sysdep-cancel.h>
21 #define _ERRNO_H        1
22 #include <bits/errno.h>
23
24 /* Clone the calling process, but without copying the whole address space.
25    The calling process is suspended until the new process exits or is
26    replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
27    and the process ID of the new process to the old process.  */
28
29 ENTRY (__vfork)
30         basr    %r1,0
31 0:
32 #ifdef SHARED
33         al      %r1,4f-0b(%r1)
34         l       %r1,0(%r1)
35         ltr     %r1,%r1
36 #else
37         icm     %r1,15,4f-0b(%r1)
38 #endif
39         jne     1f
40
41         /* Do vfork system call.  */
42         svc     SYS_ify (vfork)
43
44         /* Check for error.  */
45         lhi     %r4,-4095
46         clr     %r2,%r4
47         jnl     SYSCALL_ERROR_LABEL
48
49         /* Normal return.  */
50         br      %r14
51 1:
52         basr    %r1,0
53 2:
54         al      %r1,3f-2b(%r1)
55         br      %r1
56 3:
57         .long   HIDDEN_JUMPTARGET(__fork)-2b
58 4:
59 #ifdef SHARED
60         .long   __libc_pthread_functions-0b
61 #else
62         .weak   pthread_create
63         .long   pthread_create
64 #endif
65 PSEUDO_END(__vfork)
66
67 libc_hidden_def (__vfork)
68
69 weak_alias (__vfork, vfork)