source: rtems/c/src/lib/libbsp/sh/gensh2/start/start.S @ df49c60

4.104.114.84.95
Last change on this file since df49c60 was df49c60, checked in by Joel Sherrill <joel.sherrill@…>, on 06/12/00 at 15:00:15

Merged from 4.5.0-beta3a

  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[4a238002]1/*
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$
32 */
33
34#include "asm.h"
35
36        BEGIN_CODE
37        PUBLIC(start)
38
39SYM (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
[df49c60]47        nop             !dead slot
[4a238002]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
540:
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
651:
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
[df49c60]73#ifndef STANDALONE_EVB
[4a238002]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
[df49c60]137#endif  ! STANDALONE_EVB
[4a238002]138
139        ! call the mainline     
140        mov #0,r4               ! argc
141        mov.l main_k,r0
142        jsr @r0
[df49c60]143        mov #0,r5               ! argv - can place in dead slot
[4a238002]144
145        ! call exit
146        mov     r0,r4
147        mov.l   exit_k,r0
148        jsr     @r0
[df49c60]149        or      r0,r0
[4a238002]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
160stack_k:
161        .long   SYM(stack)     
162edata_k:
163        .long   SYM(edata)
164end_k:
165        .long   SYM(end)
166main_k:
167        .long   SYM(boot_card)
168exit_k:
169        .long   SYM(exit)
170#ifdef  START_HW_INIT   /* from $RTEMS_BSP.cfg */
171hw_init_k:
[df49c60]172        .long   SYM(early_hw_init)
[4a238002]173#endif /* START_HW_INIT */
174vbrtemp_k:
175        .long   SYM(vbrtemp)
176vects_k:
177        .long   SYM(vectab)
178vects_size:
179        .word   255
180
181#ifdef __ELF__
182        .section .stack,"aw"
183#else
184        .section .stack
185#endif
186SYM(stack):
187        .long   0xdeaddead
188
189#ifdef __ELF__
190        .section .bss,"aw"
191#else
192        .section .bss
193#endif
194SYM(vbrtemp):
195        .long   0x0
196
Note: See TracBrowser for help on using the repository browser.