]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libpthread / linuxthreads / sysdeps / unix / sysv / linux / sparc / sparc64 / vfork.S
1 /* Copyright (C) 2003 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
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
21 #ifdef SHARED
22 .LLGETPC0:
23         retl
24          add    %o7, %o0, %o0
25 #endif
26 ENTRY(__vfork)
27 #ifdef SHARED
28         mov     %o7, %o1
29         sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), %o0
30         call    .LLGETPC0
31          add    %o0, %lo(_GLOBAL_OFFSET_TABLE_+4), %o0
32         sethi   %hi(__libc_pthread_functions), %o2
33         mov     %o1, %o7
34         or      %o2, %lo(__libc_pthread_functions), %o2
35         ldx     [%o0 + %o2], %o2
36         ldx     [%o2], %o0
37 #else
38         .weak   pthread_create
39         sethi   %hi(pthread_create), %o0
40         or      %o0, %lo(pthread_create), %o0
41 #endif
42 #if defined SHARED && !defined BROKEN_SPARC_WDISP22
43         cmp     %o0, 0
44         bne     HIDDEN_JUMPTARGET(fork)
45 #else
46         brnz,pn %o0, 1f
47 #endif
48          mov    __NR_vfork, %g1
49         ta      0x6d
50         bcs,pn  %xcc, __syscall_error_handler
51          nop
52         sub     %o1, 1, %o1
53         retl
54          and    %o0, %o1, %o0
55 #if !defined SHARED || defined BROKEN_SPARC_WDISP22
56 1:      mov     %o7, %g1
57         call    HIDDEN_JUMPTARGET(fork)
58          mov    %g1, %o7
59 #endif
60         SYSCALL_ERROR_HANDLER
61 PSEUDO_END (__vfork)
62 libc_hidden_def (__vfork)
63 weak_alias (__vfork, vfork)