blob: 94913d48667a0747ea9fcb5e940bdf66f5d46b8e [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA.
19
20 Ported to uClibc by:
21 Austin Foxley, Ceton Corporation <austinf@cetoncorp.com>
22 */
23
24#include <features.h>
25#include <sys/syscall.h>
26#include <asm/errno.h>
27
28.text
29.global pipe
30.type pipe, @function
31.align 4
32
33pipe:
34 save %sp,-96,%sp
35
36 /* sanity check arguments */
37 tst %i0
38 be .Lerror
39 orcc %i1,%g0,%o1
40 be .Lerror
41 mov %i2,%o0
42
43 /* Do the system call */
44 set __NR_pipe,%g1
45 ta 0x10
46 bcs .Lerror
47 nop
48
49 st %o0,[%i0]
50 st %o1,[%i0+4]
51 ret
52 restore %g0,%g0,%o0
53
54.Lerror:
55 call HIDDEN_JUMPTARGET(__errno_location)
56 or %g0,EINVAL,%i0
57 st %i0,[%o0]
58 ret
59 restore %g0,-1,%o0
60
61.size pipe,.-pipe
62libc_hidden_def(pipe)