vfork.S 924 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 IMM -4097, %d1
  21. cmpl %d0, %d1
  22. bcs fix_errno
  23. jmp %a1@ /* don't return, just jmp directly */
  24. fix_errno:
  25. negl %d0
  26. #ifndef __PIC__ /* needs handling as the other archs */
  27. movl errno, %a0
  28. #else
  29. movl errno@GOT(%a5), %a0
  30. #endif
  31. movl %d0, %a0@
  32. movl IMM -1, %d0
  33. jmp %a1@ /* don't return, just jmp directly */
  34. .size __vfork,.-__vfork
  35. weak_alias(__vfork,vfork)
  36. libc_hidden_def(vfork)