source: rtems/c/src/lib/libbsp/powerpc/virtex/dlentry/dlentry.S @ 0aa4b0f

4.104.11
Last change on this file since 0aa4b0f was 0aa4b0f, checked in by Chris Johns <chrisj@…>, on Apr 28, 2009 at 6:32:31 AM

2009-04-28 Chris Johns <chrisj@…>

  • dlentry/dlentry.S: Update for boot_card command line change.
  • Property mode set to 100644
File size: 5.1 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 <rtems/asm.h>
39
40#warning Call to boot_card has changed and needs checking.
41#warning The call is "void boot_card(const char* cmdline);"
42#warning You need to pass a NULL.
43#warning Please check and remove these errors.
44       
45/*
46 *  The virtex ELF link scripts support three special sections:
47 *    .entry    The actual entry point
48 *    .vectors  The section containing the interrupt entry veneers.
49 */
50
51/*
52 *  Downloaded code loads the vectors separately to 0x00000100,
53 *  so .entry can be over 256 bytes.
54 *
55 *  The other sections are linked in the following order:
56 *    .entry
57 *    .text
58 *    .data
59 *    .bss
60 * see linker command file for section placement
61 *
62 *  The initial stack is set to stack.end
63 *
64 *  All the entry veneer has to do is to clear the BSS.
65 */
66
67/*
68 *  GDB likes to have debugging information for the entry veneer.
69 *  Here was some DWARF information. IMD removed it, because we
70 *  could not check, whether it was still correct. Sorry.
71
72 */
73
74        .section .entry
75
76        PUBLIC_VAR (start)
77        PUBLIC_VAR (download_entry)
78        PUBLIC_VAR (__rtems_entry_point)
79SYM(start):
80SYM(download_entry):
81SYM(__rtems_entry_point):
82        bl      .startup
83base_addr:
84
85/*---------------------------------------------------------------------------
86 * Parameters from linker
87 *--------------------------------------------------------------------------*/
88toc_pointer:
89        .long   s.got
90bss_length:
91        .long   bss.size
92bss_addr:
93        .long   bss.start
94stack_top:
95        .long   stack.end
96PUBLIC_VAR (text_addr)
97text_addr:
98        .long   text.start
99
100PUBLIC_VAR (text_length)
101text_length:
102        .long   text.size
103/*---------------------------------------------------------------------------
104 * Reset_entry.
105 *--------------------------------------------------------------------------*/
106.startup:
107        /* Get start address, stack grows down from here... */
108        mflr    r1
109
110        /* Assume Bank regs set up..., cache etc. */
111        bl      bssclr
112
113#if 0
114        .extern SYM(__vectors)
115
116        lis     r2,__vectors@h          /* set EVPR exc. vector prefix */
117#else
118        lis     r2,0
119#endif         
120        mtspr   evpr,r2
121
122        /*-------------------------------------------------------------------
123         * C_setup.
124         *------------------------------------------------------------------*/
125        lwz     r2,toc_pointer-base_addr(r1)       /* set r2 to toc */
126        lwz     r1,stack_top-base_addr(r1)         /* set r1 to stack_top */
127
128        addi    r1,r1,-56-4              /* start stack at text_addr - 56 */
129        addi    r3,r0,0x0                /* clear r3 */
130        stw     r3, 0(r1)                /* Clear stack chain */
131        stw     r3, 4(r1)
132        stw     r3, 8(r1)
133        stw     r3, 12(r1)
134        lis     r5,environ@ha
135        la      r5,environ@l(r5)        /* environp */
136        li      r4, 0                   /* argv */
137        li      r3, 0                   /* argc */
138        .extern SYM(_SDA_BASE_)
139        lis r13,SYM(_SDA_BASE_)@h
140        ori r13,r13,SYM(_SDA_BASE_)@l
141        .extern SYM (boot_card)
142        b       SYM (boot_card)          /* call the first C routine */
143
144/*---------------------------------------------------------------------------
145 * bssclr.
146 *--------------------------------------------------------------------------*/
147bssclr:
148        /*-------------------------------------------------------------------
149         * Data move finished, zero out bss.
150         *------------------------------------------------------------------*/
151        lwz     r2,bss_addr-base_addr(r1)   /* start of bss set by loader */
152        lwz     r3,bss_length-base_addr(r1) /* bss length */
153        rlwinm. r3,r3,30,0x3FFFFFFF     /* form length/4 */
154        beqlr                           /* no bss */
155        mtctr   r3                      /* set ctr reg */
156        xor     r6,r6,r6                /* r6 = 0 */
157clear_bss:
158        stswi   r6,r2,0x4               /* store r6 */
159        addi    r2,r2,0x4               /* update r2 */
160        bdnz    clear_bss               /* decrement counter and loop */
161        blr                             /* return */
162.L_text_e:
163
164        .comm   environ,4,4
Note: See TracBrowser for help on using the repository browser.