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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [libgloss/] [rx/] [crt0.S] - Blame information for rev 829

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* Copyright (c) 2008, 2009 Red Hat Incorporated.
2
   All rights reserved.
3
 
4
   Redistribution and use in source and binary forms, with or without
5
   modification, are permitted provided that the following conditions
6
   are met:
7
 
8
     Redistributions of source code must retain the above copyright
9
     notice, this list of conditions and the following disclaimer.
10
 
11
     Redistributions in binary form must reproduce the above copyright
12
     notice, this list of conditions and the following disclaimer in the
13
     documentation and/or other materials provided with the distribution.
14
 
15
     The name of Red Hat Incorporated may not be used to endorse
16
     or promote products derived from this software without specific
17
     prior written permission.
18
 
19
   This software is provided by the copyright holders and contributors
20
   "AS IS" and any express or implied warranties, including, but not
21
   limited to, the implied warranties of merchantability and fitness for
22
   a particular purpose are disclaimed.  In no event shall Red Hat
23
   incorporated be liable for any direct, indirect, incidental, special,
24
   exemplary, or consequential damages (including, but not limited to,
25
   procurement of substitute goods or services; loss of use, data, or
26
   profits; or business interruption) however caused and on any theory of
27
   liability, whether in contract, strict liability, or tort (including
28
   negligence or otherwise) arising in any way out of the use of this
29
   software, even if advised of the possibility of such damage.  */
30
 
31
        .text
32
 
33
        .global _start
34
_start:
35
.LFB2:
36
        mvtc    #0, psw
37
        /* Enable the DN bit - this should have been done for us by
38
           the CPU reset, but it is best to make sure for ourselves.  */
39
        mvtc    #0x100, fpsw
40
        mov     #__stack, r0
41
        mvtc    #__vectors, intb
42
 
43
        mov     #__datastart, r1
44
        mov     #__romdatastart, r2
45
        mov     #__romdatacopysize, r3
46
        smovf
47
 
48
        mov     #__bssstart, r1
49
        mov     #0, r2
50
        mov     #__bsssize, r3
51
        sstr.l
52
 
53
        /* Initialise the small data area pointer.
54
           The register used here must agree with the definition of
55
           GP_BASE_REGNUM in gcc/config/rx/rx.h.  */
56
        mov     #__gp, r13
57
 
58
        bsr.a   __rx_init
59
 
60
#ifdef PROFILE_SUPPORT  /* Defined in gcrt0.S.  */
61
        mov     # _start, r1
62
        mov     # _etext, r2
63
        bsr.a   __monstartup
64
#endif
65
 
66
        mov     #0, r1 /* argc */
67
        mov     #0, r2 /* argv */
68
        mov     #0, r3 /* envv */
69
        bsr.a   _main
70
.LFE2:
71
 
72
#ifdef PROFILE_SUPPORT
73
        mov      r1, r13       ; Save return code.
74
        bsr.a   __mcleanup
75
        mov     r13, r1
76
#endif
77
 
78
        bsr.a   _exit
79
 
80
        .global _rx_run_preinit_array
81
        .type   _rx_run_preinit_array,@function
82
_rx_run_preinit_array:
83
        mov     #__preinit_array_start,r1
84
        mov     #__preinit_array_end,r2
85
        bra.a   _rx_run_inilist
86
 
87
        .global _rx_run_init_array
88
        .type   _rx_run_init_array,@function
89
_rx_run_init_array:
90
        mov     #__init_array_start,r1
91
        mov     #__init_array_end,r2
92
        mov     #4, r3
93
        bra.a   _rx_run_inilist
94
 
95
        .global _rx_run_fini_array
96
        .type   _rx_run_fini_array,@function
97
_rx_run_fini_array:
98
        mov     #__fini_array_start,r2
99
        mov     #__fini_array_end,r1
100
        mov     #-4, r3
101
        /* fall through */
102
 
103
_rx_run_inilist:
104
next_inilist:
105
        cmp     r1,r2
106
        beq.b   done_inilist
107
        mov.l   [r1],r4
108
        cmp     #-1, r4
109
        beq.b   skip_inilist
110
        cmp     #0, r4
111
        beq.b   skip_inilist
112
        pushm   r1-r3
113
        jsr     r4
114
        popm    r1-r3
115
skip_inilist:
116
        add     r3,r1
117
        bra.b   next_inilist
118
done_inilist:
119
        rts
120
 
121
        .section        .init,"ax"
122
 
123
        .global __rx_init
124
__rx_init:
125
 
126
        .section        .fini,"ax"
127
 
128
        .global __rx_fini
129
__rx_fini:
130
        bsr.a   _rx_run_fini_array
131
 
132
        .section .sdata
133
        .balign 4
134
        .global __gp
135
        .weak   __gp
136
__gp:
137
 
138
        .section .data
139
        .global ___dso_handle
140
        .weak   ___dso_handle
141
___dso_handle:
142
        .long   0
143
 
144
;;; Provide Dwarf unwinding information that will help GDB stop
145
;;; backtraces at the right place.  This is stolen from assembly
146
;;; code generated by GCC with -dA.
147
        .section        .debug_frame,"",@progbits
148
.Lframe0:
149
        .4byte  .LECIE0-.LSCIE0 ; Length of Common Information Entry
150
.LSCIE0:
151
        .4byte  0xffffffff      ; CIE Identifier Tag
152
        .byte   0x1     ; CIE Version
153
        .ascii "\0"     ; CIE Augmentation
154
        .uleb128 0x1    ; CIE Code Alignment Factor
155
        .sleb128 -1     ; CIE Data Alignment Factor
156
        .byte   0xd     ; CIE RA Column
157
        .byte   0xc     ; DW_CFA_def_cfa
158
        .uleb128 0xc
159
        .uleb128 0x3
160
        .byte   0x8d    ; DW_CFA_offset, column 0xd
161
        .uleb128 0x3
162
        .p2align 2
163
.LECIE0:
164
.LSFDE0:
165
        .4byte  .LEFDE0-.LASFDE0        ; FDE Length
166
.LASFDE0:
167
        .4byte  .Lframe0        ; FDE CIE offset
168
        .4byte  .LFB2           ; FDE initial location
169
        .4byte  .LFE2-.LFB2     ; FDE address range
170
        .byte   0xf             ; DW_CFA_def_cfa_expression
171
        .uleb128 1              ; length of expression
172
        .byte   0x30            ; DW_OP_lit0
173
        .p2align 2
174
.LEFDE0:
175
 
176
        .text

powered by: WebSVN 2.1.0

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