prt1.as 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #
  2. # $Id$
  3. # This file is part of the Free Pascal run time library.
  4. # Copyright (c) 1993,97 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_SYSLINUX_ENVP /* Move the environment pointer */
  32. movl %ecx,U_SYSLINUX_ARGC /* Move the argument counter */
  33. movl %ebx,U_SYSLINUX_ARGV /* Move the argument pointer */
  34. call PASCALMAIN
  35. .globl _haltproc
  36. .type _haltproc,@function
  37. _haltproc:
  38. movl $1,%eax /* exit call */
  39. xorl %ebx,%ebx
  40. movw U_SYSLINUX_EXITCODE,%bx
  41. int $0x80
  42. jmp _haltproc
  43. .data
  44. .align 4
  45. .globl ___brk_addr /* heap management */
  46. .type ___brk_addr,@object
  47. .size ___brk_addr,4
  48. ___brk_addr:
  49. .long 0
  50. .globl __curbrk /* necessary for libc */
  51. .type __curbrk,@object
  52. .size __curbrk,4
  53. __curbrk:
  54. .long 0