pipe.S 892 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* pipe system call for Linux/MIPS */
  2. /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */
  3. #include <features.h>
  4. #include <asm/asm.h>
  5. #include <asm/unistd.h>
  6. #include <asm/mipsregs.h>
  7. #include <asm/regdef.h>
  8. .globl pipe
  9. .ent pipe, 0
  10. pipe:
  11. #ifdef PROF
  12. .set noat
  13. move $1,ra
  14. subu sp,sp,8 # _mcount pops 2 words from stack
  15. jal _mcount
  16. .set at
  17. #endif
  18. addiu sp,sp,-24
  19. sw a0,16(sp)
  20. li v0,__NR_pipe
  21. syscall
  22. beqz a3, 1f
  23. la t3, errno
  24. sw v0, (t3)
  25. li v0, -1
  26. b 2f
  27. 1:
  28. lw a0, 16(sp)
  29. sw v0, 0(a0)
  30. sw v1, 4(a0)
  31. li v0, 0
  32. 2:
  33. addiu sp,sp,24
  34. j ra
  35. .end pipe
  36. .size pipe,.-pipe