gprt0.as 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. |
  2. | This file is part of the Free Pascal run time library.
  3. | Copyright (c) 2001 by Free Pascal Core Team
  4. |
  5. | See the file COPYING.FPC, included in this distribution,
  6. | for details about the copyright.
  7. |
  8. | This program is distributed in the hope that it will be useful,
  9. | but WITHOUT ANY WARRANTY;without even the implied warranty of
  10. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. |
  12. |**********************************************************************}
  13. |
  14. | Linux m68k ELF startup code with profiling support for Free Pascal
  15. | Note: Needs linking with -lgmon and -lc
  16. |
  17. .file "gprt0.as"
  18. .text
  19. .globl _start
  20. .type _start,@function
  21. _start:
  22. .globl __entry
  23. .type __entry,@function
  24. __entry:
  25. move.l 8(%sp),%d0
  26. move.l %d0,U_SYSLINUX_ENVP
  27. move.l %d0,__environ
  28. move.l 4(%sp),%d0
  29. move.l %d0,U_SYSLINUX_ARGV
  30. move.l (%sp),%d0
  31. move.l %d0,U_SYSLINUX_ARGC
  32. | Initialize gmon
  33. | Should this be done before or after __libc_init call ??
  34. |
  35. move.l _etext,-(%sp) /* Initialize gmon */
  36. move.l _start,-(%sp)
  37. jsr monstartup
  38. addq.l #8,%sp
  39. move.l _mcleanup,-(%sp)
  40. jsr atexit
  41. addq.l #4,%sp
  42. | The arguments should be in correct order for
  43. | calling __libc_init
  44. | This code is untested for now PM
  45. jsr __libc_init
  46. | insert _fini in atexit chain
  47. move.l _fini,-(%sp)
  48. jsr atexit
  49. addq.l #4,%sp
  50. | call _init function
  51. jsr _init
  52. jsr PASCALMAIN
  53. | Used by System_exit procedure
  54. .globl _haltproc
  55. _haltproc:
  56. | Call C exit function
  57. move.w U_SYSLINUX_EXITCODE,%d1
  58. move.l %d1,-(%sp)
  59. jsr exit
  60. moveq.l #1,%d0
  61. move.l (%sp)+,%d1
  62. trap #0
  63. bra _haltproc
  64. | Is this still needed ??
  65. | .data
  66. | .align 4
  67. | .globl ___fpc_brk_addr
  68. |___fpc_brk_addr:
  69. | .long 0