vfork.S 790 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 <sys/syscall.h>
  7. #ifndef __NR_vfork
  8. #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
  9. #endif
  10. #define IMM #
  11. .text
  12. .align 2
  13. .globl __vfork
  14. .hidden __vfork
  15. .type __vfork,@function
  16. __vfork:
  17. movl %sp@+, %a1 /* save the return address for later */
  18. movl IMM __NR_vfork,%d0
  19. trap #0
  20. movl %a1, -(%sp)
  21. cmpil #-4096,%d0
  22. blss 1f
  23. neg.l %d0
  24. #ifndef __PIC__ /* needs handling as the other archs */
  25. movl errno, %a0
  26. #else
  27. movl errno@GOT(%a5), %a0
  28. #endif
  29. movl %d0, %a0@
  30. move.l #-1, %d0
  31. 1:
  32. move.l %d0, %a0
  33. rts
  34. .size __vfork,.-__vfork
  35. weak_alias(__vfork,vfork)
  36. libc_hidden_def(vfork)