cprt0.as 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. .file "crt0.c"
  2. gcc2_compiled.:
  3. .data
  4. .align 32
  5. .type rcsid , @object
  6. .size rcsid , 58
  7. rcsid:
  8. .string "$OpenBSD: crt0.c,v 1.11 2003/06/27 22:30:38 deraadt Exp $"
  9. .globl __progname
  10. .section .rodata
  11. .LC0:
  12. .string ""
  13. .data
  14. .align 4
  15. .type __progname , @object
  16. .size __progname , 4
  17. __progname:
  18. .long .LC0
  19. .global __progname_storage
  20. .type __progname_storage, @ object
  21. .size __progname_storage, 256
  22. .align 4
  23. ___fpucw:
  24. .long 0x1332
  25. .globl ___fpc_brk_addr /* heap management */
  26. .type ___fpc_brk_addr,@object
  27. .size ___fpc_brk_addr,4
  28. ___fpc_brk_addr:
  29. .long 0
  30. #APP
  31. .text
  32. .align 4
  33. .globl __start
  34. .globl _start
  35. _start:
  36. __start:
  37. pushl %ebx #ps_strings
  38. pushl %ecx # obj
  39. pushl %edx # cleanup
  40. movl 12(%esp),%eax
  41. leal 20(%esp,%eax,4),%ecx
  42. leal 16(%esp),%edx
  43. pushl %ecx
  44. pushl %edx
  45. pushl %eax
  46. call ___start
  47. #NO_APP
  48. .text
  49. .align 4
  50. .globl ___start
  51. .type ___start , @function
  52. ___start:
  53. pushl %ebp
  54. movl %esp,%ebp
  55. subl $16,%esp
  56. pushl %esi
  57. pushl %ebx
  58. movl 12(%ebp),%esi
  59. movl 16(%ebp),%eax
  60. movl %eax,environ
  61. movl %eax,operatingsystem_parameter_envp
  62. movl (%esi),%ebx
  63. testl %ebx,%ebx
  64. je .L3
  65. addl $-8,%esp
  66. pushl $47
  67. pushl %ebx
  68. call _strrchr
  69. movl %eax,__progname
  70. addl $16,%esp
  71. testl %eax,%eax
  72. jne .L4
  73. movl %ebx,__progname
  74. jmp .L5
  75. .p2align 4,,7
  76. .L4:
  77. incl %eax
  78. movl %eax,__progname
  79. .L5:
  80. movl $__progname_storage,%edx
  81. jmp .L12
  82. .p2align 4,,7
  83. .L9:
  84. movb (%eax),%al
  85. movb %al,(%edx)
  86. incl __progname
  87. incl %edx
  88. .L12:
  89. movl __progname,%eax
  90. cmpb $0,(%eax)
  91. je .L7
  92. cmpl $__progname_storage+255,%edx
  93. jb .L9
  94. .L7:
  95. movb $0,(%edx)
  96. movl $__progname_storage,__progname
  97. .L3:
  98. call __init
  99. subl $16,%esp
  100. pushl %eax
  101. movl 8(%ebp),%eax
  102. movl %eax,operatingsystem_parameter_argc
  103. movl %esi,operatingsystem_parameter_argv
  104. popl %eax
  105. # pushl environ
  106. # pushl %esi
  107. # pushl 8(%ebp)
  108. finit
  109. fwait
  110. fldcw ___fpucw
  111. xorl %ebp,%ebp
  112. call main
  113. pushl %eax
  114. call exit
  115. .p2align 2,0x90
  116. .globl _haltproc
  117. .type _haltproc,@function
  118. _haltproc:
  119. mov $1,%eax
  120. movzwl operatingsystem_result,%ebx
  121. pushl %ebx
  122. call .Lactualsyscall
  123. addl $4,%esp
  124. jmp _haltproc
  125. .Lactualsyscall:
  126. int $0x80
  127. jb .LErrorcode
  128. xor %ebx,%ebx
  129. ret
  130. .LErrorcode:
  131. mov %eax,%ebx
  132. mov $-1,%eax
  133. ret
  134. .p2align 2,0x90
  135. .Lfe1:
  136. .size ___start , . - ___start
  137. .align 4
  138. .type _strrchr , @function
  139. _strrchr:
  140. pushl %ebp
  141. movl %esp,%ebp
  142. pushl %ebx
  143. movl 8(%ebp),%eax
  144. movb 12(%ebp),%bl
  145. xorl %ecx,%ecx
  146. .p2align 4,,7
  147. .L14:
  148. movb (%eax),%dl
  149. cmpb %bl,%dl
  150. jne .L17
  151. movl %eax,%ecx
  152. .L17:
  153. testb %dl,%dl
  154. je .L16
  155. incl %eax
  156. jmp .L14
  157. .p2align 4,,7
  158. .L16:
  159. movl %ecx,%eax
  160. popl %ebx
  161. leave
  162. ret
  163. .size _strrchr , . - _strrchr
  164. .comm environ,4,4
  165. .comm __progname_storage,256,32
  166. .comm operatingsystem_parameter_envp,4,4
  167. .comm operatingsystem_parameter_argc,4,4
  168. .comm operatingsystem_parameter_argv,4,4