pipe.S 866 B

1234567891011121314151617181920212223242526272829303132333435363738
  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/regdef.h>
  7. .globl pipe
  8. .ent pipe, 0
  9. pipe:
  10. #ifdef PROF
  11. .set noat
  12. move $1,ra
  13. subu sp,sp,8 # _mcount pops 2 words from stack
  14. jal _mcount
  15. .set at
  16. #endif
  17. addiu sp,sp,-24
  18. sw a0,16(sp)
  19. li v0,__NR_pipe
  20. syscall
  21. beqz a3, 1f
  22. la t3, errno
  23. sw v0, (t3)
  24. li v0, -1
  25. b 2f
  26. 1:
  27. lw a0, 16(sp)
  28. sw v0, 0(a0)
  29. sw v1, 4(a0)
  30. li v0, 0
  31. 2:
  32. addiu sp,sp,24
  33. j ra
  34. .end pipe
  35. .size pipe,.-pipe