1/* pipe system call for Linux/MIPS */
2/*
3 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4 *
5 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 */
7
8/*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */
9
10#include <features.h>
11#include <sys/asm.h>
12#include <asm/unistd.h>
13#include <sys/regdef.h>
14
15	.globl	pipe
16	.ent	pipe, 0
17	.type pipe,@function
18pipe:
19#ifdef __PIC__
20	SETUP_GP
21#endif
22	li	v0,__NR_pipe
23	syscall
24	bnez	a3, 1f
25	sw	v0, 0(a0)
26	sw	v1, 4(a0)
27	li	v0, 0
28	j	ra
291:
30	/* uClibc change -- start */
31	move		a0,v0		/* Pass return val to C function. */
32	/* uClibc change -- stop */
33
34#ifdef __PIC__
35	SETUP_GP64(v0, pipe)
36	PTR_LA	t9, __syscall_error
37	RESTORE_GP64
38	jr	t9
39#else
40	j	__syscall_error
41#endif
421:
43	.end	pipe
44	.size	pipe,.-pipe
45libc_hidden_def(pipe)
46