prt0.as 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_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. 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_SYSLINUX_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.1 2000-07-13 06:30:55 michael
  59. # + Initial import
  60. #
  61. # Revision 1.9 2000/02/08 12:39:48 peter
  62. # * removed curbrk
  63. #
  64. # Revision 1.8 2000/01/07 16:41:42 daniel
  65. # * copyright 2000
  66. #
  67. # Revision 1.7 2000/01/07 16:32:28 daniel
  68. # * copyright 2000 added
  69. #
  70. # Revision 1.6 1999/11/08 23:07:48 peter
  71. # * removed aout entries
  72. #
  73. # Revision 1.5 1998/11/04 10:16:29 peter
  74. # + xorl ebp,ebp to indicate end of backtrace
  75. #
  76. # Revision 1.4 1998/10/14 21:28:50 peter
  77. # * initialize fpu so sigfpe is finally generated for fpu errors
  78. #
  79. # Revision 1.3 1998/08/08 14:42:12 peter
  80. # * added missing ___fpc_sbrk and logs
  81. #
  82. #