vfork.S 677 B

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