gprt0.as 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. finit /* initialize fpu */
  30. fwait
  31. fldcw ___fpucw
  32. pushl $_etext /* Initialize gmon */
  33. pushl $_start
  34. call monstartup
  35. addl $8,%esp
  36. pushl $_mcleanup
  37. call atexit
  38. addl $4,%esp
  39. xorl %ebp,%ebp
  40. call PASCALMAIN
  41. .globl _haltproc
  42. .type _haltproc,@function
  43. _haltproc:
  44. xorl %ebx,%ebx /* load and save exitcode */
  45. movw U_SYSLINUX_EXITCODE,%bx
  46. pushl %ebx
  47. call exit /* call libc exit, this will */
  48. /* write the gmon.out */
  49. movl $1,%eax /* exit call */
  50. popl %ebx
  51. int $0x80
  52. jmp _haltproc
  53. .data
  54. .align 4
  55. ___fpucw:
  56. .long 0x1332
  57. .globl ___fpc_brk_addr /* heap management */
  58. .type ___fpc_brk_addr,@object
  59. .size ___fpc_brk_addr,4
  60. ___fpc_brk_addr:
  61. .globl __curbrk /* necessary for libc */
  62. .type __curbrk,@object
  63. .size __curbrk,4
  64. __curbrk:
  65. .long 0
  66. #
  67. # $Log$
  68. # Revision 1.5 1998-11-04 10:16:26 peter
  69. # + xorl ebp,ebp to indicate end of backtrace
  70. #
  71. # Revision 1.4 1998/10/14 21:28:47 peter
  72. # * initialize fpu so sigfpe is finally generated for fpu errors
  73. #
  74. # Revision 1.3 1998/08/08 14:42:09 peter
  75. # * added missing ___fpc_sbrk and logs
  76. #
  77. #