vfork.S 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * libc/sysdeps/linux/microblaze/vfork.S -- `vfork' syscall for linux/microblaze
  3. *
  4. * Copyright (C) 2001 NEC Corporation
  5. * Copyright (C) 2001 Miles Bader <miles@gnu.org>
  6. * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
  7. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  8. *
  9. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  10. */
  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_alias(__vfork,vfork)
  39. libc_hidden_weak(vfork)