1| 2| $Id: gprt21.as,v 1.1.2.2 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 44 45| The arguments should be in correct order for 46| calling __libc_init 47| This code is untested for now PM 48 jsr __libc_init 49| insert _fini in atexit chain 50 move.l _fini,-(%sp) 51 jsr atexit 52 addq.l #4,%sp 53| call _init function 54 jsr _init 55 56 jsr PASCALMAIN 57 58| Used by System_exit procedure 59 .globl _haltproc 60_haltproc: 61| Call C exit function 62 move.w U_SYSLINUX_EXITCODE,%d1 63 move.l %d1,-(%sp) 64 jsr exit 65 moveq.l #1,%d0 66 move.l (%sp)+,%d1 67 trap #0 68 bra _haltproc 69 70 71| Is this still needed ?? 72| .data 73| .align 4 74| .globl ___fpc_brk_addr 75|___fpc_brk_addr: 76| .long 0 77 78 79| 80| $Log: gprt21.as,v $ 81| Revision 1.1.2.2 2001/08/01 13:26:17 pierre 82| * syntax adapted to GNU as 83| 84| Revision 1.1.2.1 2001/07/13 15:45:40 pierre 85| simple copies of cprt0 and gprt0 added 86| 87| Revision 1.1.2.2 2001/07/13 15:43:22 pierre 88| assembler error corrected 89| 90| Revision 1.1.2.1 2001/07/13 15:38:54 pierre 91| first version of gprt0.as file 92| 93| 94| 95 96