vfork.S 1019 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #if defined __HAVE_ELF__
  23. .type vfork,@function
  24. #endif
  25. vfork:
  26. MOVIP %g1, __NR_vfork
  27. trap 63
  28. bgen %g1, 12
  29. not %g1 /* (unsigned long) -4096 */
  30. cmp %o0, %g1
  31. skps cc_hi
  32. jmp %o7
  33. nop
  34. fix_errno:
  35. neg %o0
  36. save %sp, -16
  37. MOVIA %g1, __errno_location@h
  38. call %g1
  39. nop
  40. st [%o0], %i0 /* store errno */
  41. xor %i0, %i0
  42. subi %i0, 1 /* retval=-1 */
  43. ret
  44. restore
  45. .size vfork,.-vfork
  46. libc_hidden_def(vfork)