vfork.s 335 B

123456789101112131415161718192021222324
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .sect .text
  3. .define _vfork
  4. vfork = 66
  5. .align 1
  6. _vfork:
  7. .data2 0x0000
  8. movl 16(fp),r2
  9. movab 1f,16(fp) ! dirty. Only one process can do return,
  10. ! so do it before forking
  11. ret
  12. 1:
  13. chmk $vfork
  14. bcs 3f
  15. tstl r1
  16. beql 1f
  17. clrl r0
  18. 1:
  19. jmp (r2)
  20. 3:
  21. movl r0,_errno
  22. mnegl $1,r0
  23. jmp (r2)