vfork.S 573 B

12345678910111213141516171819202122232425262728293031
  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. .h8300h
  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. mov.l @sp+, er1
  15. sub.l er0,er0
  16. mov.b #__NR_vfork,r0l
  17. trapa #0
  18. mov.l #-4096, er2
  19. cmp.l er0,er2
  20. bcs fix_errno
  21. jmp @er1 /* don't return, just jmp directly */
  22. fix_errno:
  23. neg.l er0
  24. mov.l er0,@_errno
  25. sub.l er0,er0
  26. dec.l #1,er0
  27. jmp @er1 /* don't return, just jmp directly */