]>
Commit | Line | Data |
---|---|---|
49b98627 | 1 | /* Startup code for Alpha/ELF. |
71bedb76 | 2 | Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. |
ae1025be UD |
3 | This file is part of the GNU C Library. |
4 | Contributed by Richard Henderson <rth@tamu.edu> | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Library General Public License as | |
8 | published by the Free Software Foundation; either version 2 of the | |
9 | License, or (at your option) any later version. | |
10 | ||
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Library General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Library General Public | |
17 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
18 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
b20e47cb RM |
20 | |
21 | #include <sysdep.h> | |
22 | ||
b20e47cb | 23 | .text |
a1470b6f | 24 | .align 3 |
edf5b2d7 | 25 | .globl _start |
57ba7bb4 | 26 | .ent _start, 0 |
a3e59be8 | 27 | _start: |
a1470b6f RM |
28 | .frame fp, 0, zero |
29 | mov zero, fp | |
30 | br gp, 1f | |
31 | 1: ldgp gp, 0(gp) | |
69bf5f75 | 32 | subq sp, 16, sp |
7d84a067 | 33 | .prologue 0 |
a1470b6f | 34 | |
71bedb76 UD |
35 | /* Load address of the user's main function. */ |
36 | lda a0, main | |
a1470b6f | 37 | |
69bf5f75 UD |
38 | ldl a1, 16(sp) /* get argc */ |
39 | lda a2, 24(sp) /* get argv */ | |
b20e47cb | 40 | |
71bedb76 UD |
41 | /* Load address of our own entry points to .fini and .init. */ |
42 | lda a3, _init | |
43 | lda a4, _fini | |
b20e47cb | 44 | |
71bedb76 UD |
45 | /* Store address of the shared library termination function. */ |
46 | mov v0, a5 | |
b20e47cb | 47 | |
69bf5f75 UD |
48 | /* Provide the highest stack address to the user code. */ |
49 | stq sp, 0(sp) | |
50 | ||
71bedb76 | 51 | /* Call the user's main function, and exit with its value. |
69bf5f75 | 52 | But let the libc call main. */ |
71bedb76 | 53 | jsr ra, __libc_start_main |
57ba7bb4 | 54 | |
a1470b6f RM |
55 | /* Die very horribly if exit returns. Call_pal hlt is callable from |
56 | kernel mode only; this will result in an illegal instruction trap. */ | |
57 | call_pal 0 | |
57ba7bb4 UD |
58 | .end _start |
59 | ||
60 | /* For ECOFF backwards compatibility. */ | |
61 | weak_alias(_start, __start) |