vfork.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #include <sys/syscall.h>
  16. /* Clone the calling process, but without copying the whole address space.
  17. The calling process is suspended until the new process exits or is
  18. replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
  19. and the process ID of the new process to the old process. */
  20. .globl __vfork
  21. .hidden __vfork
  22. .align 4
  23. __vfork:
  24. addi r12, r0, SYS_vfork
  25. brki r14, 0x08;
  26. addi r4, r3, 125 /* minimum err value */
  27. blti r4, 1f /* is r3 < -125? */
  28. bri 2f /* normal return */
  29. 1: sub r3, r3, r0 /* r3 = -r3 */
  30. #ifdef __PIC__
  31. mfs r3,rpc
  32. addik r3,r3,_GLOBAL_OFFSET_TABLE_+8
  33. lwi r3,r3,C_SYMBOL_NAME(errno)@GOT
  34. sw r3, r0, r3
  35. #else
  36. swi r3, r0, C_SYMBOL_NAME(errno);
  37. #endif
  38. /* state restore etc */
  39. 2: rtsd r15, 8 /* error return */
  40. nop
  41. .size __vfork, .-__vfork
  42. weak_alias(__vfork,vfork)
  43. libc_hidden_def(vfork)