]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libpthread / linuxthreads / sysdeps / unix / sysv / linux / arm / vfork.S
1 /* Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Philip Blundell <philb@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
16    License along with the GNU C Library; if not, see
17    <http://www.gnu.org/licenses/>.  */
18
19 #include <sysdep-cancel.h>
20 #define _ERRNO_H        1
21 #include <bits/errno.h>
22 #include <kernel-features.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
31 #ifdef __NR_vfork
32
33 #ifdef SHARED
34         ldr     ip, 1f
35         ldr     r0, 2f
36 3:      add     ip, pc, ip
37         ldr     r0, [ip, r0]
38 #else
39         ldr     r0, 1f
40 #endif
41         movs    r0, r0
42         bne     HIDDEN_JUMPTARGET (fork)
43
44         DO_CALL (vfork, 0)
45         cmn     a1, #4096
46         RETINSTR(cc, lr)
47
48 #ifndef __ASSUME_VFORK_SYSCALL
49         /* Check if vfork syscall is known at all.  */
50         cmn     a1, #ENOSYS
51         bne     PLTJMP(C_SYMBOL_NAME(__syscall_error))
52 #endif
53
54 #endif
55
56 #ifndef __ASSUME_VFORK_SYSCALL
57         /* If we don't have vfork, fork is close enough.  */
58         DO_CALL (fork, 0)
59         cmn     a1, #4096
60         RETINSTR(cc, lr)
61 #elif !defined __NR_vfork
62 # error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined"
63 #endif
64         b       PLTJMP(C_SYMBOL_NAME(__syscall_error))
65
66 #ifdef SHARED
67 1:      .word   _GLOBAL_OFFSET_TABLE_ - 3b - 8
68 2:      .word   __libc_pthread_functions(GOTOFF)
69 #else
70         .weak   pthread_create
71 1:      .word   pthread_create
72 #endif
73
74 PSEUDO_END (__vfork)
75 libc_hidden_def (__vfork)
76
77 weak_alias (__vfork, vfork)