vfork.S 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * libc/sysdeps/linux/microblaze/vfork.S -- `vfork' syscall for linux/microblaze
  3. *
  4. * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
  5. * Copyright (C) 2001 NEC Corporation
  6. * Copyright (C) 2001 Miles Bader <miles@gnu.org>
  7. *
  8. * This file is subject to the terms and conditions of the GNU Lesser
  9. * General Public License. See the file COPYING.LIB in the main
  10. * directory of this archive for more details.
  11. *
  12. * Written by Miles Bader <miles@gnu.org>
  13. * Microblaze port by John Williams
  14. */
  15. #define _ERRNO_H 1
  16. #include <bits/errno.h>
  17. #define _SYSCALL_H
  18. #include <bits/sysnum.h>
  19. #include <clinkage.h>
  20. /* Clone the calling process, but without copying the whole address space.
  21. The calling process is suspended until the new process exits or is
  22. replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
  23. and the process ID of the new process to the old process. */
  24. .global C_SYMBOL_NAME(errno)
  25. C_ENTRY (__vfork):
  26. addi r12, r0, SYS_vfork
  27. bralid r17, 0x08;
  28. nop
  29. addi r4, r3, 125 // minimum err value
  30. blti r4, 1f // is r3 < -125?
  31. rtsd r15, 8 // normal return
  32. nop
  33. 1: sub r3, r3, r0 // r3 = -r3
  34. swi r3, r0, C_SYMBOL_NAME(errno);
  35. rtsd r15, 8 // error return
  36. nop
  37. C_END(__vfork)
  38. .weak C_SYMBOL_NAME(vfork)
  39. C_SYMBOL_NAME(vfork) = C_SYMBOL_NAME(__vfork)