gprt0.as 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 a.out startup code with profiling support for Free Pascal
  17. # Note: Needs linking with -lgmon and -lc
  18. #
  19. .file "gprt0.as"
  20. .text
  21. .globl __entry
  22. __entry:
  23. movl 8(%esp),%eax /* Move the environment pointer */
  24. movl 4(%esp),%ebx /* Move the argument pointer */
  25. movl (%esp),%ecx /* Move the argument counter */
  26. movl %eax,U_SYSLINUX_ENVP
  27. movl %ebx,U_SYSLINUX_ARGV
  28. movl %ecx,U_SYSLINUX_ARGC
  29. pushl $_etext /* Initialize gmon */
  30. pushl $_start
  31. call monstartup
  32. addl $8,%esp
  33. pushl $_mcleanup
  34. call atexit
  35. addl $4,%esp
  36. call PASCALMAIN
  37. .globl _haltproc
  38. .type _haltproc,@function
  39. _haltproc:
  40. xorl %ebx,%ebx /* load and save exitcode */
  41. movw U_SYSLINUX_EXITCODE,%bx
  42. pushl %ebx
  43. call exit /* call libc exit, this will */
  44. /* write the gmon.out */
  45. movl $1,%eax /* exit call */
  46. popl %ebx
  47. int $0x80
  48. jmp _haltproc
  49. .data
  50. .align 4
  51. .globl ___brk_addr
  52. .type ___brk_addr,@object
  53. .size ___brk_addr,4
  54. ___brk_addr:
  55. .long 0
  56. .globl __curbrk /* necessary for libc */
  57. .type __curbrk,@object
  58. .size __curbrk,4
  59. __curbrk:
  60. .long 0