fork.S 489 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * The fork and vfork system calls are special on sparc64:
  3. * they return the "other process" pid in %o0 and the
  4. * "is child" flag in %o1
  5. */
  6. #include <features.h>
  7. #include <sys/syscall.h>
  8. .text
  9. .global fork
  10. .type fork, @function
  11. .align 4
  12. fork:
  13. mov __NR_fork, %g1
  14. ta 0x6d
  15. sub %o1, 1, %o1
  16. bcc,pt %xcc, 1f
  17. and %o0, %o1, %o0
  18. sethi %hi(errno), %g4
  19. or %g4, %lo(errno), %g4
  20. st %o0, [%g4]
  21. retl
  22. mov -1, %o0
  23. 1:
  24. retl
  25. nop
  26. .size fork, . - fork
  27. libc_hidden_def(fork)