crt1.s 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. .file "crt1.c"
  2. .version "01.01"
  3. gcc2_compiled.:
  4. .globl __progname
  5. .section .rodata
  6. .LC0:
  7. .ascii "\0"
  8. .data
  9. .p2align 2
  10. .type __progname,@object
  11. .size __progname,4
  12. __progname:
  13. .long .LC0
  14. .align 4
  15. ___fpucw:
  16. .long 0x1332
  17. .globl ___fpc_brk_addr /* heap management */
  18. .type ___fpc_brk_addr,@object
  19. .size ___fpc_brk_addr,4
  20. ___fpc_brk_addr:
  21. .long 0
  22. .text
  23. .p2align 2
  24. .globl _start
  25. .type _start,@function
  26. _start:
  27. pushl %ebp
  28. movl %esp,%ebp
  29. pushl %edi
  30. pushl %esi
  31. pushl %ebx
  32. #APP
  33. movl %edx,%edx
  34. #NO_APP
  35. leal 8(%ebp),%edi
  36. movl %edi,U_SYSLINUX_ARGV
  37. mov -4(%edi),%eax
  38. movl %eax,U_SYSLINUX_ARGC
  39. movl 4(%ebp),%ebx
  40. leal 12(%ebp,%ebx,4),%esi
  41. movl %esi,U_SYSLINUX_ENVP
  42. movl %esi,environ
  43. testl %ebx,%ebx
  44. jle .L2
  45. movl 8(%ebp),%eax
  46. testl %eax,%eax
  47. je .L2
  48. movl %eax,__progname
  49. cmpb $0,(%eax)
  50. je .L2
  51. .p2align 2,0x90
  52. .L6:
  53. cmpb $47,(%eax)
  54. jne .L5
  55. leal 1(%eax),%ecx
  56. movl %ecx,__progname
  57. .L5:
  58. incl %eax
  59. cmpb $0,(%eax)
  60. jne .L6
  61. .L2:
  62. #movl $_DYNAMIC,%eax
  63. #testl %eax,%eax
  64. #je .L9
  65. #pushl %edx
  66. #call atexit
  67. #addl $4,%esp
  68. .L9:
  69. #pushl $_fini
  70. #call atexit
  71. #call _init
  72. #pushl %esi
  73. #pushl %edi
  74. #pushl %ebx
  75. # copied from linux
  76. finit /* initialize fpu */
  77. fwait
  78. fldcw ___fpucw
  79. xorl %ebp,%ebp
  80. call main
  81. pushl %eax
  82. jmp _haltproc
  83. .globl _haltproc
  84. .type _haltproc,@function
  85. _haltproc:
  86. mov $1,%eax
  87. movzwl U_SYSLINUX_EXITCODE,%ebx
  88. pushl %ebx
  89. call _actualsyscall
  90. addl $4,%esp
  91. jmp _haltproc
  92. .globl _actualsyscall
  93. .type _actualsyscall,@function
  94. _actualsyscall:
  95. int $0x80
  96. ret
  97. .p2align 2,0x90
  98. .Lfe1:
  99. .size _start,.Lfe1-_start
  100. .comm environ,4,4
  101. .weak _DYNAMIC
  102. .ident "GCC: (GNU) 2.7.2.1"