prt0.as 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #
  2. # $Id$
  3. # This file is part of the Free Pascal run time library.
  4. # Copyright (c) 1999-2000 by Michael Van Canneyt and Peter Vreman
  5. # members of the Free Pascal development team.
  6. #
  7. # See the file COPYING.FPC, included in this distribution,
  8. # for details about the copyright.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY;without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. #
  14. #**********************************************************************}
  15. #
  16. # Linux ELF startup code for Free Pascal
  17. #
  18. .file "prt1.as"
  19. .text
  20. .globl _start
  21. .type _start,@function
  22. _start:
  23. /* First locate the start of the environment variables */
  24. popl %ecx
  25. movl %esp,%ebx /* Points to the arguments */
  26. movl %ecx,%eax
  27. incl %eax
  28. shll $2,%eax
  29. addl %esp,%eax
  30. andl $0xfffffff8,%esp /* Align stack */
  31. movl %eax,U_SYSTEM_ENVP /* Move the environment pointer */
  32. movl %ecx,U_SYSTEM_ARGC /* Move the argument counter */
  33. movl %ebx,U_SYSTEM_ARGV /* Move the argument pointer */
  34. finit /* initialize fpu */
  35. fwait
  36. fldcw ___fpucw
  37. xorl %ebp,%ebp
  38. call PASCALMAIN
  39. .globl _haltproc
  40. .type _haltproc,@function
  41. _haltproc:
  42. movl $1,%eax /* exit call */
  43. xorl %ebx,%ebx
  44. movw U_SYSTEM_EXITCODE,%bx
  45. int $0x80
  46. jmp _haltproc
  47. .data
  48. .align 4
  49. ___fpucw:
  50. .long 0x1332
  51. .globl ___fpc_brk_addr /* heap management */
  52. .type ___fpc_brk_addr,@object
  53. .size ___fpc_brk_addr,4
  54. ___fpc_brk_addr:
  55. .long 0
  56. #
  57. # $Log$
  58. # Revision 1.3 2002-09-07 16:01:20 peter
  59. # * old logs removed and tabs fixed
  60. #