1/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
2   This file is part of the GNU C Library.
3   Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, 1997.
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/* Code taken from glibc2.2.2/sysdeps/unix/sysv/linux/sparc/vfork.S */
20
21#include <features.h>
22#include <sys/syscall.h>
23
24.text
25.global	fork
26#ifdef __UCLIBC_HAS_THREADS__
27.weak   fork
28#endif
29.type	fork,%function
30.align 4
31
32fork:
33	mov __NR_fork, %g1
34	ta	0x10
35	bcc,a	9000f
36	nop
37	save    %sp,-96,%sp
38	call __errno_location
39	nop
40	st	%i0,[%o0]
41	jmpl	%i7+8,%g0
42	restore	%g0,-1,%o0
43
449000:
45	sub	%o1, 1, %o1
46	retl
47	and	%o0, %o1, %o0
48
49.size fork,.-fork
50#ifdef __UCLIBC_HAS_THREADS__
51strong_alias(fork,__libc_fork)
52#endif
53libc_hidden_def(fork)
54