dllprt0.as 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #
  2. # This file is part of the Free Pascal run time library.
  3. # Copyright (c) 2001 by Peter Vreman
  4. #
  5. # See the file COPYING.FPC, included in this distribution,
  6. # for details about the copyright.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY;without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. #
  12. #**********************************************************************}
  13. #
  14. # Linux ELF shared library startup code for Free Pascal
  15. #
  16. .file "dllprt0.as"
  17. .text
  18. .globl _startlib
  19. .type _startlib,@function
  20. _startlib:
  21. .globl FPC_LIB_START
  22. .type FPC_LIB_START,@function
  23. FPC_LIB_START:
  24. pushl %ebp
  25. movl %esp,%ebp
  26. movl 8(%ebp),%eax
  27. movl 12(%ebp),%ecx
  28. movl 16(%ebp),%edx
  29. movl %edx,operatingsystem_parameter_envp /* Move the environment pointer */
  30. movl %eax,operatingsystem_parameter_argc /* Move the argument counter */
  31. movl %ecx,operatingsystem_parameter_argv /* Move the argument pointer */
  32. movb $1,TC_SYSTEM_ISLIBRARY
  33. /* Save initial stackpointer */
  34. movl %esp,__stkptr
  35. call PASCALMAIN
  36. leave
  37. ret
  38. .globl _haltproc
  39. .type _haltproc,@function
  40. _haltproc:
  41. _haltproc2: # GAS <= 2.15 bug: generates larger jump if a label is exported
  42. xorl %eax,%eax
  43. incl %eax /* eax=1, exit call */
  44. movzwl operatingsystem_result,%ebx
  45. int $0x80
  46. jmp _haltproc2
  47. .bss
  48. .type __stkptr,@object
  49. .size __stkptr,4
  50. .global __stkptr
  51. __stkptr:
  52. .skip 4
  53. .type operatingsystem_parameters,@object
  54. .size operatingsystem_parameters,12
  55. operatingsystem_parameters:
  56. .skip 3*4
  57. .global operatingsystem_parameter_envp
  58. .global operatingsystem_parameter_argc
  59. .global operatingsystem_parameter_argv
  60. .set operatingsystem_parameter_envp,operatingsystem_parameters+0
  61. .set operatingsystem_parameter_argc,operatingsystem_parameters+4
  62. .set operatingsystem_parameter_argv,operatingsystem_parameters+8