OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [sparc/] [sol2-c1.asm] - Blame information for rev 841

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
! crt1.s for sparc & sparcv9 (SunOS 5)
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, 51 Franklin Street, Fifth Floor,
27
! Boston, MA 02110-1301, USA.
28
!
29
!    As a special exception, if you link this library with files
30
!    compiled with GCC to produce an executable, this does not cause
31
!    the resulting executable to be covered by the GNU General Public License.
32
!    This exception does not however invalidate any other reasons why
33
!    the executable file might be covered by the GNU General Public License.
34
!
35
 
36
! This file takes control of the process from the kernel, as specified
37
! in section 3 of the SVr4 ABI.
38
! This file is the first thing linked into any executable.
39
 
40
#ifdef __sparcv9
41
#define CPTRSIZE        8
42
#define CPTRSHIFT       3
43
#define STACK_BIAS      2047
44
#define ldn             ldx
45
#define stn             stx
46
#define setn(s, scratch, dst)   setx s, scratch, dst
47
#else
48
#define CPTRSIZE        4
49
#define CPTRSHIFT       2
50
#define STACK_BIAS      0
51
#define ldn             ld
52
#define stn             st
53
#define setn(s, scratch, dst)   set s, dst
54
#endif
55
 
56
        .section        ".text"
57
        .proc   022
58
        .global _start
59
 
60
_start:
61
        mov     0, %fp          ! Mark bottom frame pointer
62
        ldn     [%sp + (16 * CPTRSIZE) + STACK_BIAS], %l0       ! argc
63
        add     %sp, (17 * CPTRSIZE) + STACK_BIAS, %l1          ! argv
64
 
65
        ! Leave some room for a call.  Sun leaves 32 octets (to sit on
66
        ! a cache line?) so we do too.
67
#ifdef __sparcv9
68
        sub     %sp, 48, %sp
69
#else
70
        sub     %sp, 32, %sp
71
#endif
72
 
73
        ! %g1 may contain a function to be registered w/atexit
74
        orcc    %g0, %g1, %g0
75
#ifdef __sparcv9
76
        be      %xcc, .nope
77
#else
78
        be      .nope
79
#endif
80
        mov     %g1, %o0
81
        call    atexit
82
        nop
83
.nope:
84
        ! Now make sure constructors and destructors are handled.
85
        setn(_fini, %o1, %o0)
86
        call    atexit, 1
87
        nop
88
        call    _init, 0
89
        nop
90
 
91
        ! We ignore the auxiliary vector; there is no defined way to
92
        ! access those data anyway.  Instead, go straight to main:
93
        mov     %l0, %o0        ! argc
94
        mov     %l1, %o1        ! argv
95
#ifdef GCRT1
96
        setn(___Argv, %o4, %o3)
97
        stn     %o1, [%o3]      ! *___Argv
98
#endif
99
        ! Skip argc words past argv, to env:
100
        sll     %l0, CPTRSHIFT, %o2
101
        add     %o2, CPTRSIZE, %o2
102
        add     %l1, %o2, %o2   ! env
103
        setn(_environ, %o4, %o3)
104
        stn     %o2, [%o3]      ! *_environ
105
        call    main, 4
106
        nop
107
        call    exit, 0
108
        nop
109
        call    _exit, 0
110
        nop
111
        ! We should never get here.
112
 
113
        .type   _start,#function
114
        .size   _start,.-_start

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.