1/* Copyright (C) 1999 Free Software Foundation, Inc.
2   This file is part of the GNU C Library.
3   Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
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   Ported to uClibc by:
20   Austin Foxley, Ceton Corporation <austinf@cetoncorp.com>
21 */
22
23#include <features.h>
24#include <sys/syscall.h>
25#include <asm/errno.h>
26
27.text
28.global	pipe
29.type	pipe, @function
30.align 4
31
32pipe:
33	save	%sp,-96,%sp
34
35	/* sanity check arguments */
36	tst	%i0
37	be	.Lerror
38	 mov	%i2,%o0
39
40	/* Do the system call */
41	set	__NR_pipe,%g1
42	ta	0x10
43	bcs	.Lerror
44	 nop
45
46    st %o0,[%i0]
47    st %o1,[%i0+4]
48	ret
49	 restore %g0,%g0,%o0
50
51.Lerror:
52	call	__errno_location
53	 or	%g0,EINVAL,%i0
54	st	%i0,[%o0]
55	ret
56	 restore %g0,-1,%o0
57
58.size pipe,.-pipe
59libc_hidden_def(pipe)
60