vfork.S 1.0 KB

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