OSDN Git Service

Replace FSF snail mail address with URLs
[uclinux-h8/uClibc.git] / libpthread / linuxthreads / sysdeps / unix / sysv / linux / alpha / vfork.S
1 /* Copyright (C) 2003 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <http://www.gnu.org/licenses/>.  */
17
18
19 #include <sysdep-cancel.h>
20
21         .align 4
22         .globl  __vfork
23         .type   __vfork, @function
24         .usepv  __vfork, std
25         cfi_startproc
26 __vfork:
27         ldgp    gp, 0(pv)
28         PSEUDO_PROF
29
30 #ifdef SHARED
31         ldq     t0, __libc_pthread_functions(gp) !gprel
32         bne     t0, HIDDEN_JUMPTARGET (fork) !samegp
33 #else
34         .weak   pthread_create
35         ldq     t0, pthread_create(gp) !literal
36         bne     t0, $do_fork
37 #endif
38
39         lda     v0, SYS_ify(vfork)
40         call_pal PAL_callsys
41         bne     a3, SYSCALL_ERROR_LABEL
42         ret
43
44 #ifndef SHARED
45         /* Can't tail-call due to possible mismatch between GP in
46            fork and vfork object files.  */
47 $do_fork:
48         subq    sp, 16, sp
49         cfi_adjust_cfa_offset(16)
50         stq     ra, 0(sp)
51         cfi_offset(ra, -16)
52         jsr     ra, HIDDEN_JUMPTARGET (fork)
53         ldgp    gp, 0(ra)
54         ldq     ra, 0(sp)
55         addq    sp, 16, sp
56         cfi_restore(ra)
57         cfi_adjust_cfa_offset(-16)
58         ret
59
60 $syscall_error:
61         SYSCALL_ERROR_HANDLER
62 #endif
63
64         cfi_endproc
65         .size __vfork, .-__vfork
66
67 libc_hidden_def (__vfork)
68
69 weak_alias (__vfork, vfork)