vfork.S 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * libc/sysdeps/linux/v850/vfork.S -- `vfork' syscall for linux/v850
  3. *
  4. * Copyright (C) 2001,2002 NEC Corporation
  5. * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
  6. *
  7. * This file is subject to the terms and conditions of the GNU Lesser
  8. * General Public License. See the file COPYING.LIB in the main
  9. * directory of this archive for more details.
  10. *
  11. * Written by Miles Bader <miles@gnu.org>
  12. */
  13. #include <features.h>
  14. #define _ERRNO_H 1
  15. #include <bits/errno.h>
  16. #define _SYSCALL_H
  17. #include <bits/sysnum.h>
  18. #include <clinkage.h>
  19. /* Clone the calling process, but without copying the whole address space.
  20. The calling process is suspended until the new process exits or is
  21. replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
  22. and the process ID of the new process to the old process. */
  23. .global C_SYMBOL_NAME(errno)
  24. C_ENTRY (__vfork):
  25. addi SYS_vfork, r0, r12
  26. trap 0
  27. addi -125, r0, r11 /* minimum err value */
  28. cmp r11, r10
  29. bh 1f
  30. jmp [lp] /* normal return */
  31. 1: mov hilo(C_SYMBOL_NAME(errno)), r11
  32. subr r0, r10
  33. st.w r10, 0[r11]
  34. jmp [lp] /* error return */
  35. C_END(__vfork)
  36. weak_alias(__vfork,vfork)
  37. libc_hidden_weak(vfork)