pipe.S 673 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. .globl __pipe
  9. .hidden __pipe
  10. .ent __pipe, 0
  11. __pipe:
  12. .frame sp, 24, sp
  13. #ifdef __PIC__
  14. .set noreorder
  15. .cpload $25
  16. .set reorder
  17. addiu sp,sp,-24
  18. .cprestore 16
  19. #else
  20. addiu sp,sp,-24
  21. #endif
  22. sw a0,16(sp)
  23. li v0,__NR_pipe
  24. syscall
  25. beqz a3, 1f
  26. #ifdef __PIC__
  27. la t0, __syscall_error
  28. jr t9
  29. #else
  30. j __syscall_error
  31. #endif
  32. 1:
  33. lw a0, 16(sp)
  34. sw v0, 0(a0)
  35. sw v1, 4(a0)
  36. li v0, 0
  37. 2:
  38. addiu sp,sp,24
  39. j ra
  40. .end __pipe
  41. .size __pipe,.-__pipe
  42. .weak pipe
  43. pipe = __pipe