vfork.S 884 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * June 27, 2001 Manuel Novoa III
  3. *
  4. * Modified to (hopefully) be PIC and REENTRANT safe.
  5. *
  6. */
  7. .text
  8. .align 4
  9. .globl vfork
  10. .type vfork,@function
  11. vfork:
  12. popl %ecx
  13. movl $190,%eax
  14. #ifdef PIC
  15. pushl %ebx
  16. #endif
  17. #APP
  18. int $0x80
  19. #NO_APP
  20. #ifdef PIC
  21. popl %ebx
  22. #endif
  23. cmpl $-4095,%eax
  24. jae .Lerror
  25. jmp *%ecx
  26. .p2align 4,,7
  27. .Lerror:
  28. pushl %ecx
  29. #ifdef PIC
  30. pushl %ebx
  31. call .Lhere
  32. .Lhere:
  33. popl %ebx
  34. addl $_GLOBAL_OFFSET_TABLE_+[.-.Lhere],%ebx
  35. negl %eax
  36. movl %eax,%ecx
  37. #ifdef __UCLIBC_HAS_THREADS__
  38. call __errno_location@PLT
  39. #else
  40. movl errno@GOT(%ebx),%eax
  41. #endif /* __UCLIBC_HAS_THREADS__ */
  42. movl %ecx,(%eax)
  43. popl %ebx
  44. #else
  45. negl %eax
  46. #ifdef __UCLIBC_HAS_THREADS__
  47. movl %eax,%ecx
  48. call __errno_location
  49. movl %ecx,(%eax)
  50. #else
  51. movl %eax,errno
  52. #endif /* __UCLIBC_HAS_THREADS__ */
  53. #endif /* PIC */
  54. movl $-1,%eax
  55. ret
  56. .Lsize:
  57. .size vfork,.Lsize-vfork