vfork.S 907 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  3. *
  4. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  5. */
  6. #include <features.h>
  7. #include <asm/unistd.h>
  8. #ifndef __NR_vfork
  9. #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
  10. #endif
  11. #define IMM #
  12. .text
  13. .align 2
  14. .globl errno
  15. .globl vfork
  16. .type vfork,@function
  17. vfork:
  18. movl %sp@+, %a1 /* save the return address for later */
  19. movl IMM __NR_vfork,%d0
  20. trap #0
  21. movl IMM -4097, %d1
  22. cmpl %d0, %d1
  23. bcs fix_errno
  24. jmp %a1@ /* don't return, just jmp directly */
  25. fix_errno:
  26. negl %d0
  27. #ifndef __PIC__ /* needs handling as the other archs */
  28. movl errno, %a0
  29. #else
  30. movl errno@GOT(%a5), %a0
  31. #endif
  32. movl %d0, %a0@
  33. movl IMM -1, %d0
  34. jmp %a1@ /* don't return, just jmp directly */
  35. .size vfork,.-vfork
  36. libc_hidden_def(vfork)