Back to home page

LXR

 
 

    


Warning, /bsps/sh/gensh2/start/start.ram is written in an unsupported language. File is not indexed.

0001 /*
0002  *  Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
0003  *           Bernd Becker (becker@faw.uni-ulm.de)
0004  *
0005  *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
0006  *
0007  *  This program is distributed in the hope that it will be useful,
0008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0010  *
0011  *
0012  *  COPYRIGHT (c) 1998.
0013  *  On-Line Applications Research Corporation (OAR).
0014  *
0015  *  The license and distribution terms for this file may be
0016  *  found in the file LICENSE in this distribution or at
0017  *  http://www.rtems.org/license/LICENSE.
0018  *
0019  *  Modified to reflect Hitachi EDK SH7045F:
0020  *  John M. Mills (jmills@tga.com)
0021  *  TGA Technologies, Inc.
0022  *  100 Pinnacle Way, Suite 140
0023  *  Norcross, GA 30071 U.S.A.
0024  *  
0025  *
0026  *  This modified file may be copied and distributed in accordance
0027  *  the above-referenced license. It is provided for critique and
0028  *  developmental purposes without any warranty nor representation
0029  *  by the authors or by TGA Technologies.
0030  */
0031 
0032 #include "asm.h"
0033 
0034         BEGIN_CODE
0035         PUBLIC(start)
0036 
0037 SYM (start):
0038         ! install the stack pointer
0039         mov.l   stack_k,r15
0040 
0041 #ifdef  START_HW_INIT   /* from $RTEMS_BSP.cfg */
0042         ! Initialize minimal hardware
0043         mov.l   hw_init_k, r0
0044         jsr @r0
0045         nop             !debug dead-slot target
0046 #endif /* START_HW_INIT */
0047 
0048         ! zero out bss
0049         mov.l   edata_k,r0
0050         mov.l   end_k,r1
0051         mov     #0,r2
0052 0:
0053         mov.l   r2,@r0
0054         add     #4,r0
0055         cmp/ge  r0,r1
0056         bt      0b
0057         nop             !debug dead-slot target
0058 
0059         ! copy the vector table from rom to ram
0060         mov.l   vects_k,r0      ! vectab
0061         mov     #0,r1           ! address of boot vector table
0062         mov     #0,r2           ! number of bytes copied
0063         mov.w   vects_size,r3   ! size of entries in vectab
0064 1:
0065         mov.l   @r1+,r4
0066         mov.l   r4,@r0
0067         add     #4,r0
0068         add     #1,r2
0069         cmp/hi  r3,r2
0070         bf      1b
0071         nop             !debug dead-slot target
0072 
0073         ! overlay monitor vectors onto RTEMS table template
0074         ! code adapted  from Hitachi EDK7045F User Manual: "Copyvect.s"
0075         mova    vects_k,r0
0076         mov.l   @r0, r1 ! Shadow vect tbl addr
0077         stc             vbr, r2 ! Original vect tbl addr
0078         and             #0, r0 
0079         mov             r0, r4  ! 0 in r4 and r0
0080 
0081 !trapa #32
0082         or              #0x80, r0
0083         mov.l   @(r0,r2), r3
0084         mov.l   r3, @(r0, r1)
0085         mov             r4, r0
0086 
0087 !cpu addr err
0088         or              #0x24, r0
0089         mov.l   @(r0, r2), r3
0090         mov.l   r3, @(r0, r1)
0091         mov             r4, r0
0092 
0093 !ill slot
0094         or              #0x18, r0
0095         mov.l   @(r0, r2), r3
0096         mov.l   r3, @(r0, r1)
0097         mov             r4, r0
0098 
0099 !ill inst
0100         or              #0x10, r0
0101         mov.l   @(r0, r2), r3
0102         mov.l   r3, @(r0, r1)
0103         mov             r4, r0
0104 
0105 !nmi
0106         or              #0x2c, r0
0107         mov.l   @(r0, r2), r3
0108         mov.l   r3, @(r0, r1)
0109         mov             r4, r0
0110 
0111 !User brk
0112         or              #0x30, r0
0113         mov.l   @(r0, r2), r3
0114         mov.l   r3, @(r0, r1)
0115         mov             r4, r0
0116 
0117 !sci0 err
0118         or              #0x80, r0
0119         rotl    r0
0120         rotl    r0
0121         mov.l   @(r0, r2), r3
0122         mov.l   r3, @(r0, r1)
0123         mov             r4, r0
0124 !sci rx
0125         or              #0x81, r0
0126         rotl    r0
0127         rotl    r0
0128         mov.l   @(r0, r2), r3
0129         mov.l   r3, @(r0, r1)
0130 
0131         stc     vbr,r3          ! capture copy of monitor vbr
0132         mov.l   vbrtemp_k,r0
0133         mov.l   r3, @r0
0134         mov.l   vects_k,r0      ! point vbr to vectab
0135         ldc     r0,vbr
0136 
0137         ! call the mainline     
0138         mov #0,r4               ! argc
0139         mov #0,r5               ! argv - can place in dead slot
0140         mov.l main_k,r0
0141         jsr @r0
0142         nop             !debug dead-slot target
0143 
0144         ! call exit
0145         mov     r0,r4
0146         mov.l   exit_k,r0
0147         or      r0,r0
0148         jsr     @r0
0149         nop             !debug dead-slot target
0150 
0151         mov.l   vbrtemp_k,r0    ! restore original vbr
0152         mov.l   @r0,r3
0153         ldc     r3, vbr
0154         trapa   #13             ! UBR capture by monitor
0155         nop             !debug dead-slot target
0156 
0157         END_CODE
0158 
0159         .align 2
0160 stack_k:
0161         .long   SYM(_ISR_Stack_area_end)
0162 edata_k:
0163         .long   SYM(edata)
0164 end_k:
0165         .long   SYM(end)
0166 main_k:
0167         .long   SYM(boot_card)
0168 exit_k:
0169         .long   SYM(exit)
0170 #ifdef  START_HW_INIT   /* from $RTEMS_BSP.cfg */
0171 hw_init_k:
0172         .long   SYM(hw_initialize)
0173 #endif /* START_HW_INIT */
0174 vbrtemp_k:
0175         .long   SYM(vbrtemp)
0176 vects_k:
0177         .long   SYM(vectab)
0178 vects_size:
0179         .word   255
0180 
0181 #ifdef __ELF__
0182         .section .bss,"aw"
0183 #else
0184         .section .bss
0185 #endif
0186 SYM(vbrtemp):
0187         .long   0x0
0188