1 ! crt1.s for sparc & sparcv9 (SunOS 5)
3 ! Copyright (C) 1992-2015 Free Software Foundation, Inc.
4 ! Written By David Vinayak Henkel-Wallace, June 1992
6 ! This file is free software; you can redistribute it and/or modify it
7 ! under the terms of the GNU General Public License as published by the
8 ! Free Software Foundation; either version 3, or (at your option) any
11 ! This file is distributed in the hope that it will be useful, but
12 ! WITHOUT ANY WARRANTY; without even the implied warranty of
13 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ! General Public License for more details.
16 ! Under Section 7 of GPL version 3, you are granted additional
17 ! permissions described in the GCC Runtime Library Exception, version
18 ! 3.1, as published by the Free Software Foundation.
20 ! You should have received a copy of the GNU General Public License and
21 ! a copy of the GCC Runtime Library Exception along with this program;
22 ! see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 ! <http://www.gnu.org/licenses/>.
25 ! This file takes control of the process from the kernel, as specified
26 ! in section 3 of the SVr4 ABI.
27 ! This file is the first thing linked into any executable.
32 #define STACK_BIAS 2047
35 #define setn(s, scratch, dst) setx s, scratch, dst
42 #define setn(s, scratch, dst) set s, dst
50 mov 0, %fp ! Mark bottom frame pointer
51 ldn [%sp + (16 * CPTRSIZE) + STACK_BIAS], %l0 ! argc
52 add %sp, (17 * CPTRSIZE) + STACK_BIAS, %l1 ! argv
54 ! Leave some room for a call. Sun leaves 32 octets (to sit on
55 ! a cache line?) so we do too.
62 ! %g1 may contain a function to be registered w/atexit
73 ! Now make sure constructors and destructors are handled.
80 ! We ignore the auxiliary vector; there is no defined way to
81 ! access those data anyway. Instead, go straight to main:
85 setn(___Argv, %o4, %o3)
86 stn %o1, [%o3] ! *___Argv
88 ! Skip argc words past argv, to env:
89 sll %l0, CPTRSHIFT, %o2
90 add %o2, CPTRSIZE, %o2
91 add %l1, %o2, %o2 ! env
92 setn(_environ, %o4, %o3)
93 stn %o2, [%o3] ! *_environ
100 ! We should never get here.
102 .type _start,#function
103 .size _start,.-_start