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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [sh/] [gensh2/] [start/] [start.S] - Blame information for rev 30

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

Line No. Rev Author Line
1 30 unneback
/*
2
 *  Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
3
 *           Bernd Becker (becker@faw.uni-ulm.de)
4
 *
5
 *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
6
 *
7
 *  This program is distributed in the hope that it will be useful,
8
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 *
11
 *  Modified to reflect Hitachi EDK SH7045F:
12
 *  John M. Mills (jmills@tga.com)
13
 *  TGA Technologies, Inc.
14
 *  100 Pinnacle Way, Suite 140
15
 *  Norcross, GA 30071 U.S.A.
16
 *
17
 *
18
 *  This modified file may be copied and distributed in accordance
19
 *  the above-referenced license. It is provided for critique and
20
 *  developmental purposes without any warranty nor representation
21
 *  by the authors or by TGA Technologies.
22
 *
23
 *  COPYRIGHT (c) 1999.
24
 *  On-Line Applications Research Corporation (OAR).
25
 *  Copyright assigned to U.S. Government, 1994.
26
 *
27
 *  The license and distribution terms for this file may be
28
 *  found in the file LICENSE in this distribution or at
29
 *  http://www.OARcorp.com/rtems/license.html.
30
 *
31
 *  $Id: start.S,v 1.2 2001-09-27 12:01:12 chris Exp $
32
 */
33
 
34
#include "asm.h"
35
 
36
        BEGIN_CODE
37
        PUBLIC(start)
38
 
39
SYM (start):
40
        ! install the stack pointer
41
        mov.l   stack_k,r15
42
 
43
#ifdef  START_HW_INIT   /* from $RTEMS_BSP.cfg */
44
        ! Initialize minimal hardware
45
        mov.l   hw_init_k, r0
46
        jsr @r0
47
        nop             !dead slot
48
#endif /* START_HW_INIT */
49
 
50
        ! zero out bss
51
        mov.l   edata_k,r0
52
        mov.l   end_k,r1
53
        mov     #0,r2
54
0:
55
        mov.l   r2,@r0
56
        add     #4,r0
57
        cmp/ge  r0,r1
58
        bt      0b
59
 
60
        ! copy the vector table from rom to ram
61
        mov.l   vects_k,r0      ! vectab
62
        mov     #0,r1           ! address of boot vector table
63
        mov     #0,r2           ! number of bytes copied
64
        mov.w   vects_size,r3   ! size of entries in vectab
65
1:
66
        mov.l   @r1+,r4
67
        mov.l   r4,@r0
68
        add     #4,r0
69
        add     #1,r2
70
        cmp/hi  r3,r2
71
        bf      1b
72
 
73
#ifndef STANDALONE_EVB
74
        ! overlay monitor vectors onto RTEMS table template
75
        ! code adapted  from Hitachi EDK7045F User Manual: "Copyvect.s"
76
        mova    vects_k,r0
77
        mov.l   @r0, r1 ! Shadow vect tbl addr
78
        stc             vbr, r2 ! Original vect tbl addr
79
        and             #0, r0
80
        mov             r0, r4  ! 0 in r4 and r0
81
 
82
!trapa #32
83
        or              #0x80, r0
84
        mov.l   @(r0,r2), r3
85
        mov.l   r3, @(r0, r1)
86
        mov             r4, r0
87
 
88
!cpu addr err
89
        or              #0x24, r0
90
        mov.l   @(r0, r2), r3
91
        mov.l   r3, @(r0, r1)
92
        mov             r4, r0
93
 
94
!ill slot
95
        or              #0x18, r0
96
        mov.l   @(r0, r2), r3
97
        mov.l   r3, @(r0, r1)
98
        mov             r4, r0
99
 
100
!ill inst
101
        or              #0x10, r0
102
        mov.l   @(r0, r2), r3
103
        mov.l   r3, @(r0, r1)
104
        mov             r4, r0
105
 
106
!nmi
107
        or              #0x2c, r0
108
        mov.l   @(r0, r2), r3
109
        mov.l   r3, @(r0, r1)
110
        mov             r4, r0
111
 
112
!User brk
113
        or              #0x30, r0
114
        mov.l   @(r0, r2), r3
115
        mov.l   r3, @(r0, r1)
116
        mov             r4, r0
117
 
118
!sci0 err
119
        or              #0x80, r0
120
        rotl    r0
121
        rotl    r0
122
        mov.l   @(r0, r2), r3
123
        mov.l   r3, @(r0, r1)
124
        mov             r4, r0
125
!sci rx
126
        or              #0x81, r0
127
        rotl    r0
128
        rotl    r0
129
        mov.l   @(r0, r2), r3
130
        mov.l   r3, @(r0, r1)
131
 
132
        stc     vbr,r3          ! capture copy of monitor vbr
133
        mov.l   vbrtemp_k,r0
134
        mov.l   r3, @r0
135
        mov.l   vects_k,r0      ! point vbr to vectab
136
        ldc     r0,vbr
137
#endif  ! STANDALONE_EVB
138
 
139
        ! call the mainline
140
        mov #0,r4               ! argc
141
        mov.l main_k,r0
142
        jsr @r0
143
        mov #0,r5               ! argv - can place in dead slot
144
 
145
        ! call exit
146
        mov     r0,r4
147
        mov.l   exit_k,r0
148
        jsr     @r0
149
        or      r0,r0
150
 
151
        mov.l   vbrtemp_k,r0    ! restore original vbr
152
        mov.l   @r0,r3
153
        ldc     r3, vbr
154
        trapa   #13             ! UBR capture by monitor
155
        nop             !debug dead-slot target
156
 
157
        END_CODE
158
 
159
        .align 2
160
stack_k:
161
        .long   SYM(stack)
162
edata_k:
163
        .long   SYM(edata)
164
end_k:
165
        .long   SYM(end)
166
main_k:
167
        .long   SYM(boot_card)
168
exit_k:
169
        .long   SYM(exit)
170
#ifdef  START_HW_INIT   /* from $RTEMS_BSP.cfg */
171
hw_init_k:
172
        .long   SYM(early_hw_init)
173
#endif /* START_HW_INIT */
174
vbrtemp_k:
175
        .long   SYM(vbrtemp)
176
vects_k:
177
        .long   SYM(vectab)
178
vects_size:
179
        .word   255
180
 
181
#ifdef __ELF__
182
        .section .stack,"aw"
183
#else
184
        .section .stack
185
#endif
186
SYM(stack):
187
        .long   0xdeaddead
188
 
189
#ifdef __ELF__
190
        .section .bss,"aw"
191
#else
192
        .section .bss
193
#endif
194
SYM(vbrtemp):
195
        .long   0x0
196
 

powered by: WebSVN 2.1.0

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