pipe.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Copyright (C) 1999 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>.
  15. Ported to uClibc by:
  16. Austin Foxley, Ceton Corporation <austinf@cetoncorp.com>
  17. */
  18. #include <features.h>
  19. #include <sys/syscall.h>
  20. #include <asm/errno.h>
  21. .text
  22. .global pipe
  23. .type pipe, @function
  24. .align 4
  25. pipe:
  26. save %sp,-96,%sp
  27. /* sanity check arguments */
  28. tst %i0
  29. be .Lerror
  30. orcc %i1,%g0,%o1
  31. be .Lerror
  32. mov %i2,%o0
  33. /* Do the system call */
  34. set __NR_pipe,%g1
  35. ta 0x10
  36. bcs .Lerror
  37. nop
  38. st %o0,[%i0]
  39. st %o1,[%i0+4]
  40. ret
  41. restore %g0,%g0,%o0
  42. .Lerror:
  43. call HIDDEN_JUMPTARGET(__errno_location)
  44. or %g0,EINVAL,%i0
  45. st %i0,[%o0]
  46. ret
  47. restore %g0,-1,%o0
  48. .size pipe,.-pipe
  49. libc_hidden_def(pipe)