prt1.as 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. finit /* initialize fpu */
  35. fwait
  36. fldcw ___fpucw
  37. call PASCALMAIN
  38. .globl _haltproc
  39. .type _haltproc,@function
  40. _haltproc:
  41. movl $1,%eax /* exit call */
  42. xorl %ebx,%ebx
  43. movw U_SYSLINUX_EXITCODE,%bx
  44. int $0x80
  45. jmp _haltproc
  46. .data
  47. .align 4
  48. ___fpucw:
  49. .long 0x1332
  50. .globl ___fpc_brk_addr /* heap management */
  51. .type ___fpc_brk_addr,@object
  52. .size ___fpc_brk_addr,4
  53. ___fpc_brk_addr:
  54. .long 0
  55. .globl __curbrk /* necessary for libc */
  56. .type __curbrk,@object
  57. .size __curbrk,4
  58. __curbrk:
  59. .long 0
  60. #
  61. # $Log$
  62. # Revision 1.4 1998-10-14 21:28:50 peter
  63. # * initialize fpu so sigfpe is finally generated for fpu errors
  64. #
  65. # Revision 1.3 1998/08/08 14:42:12 peter
  66. # * added missing ___fpc_sbrk and logs
  67. #
  68. #