vfork.S 987 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * libc/sysdeps/linux/nios/vfork.S -- `vfork' syscall for linux/nios
  3. *
  4. * Copyright (C) 2004 Microtronix Datacom Ltd
  5. *
  6. * This file is subject to the terms and conditions of the GNU Lesser
  7. * General Public License. See the file COPYING.LIB in the main
  8. * directory of this archive for more details.
  9. *
  10. * Written by Wentao Xu <wentao@microtronix.com>
  11. */
  12. #include <features.h>
  13. #include <bits/errno.h>
  14. #include <sys/syscall.h>
  15. #include "NM_Macros.S"
  16. #ifndef __NR_vfork
  17. #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
  18. #endif
  19. .text
  20. .align 2
  21. .globl vfork
  22. .type vfork,@function
  23. vfork:
  24. MOVIP %g1, __NR_vfork
  25. trap 63
  26. bgen %g1, 12
  27. not %g1 /* (unsigned long) -4096 */
  28. cmp %o0, %g1
  29. skps cc_hi
  30. jmp %o7
  31. nop
  32. fix_errno:
  33. neg %o0
  34. save %sp, -16
  35. MOVIA %g1, __errno_location@h
  36. call %g1
  37. nop
  38. st [%o0], %i0 /* store errno */
  39. xor %i0, %i0
  40. subi %i0, 1 /* retval=-1 */
  41. ret
  42. restore
  43. .size vfork,.-vfork
  44. libc_hidden_def(vfork)