vfork.S 994 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 <sys/syscall.h>
  13. #include "NM_Macros.S"
  14. #ifndef __NR_vfork
  15. #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
  16. #endif
  17. .text
  18. .align 2
  19. .globl __vfork
  20. .hidden __vfork
  21. .type __vfork,@function
  22. __vfork:
  23. MOVIP %g1, __NR_vfork
  24. trap 63
  25. bgen %g1, 12
  26. not %g1 /* (unsigned long) -4096 */
  27. cmp %o0, %g1
  28. skps cc_hi
  29. jmp %o7
  30. nop
  31. fix_errno:
  32. neg %o0
  33. save %sp, -16
  34. MOVIA %g1, __errno_location@h
  35. call %g1
  36. nop
  37. st [%o0], %i0 /* store errno */
  38. xor %i0, %i0
  39. subi %i0, 1 /* retval=-1 */
  40. ret
  41. restore
  42. .size __vfork,.-__vfork
  43. weak_alias(__vfork,vfork)
  44. libc_hidden_def(vfork)