vfork.S 1.1 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. #define _ERRNO_H 1
  14. #include <bits/errno.h>
  15. #define _SYSCALL_H
  16. #include <bits/sysnum.h>
  17. #include <clinkage.h>
  18. /* Clone the calling process, but without copying the whole address space.
  19. The calling process is suspended until the new process exits or is
  20. replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
  21. and the process ID of the new process to the old process. */
  22. .global C_SYMBOL_NAME(errno)
  23. C_ENTRY (__vfork):
  24. addi SYS_vfork, r0, r12
  25. trap 0
  26. addi -125, r0, r11 // minimum err value
  27. cmp r11, r10
  28. bh 1f
  29. jmp [lp] // normal return
  30. 1: mov hilo(C_SYMBOL_NAME(errno)), r11
  31. subr r0, r10
  32. st.w r10, 0[r11]
  33. jmp [lp] // error return
  34. C_END(__vfork)
  35. .weak C_SYMBOL_NAME(vfork)
  36. C_SYMBOL_NAME(vfork) = C_SYMBOL_NAME(__vfork)