vfork.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifdef __PIC__
  35. mfs r3,rpc
  36. addik r3,r3,_GLOBAL_OFFSET_TABLE_+8
  37. lwi r3,r3,C_SYMBOL_NAME(errno)@GOT
  38. sw r3, r0, r3
  39. #else
  40. swi r3, r0, C_SYMBOL_NAME(errno);
  41. #endif
  42. /* state restore etc */
  43. 2: rtsd r15, 8 /* error return */
  44. nop
  45. .size __vfork, .-__vfork
  46. weak_alias(__vfork,vfork)
  47. libc_hidden_weak(vfork)