pipe.S 795 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */
  8. #include <features.h>
  9. #include <sys/asm.h>
  10. #include <asm/unistd.h>
  11. #include <sys/regdef.h>
  12. .globl pipe
  13. .ent pipe, 0
  14. .type pipe,@function
  15. pipe:
  16. #ifdef __PIC__
  17. SETUP_GP
  18. #endif
  19. li v0,__NR_pipe
  20. syscall
  21. bnez a3, 1f
  22. sw v0, 0(a0)
  23. sw v1, 4(a0)
  24. li v0, 0
  25. j ra
  26. 1:
  27. /* uClibc change -- start */
  28. move a0,v0 /* Pass return val to C function. */
  29. /* uClibc change -- stop */
  30. #ifdef __PIC__
  31. SETUP_GP64(v0, pipe)
  32. PTR_LA t9, __syscall_error
  33. RESTORE_GP64
  34. jr t9
  35. #else
  36. j __syscall_error
  37. #endif
  38. 1:
  39. .end pipe
  40. .size pipe,.-pipe
  41. libc_hidden_def(pipe)