gprt0.as 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. call PASCALMAIN
  40. .globl _haltproc
  41. .type _haltproc,@function
  42. _haltproc:
  43. xorl %ebx,%ebx /* load and save exitcode */
  44. movw U_SYSLINUX_EXITCODE,%bx
  45. pushl %ebx
  46. call exit /* call libc exit, this will */
  47. /* write the gmon.out */
  48. movl $1,%eax /* exit call */
  49. popl %ebx
  50. int $0x80
  51. jmp _haltproc
  52. .data
  53. .align 4
  54. ___fpucw:
  55. .long 0x1332
  56. .globl ___fpc_brk_addr /* heap management */
  57. .type ___fpc_brk_addr,@object
  58. .size ___fpc_brk_addr,4
  59. ___fpc_brk_addr:
  60. .globl __curbrk /* necessary for libc */
  61. .type __curbrk,@object
  62. .size __curbrk,4
  63. __curbrk:
  64. .long 0
  65. #
  66. # $Log$
  67. # Revision 1.4 1998-10-14 21:28:47 peter
  68. # * initialize fpu so sigfpe is finally generated for fpu errors
  69. #
  70. # Revision 1.3 1998/08/08 14:42:09 peter
  71. # * added missing ___fpc_sbrk and logs
  72. #
  73. #