vfork.S 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 <libc-symbols.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. .globl __vfork
  26. .align 4
  27. __vfork:
  28. addi r12, r0, SYS_vfork
  29. brki r14, 0x08;
  30. addi r4, r3, 125 /* minimum err value */
  31. blti r4, 1f /* is r3 < -125? */
  32. bri 2f /* normal return */
  33. 1: sub r3, r3, r0 /* r3 = -r3 */
  34. swi r3, r0, C_SYMBOL_NAME(errno);
  35. /* state restore etc */
  36. 2: rtsd r15, 8 /* error return */
  37. nop
  38. .size __vfork, .-__vfork
  39. weak_alias(__vfork,vfork)
  40. libc_hidden_weak(vfork)