|
|
1.1 root 1: ! crt1.s for solaris 2.0.
2:
3: ! Copyright (C) 1992 Free Software Foundation, Inc.
4: ! Written By David Vinayak Henkel-Wallace, June 1992
5: !
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 2, or (at your option) any
9: ! later version.
10: !
11: ! In addition to the permissions in the GNU General Public License, the
12: ! Free Software Foundation gives you unlimited permission to link the
13: ! compiled version of this file with other programs, and to distribute
14: ! those programs without any restriction coming from the use of this
15: ! file. (The General Public License restrictions do apply in other
16: ! respects; for example, they cover modification of the file, and
17: ! distribution when not linked into another program.)
18: !
19: ! This file is distributed in the hope that it will be useful, but
20: ! WITHOUT ANY WARRANTY; without even the implied warranty of
21: ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22: ! General Public License for more details.
23: !
24: ! You should have received a copy of the GNU General Public License
25: ! along with this program; see the file COPYING. If not, write to
26: ! the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27: !
28: ! As a special exception, if you link this library with files
29: ! compiled with GCC to produce an executable, this does not cause
30: ! the resulting executable to be covered by the GNU General Public License.
31: ! This exception does not however invalidate any other reasons why
32: ! the executable file might be covered by the GNU General Public License.
33: !
34:
35: ! This file takes control of the process from the kernel, as specified
36: ! in section 3 of the SVr4 ABI.
37: ! This file is the first thing linked into any executable.
38:
39: .section ".text"
40: .proc 022
41: .global _start
42:
43: _start:
44: mov 0, %fp ! Mark bottom frame pointer
45: ld [%sp + 64], %l0 ! argc
46: add %sp, 68, %l1 ! argv
47:
48: ! Leave some room for a call. Sun leaves 32 octets (to sit on
49: ! a cache line?) so we do too.
50: sub %sp, 32, %sp
51:
52: ! %g1 may contain a function to be registered w/atexit
53: orcc %g0, %g1, %g0
54: be .nope
55: mov %g1, %o0
56: call atexit
57: nop
58: .nope:
59: ! Now make sure constructors and destructors are handled.
60: set _fini, %o0
61: call atexit, 1
62: nop
63: call _init, 0
64: nop
65:
66: ! We ignore the auxiliary vector; there's no defined way to
67: ! access those data anyway. Instead, go straight to main:
68: mov %l0, %o0 ! argc
69: mov %l1, %o1 ! argv
70: ! Skip argc words past argv, to env:
71: sll %l0, 2, %o2
72: add %o2, 4, %o2
73: add %l1, %o2, %o2 ! env
74: set _environ, %o3
75: st %o2, [%o3] ! *_environ
76: call main, 4
77: nop
78: call exit, 0
79: nop
80: call _exit, 0
81: nop
82: ! We should never get here.
83:
84: .type _start,#function
85: .size _start,.-_start
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.