source: rtems/c/src/lib/libbsp/powerpc/gen405/dlentry/dlentry.S @ 357a9f0

4.104.114.84.95
Last change on this file since 357a9f0 was 57ed393, checked in by Joel Sherrill <joel.sherrill@…>, on 11/08/01 at 23:46:58

2001-11-08 Dennis Ehlin (ECS) <Dennis.Ehlin@…>

This modification is part of the submitted modifications necessary to
support the IBM PPC405 family. This submission was reviewed by
Thomas Doerfler <Thomas.Doerfler@…> who ensured it did
not negatively impact the ppc403 BSPs. The submission and tracking
process was captured as PR50.

  • ChangeLog?, Makefile.am, README, bsp_specs, bsp_specs.dl, configure.ac, times, dlentry/.cvsignore, dlentry/Makefile.am, dlentry/dlentry.S, include/.cvsignore, include/Makefile.am, include/bsp.h, include/bspopts.h.in, include/coverhd.h, startup/.cvsignore, startup/Makefile.am, startup/bspclean.c, startup/bspstart.c, startup/linkcmds, startup/linkcmds.dl, startup/setvec.c, wrapup/.cvsignore, wrapup/Makefile.am: New files that are part of the new gen405 BSP.
  • Property mode set to 100644
File size: 4.8 KB
Line 
1/*  dlentry.s
2 *
3 *  This file contains the entry code for RTEMS programs starting
4 *  after download to RAM
5 *
6 *  Author:     Thomas Doerfler <td@imd.m.isar.de>
7 *              IMD Ingenieurbuero fuer Microcomputertechnik
8 *
9 *  COPYRIGHT (c) 1998 by IMD
10 *
11 *  Changes from IMD are covered by the original distributions terms.
12 *  This file has been derived from the papyrus BSP:   
13 *
14 *  This file contains the entry veneer for RTEMS programs
15 *  downloaded to Papyrus.
16 *
17 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
18 *
19 *  COPYRIGHT (c) 1995 by i-cubed ltd.
20 *
21 *  To anyone who acknowledges that this file is provided "AS IS"
22 *  without any express or implied warranty:
23 *      permission to use, copy, modify, and distribute this file
24 *      for any purpose is hereby granted without fee, provided that
25 *      the above copyright notice and this notice appears in all
26 *      copies, and that the name of i-cubed limited not be used in
27 *      advertising or publicity pertaining to distribution of the
28 *      software without specific, written prior permission.
29 *      i-cubed limited makes no representations about the suitability
30 *      of this software for any purpose.
31 *
32 *  $Id$
33 *
34 *  derived from "helas403/dlentry.S": 
35 *  Id: dlentry.S,v 1.2 2000/08/02 16:30:57 joel Exp
36 */
37
38#include "asm.h"
39
40/*
41 *  The gen405 ELF link scripts support three special sections:
42 *    .entry    The actual entry point
43 *    .vectors  The section containing the interrupt entry veneers.
44 */
45
46/*
47 *  Downloaded code loads the vectors separately to 0x00000100,
48 *  so .entry can be over 256 bytes.
49 *
50 *  The other sections are linked in the following order:
51 *    .entry
52 *    .text
53 *    .data
54 *    .bss
55 * see linker command file for section placement       
56 *
57 *  The initial stack is set to stack.end
58 *
59 *  All the entry veneer has to do is to clear the BSS.
60 */
61
62/*
63 *  GDB likes to have debugging information for the entry veneer.
64 *  Here was some DWARF information. IMD removed it, because we
65 *  could not check, whether it was still correct. Sorry.
66       
67 */
68
69.globl __eabi
70
71                               
72#if PPC_ASM == PPC_ASM_ELF
73        .section .entry
74#else
75        .csect .text[PR]
76#endif
77
78        PUBLIC_VAR (download_entry)
79SYM(download_entry):
80        bl      .startup
81base_addr:     
82
83/*---------------------------------------------------------------------------
84 * Parameters from linker
85 *--------------------------------------------------------------------------*/
86toc_pointer:   
87#if PPC_ASM == PPC_ASM_ELF
88        .long   s.got
89#else
90        .long   TOC[tc0]
91#endif
92bss_length:     
93        .long   bss.size
94bss_addr:       
95        .long   bss.start
96stack_top:
97        .long   stack.end
98/*---------------------------------------------------------------------------
99 * Reset_entry.
100 *--------------------------------------------------------------------------*/
101.startup:
102        /* Get start address, stack grows down from here... */
103        mflr    r1
104
105        /* Assume Bank regs set up..., cache etc. */
106        bl      bssclr
107
108        .extern SYM(__vectors)
109
110        lis     r2,__vectors@h          /* set EVPR exc. vector prefix */
111        mtspr   evpr,r2
112
113        /*-------------------------------------------------------------------
114         * C_setup.
115         *------------------------------------------------------------------*/
116        lwz     r2,toc_pointer-base_addr(r1)       /* set r2 to toc */
117        lwz     r1,stack_top-base_addr(r1)         /* set r1 to stack_top */
118
119        addi    r1,r1,-56-4              /* start stack at text_addr - 56 */
120        addi    r3,r0,0x0                /* clear r3 */
121        stw     r3, 0(r1)                /* Clear stack chain */
122        stw     r3, 4(r1)
123        stw     r3, 8(r1)
124        stw     r3, 12(r1)
125        lis     r5,environ@ha
126        la      r5,environ@l(r5)        /* environp */
127        li      r4, 0                   /* argv */
128        li      r3, 0                   /* argc */
129        .extern SYM (boot_card)
130        b       SYM (boot_card)          /* call the first C routine */
131
132/*---------------------------------------------------------------------------
133 * bssclr.
134 *--------------------------------------------------------------------------*/
135bssclr:
136        /*-------------------------------------------------------------------
137         * Data move finished, zero out bss.
138         *------------------------------------------------------------------*/
139        lwz     r2,bss_addr-base_addr(r1)   /* start of bss set by loader */
140        lwz     r3,bss_length-base_addr(r1) /* bss length */
141        rlwinm. r3,r3,30,0x3FFFFFFF     /* form length/4 */
142        beqlr                           /* no bss */
143        mtctr   r3                      /* set ctr reg */
144        xor     r6,r6,r6                /* r6 = 0 */
145clear_bss:
146        stswi   r6,r2,0x4               /* store r6 */
147        addi    r2,r2,0x4               /* update r2 */
148        bdnz    clear_bss               /* decrement counter and loop */
149        blr                             /* return */
150.L_text_e:
151
152#if PPC_ABI == PPC_ABI_POWEROPEN
153        DESCRIPTOR (startup)
154#endif
155
156        .comm   environ,4,4
157
158/* no eabi */
159__eabi:
160    blr
161   
Note: See TracBrowser for help on using the repository browser.