gprt0.as 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //Startup code for WIN32 port of Free Pascal
  2. //Written by P.Ozerski 1998
  3. // modified by Pierre Muller
  4. .text
  5. .globl _mainCRTStartup
  6. _mainCRTStartup:
  7. movb $1,U_SYSTEM_ISCONSOLE
  8. jmp _start
  9. .globl _WinMainCRTStartup
  10. _WinMainCRTStartup:
  11. movb $0,U_SYSTEM_ISCONSOLE
  12. _start:
  13. subl $0x8,%esp
  14. andl $0xfffffff0,%esp
  15. push $_cmain
  16. call _cygwin_crt0
  17. .globl _cmain
  18. _cmain:
  19. subl $0x8,%esp
  20. andl $0xfffffff0,%esp
  21. call __gmon_start__
  22. call ___main
  23. movl %esp,__stkptr
  24. call _FPC_EXE_Entry
  25. ret
  26. .globl __gmon_start__
  27. __gmon_start__:
  28. pushl %ebp
  29. movl __monstarted,%eax
  30. leal 0x1(%eax),%edx
  31. movl %esp,%ebp
  32. movl %edx,__monstarted
  33. testl %eax,%eax
  34. jnz .Lnomonstart
  35. pushl $etext /* Initialize gmon */
  36. pushl $_cmain
  37. call _monstartup
  38. addl $8,%esp
  39. .Lnomonstart:
  40. movl %ebp,%esp
  41. popl %ebp
  42. ret
  43. .globl asm_exit
  44. asm_exit:
  45. pushl %eax
  46. call __mcleanup
  47. popl %eax
  48. pushl %eax
  49. call exitprocess
  50. .text
  51. .globl exitprocess
  52. exitprocess:
  53. jmp *.L10
  54. .balign 4,144
  55. .text
  56. .balign 4,144
  57. .section .idata$2
  58. .rva .L7
  59. .long 0,0
  60. .rva .L6
  61. .rva .L8
  62. .section .idata$4
  63. .L7:
  64. .rva .L9
  65. .long 0
  66. .section .idata$5
  67. .L8:
  68. .section .idata$5
  69. .L10:
  70. .rva .L9
  71. .long 0
  72. .section .idata$6
  73. .L9:
  74. .short 0
  75. .ascii "ExitProcess\000"
  76. .balign 2,0
  77. .section .idata$7
  78. .L6:
  79. .ascii "kernel32.dll\000"
  80. .bss
  81. .lcomm __monstarted,4
  82. .comm __stkptr,4