vfork.S 1.0 KB

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