gprt0.as 2.4 KB

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