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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [sh/] [crt0.S] - Blame information for rev 309

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

Line No. Rev Author Line
1 207 jeremybenn
 
2
#ifdef __SH5__
3
        .section .data,"aw"
4
        .global ___data
5
___data:
6
 
7
        .section .rodata,"a"
8
        .global ___rodata
9
___rodata:
10
 
11
#if __SH5__ == 64
12
        .section .text,"ax"
13
#define LOAD_ADDR(sym, reg) \
14
        movi    (sym >> 48) & 65535, reg; \
15
        shori   (sym >> 32) & 65535, reg; \
16
        shori   (sym >> 16) & 65535, reg; \
17
        shori   sym & 65535, reg
18
#else
19
        .mode   SHmedia
20
        .section .text..SHmedia32,"ax"
21
#define LOAD_ADDR(sym, reg) \
22
        movi    (sym >> 16) & 65535, reg; \
23
        shori   sym & 65535, reg
24
#endif
25
        .global start
26
start:
27
        LOAD_ADDR (_stack, r15)
28
 
29
        pt/l    zero_bss_loop, tr0
30
        pt/l    _atexit, tr1
31
        pt/l    _init, tr5
32
        pt/l    _main, tr6
33
        pt/l    _exit, tr7
34
 
35
        ! zero out bss
36
        LOAD_ADDR (_edata, r0)
37
        LOAD_ADDR (_end, r1)
38
zero_bss_loop:
39
        stx.q   r0, r63, r63
40
        addi    r0, 8, r0
41
        bgt/l   r1, r0, tr0
42
 
43
        LOAD_ADDR (___data, r26)
44
        LOAD_ADDR (___rodata, r27)
45
 
46
#if ! __SH4_NOFPU__
47
        getcon  cr0, r0
48
        movi    1, r1
49
        shlli   r1, 15, r1
50
        or      r1, r0, r0
51
        putcon  r0, cr0
52
#endif
53
 
54
        ! arrange for exit to call fini
55
        LOAD_ADDR (_fini, r2)
56
        blink   tr1, r18
57
 
58
        ! call init
59
        blink   tr5, r18
60
 
61
        ! call the mainline
62
        blink   tr6, r18
63
 
64
        ! call exit
65
        blink   tr7, r18
66
#else
67
        .section .text
68
        .global start
69
start:
70
        mov.l   stack_k,r15
71
 
72
        ! zero out bss
73
        mov.l   edata_k,r0
74
        mov.l   end_k,r1
75
        mov     #0,r2
76
start_l:
77
         mov.l  r2,@r0
78
        add     #4,r0
79
        cmp/ge  r0,r1
80
        bt      start_l
81
 
82
#ifndef __SH2A_NOFPU__
83
#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY) || defined(__SH2A__)
84
        mov.l set_fpscr_k, r1
85
        jsr @r1
86
        mov #0,r4
87
        lds r3,fpscr
88
#endif /*  defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A__) */
89
#endif /* !__SH2A_NOFPU__ */
90
 
91
        ! call the mainline
92
        mov.l   main_k,r0
93
        jsr     @r0
94
        or      r0,r0
95
 
96
        ! call exit
97
        mov     r0,r4
98
        mov.l   exit_k,r0
99
        jsr     @r0
100
        or      r0,r0
101
 
102
        .align 2
103
#ifndef __SH2A_NOFPU__
104
#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A__)
105
set_fpscr_k:
106
        .long   ___set_fpscr
107
#endif /*  defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) || defined(__SH2A__) */
108
#endif /* !__SH2A_NOFPU__ */
109
stack_k:
110
        .long   _stack
111
edata_k:
112
        .long   _edata
113
end_k:
114
        .long   _end
115
main_k:
116
        .long   _main
117
exit_k:
118
        .long   _exit
119
#endif

powered by: WebSVN 2.1.0

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