OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [sysdeps/] [linux/] [mips/] [pipe.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* pipe system call for Linux/MIPS */
2
 
3
/*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */
4
 
5
#include <errno.h>
6
#include <unistd.h>
7
#include <syscall.h>
8
 
9
int pipe(int *fd)
10
{
11
    register long int res __asm__ ("$2"); // v0
12
    register long int res2 __asm__ ("$3"); // v1
13
 
14
    asm ("move\t$4,%2\n\t"              // $4 = a0
15
         "syscall"              /* Perform the system call.  */
16
         : "=r" (res)
17
         : "0" (__NR_pipe), "r" (fd)
18
         : "$4", "$7");
19
 
20
        fd[0] = res;
21
        fd[1] = res2;
22
        return(0);
23
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.