vfork.S 817 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <features.h>
  2. #include <asm/unistd.h>
  3. #ifndef __NR_vfork
  4. #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
  5. #endif
  6. #define IMM #
  7. .text
  8. .align 2
  9. .globl errno
  10. .globl __vfork
  11. #ifdef __HAVE_ELF__
  12. .hidden __vfork
  13. .type __vfork,@function
  14. #endif
  15. __vfork:
  16. movl %sp@+, %a1 /* save the return address for later */
  17. movl IMM __NR_vfork,%d0
  18. trap #0
  19. movl IMM -4097, %d1
  20. cmpl %d0, %d1
  21. bcs fix_errno
  22. jmp %a1@ /* don't return, just jmp directly */
  23. fix_errno:
  24. negl %d0
  25. #ifndef __PIC__ /* needs handling as the other archs */
  26. movl errno, %a0
  27. #else
  28. movl errno@GOT(%a5), %a0
  29. #endif
  30. movl %d0, %a0@
  31. movl IMM -1, %d0
  32. jmp %a1@ /* don't return, just jmp directly */
  33. .size __vfork,.-__vfork
  34. strong_alias(__vfork,vfork)