source: rtems/c/src/lib/libbsp/powerpc/papyrus/dlentry/dlentry.s @ 0cf5bd6

4.104.114.84.95
Last change on this file since 0cf5bd6 was 0cf5bd6, checked in by Joel Sherrill <joel.sherrill@…>, on 08/22/95 at 17:11:04

fixed RCS Id

  • Property mode set to 100644
File size: 6.5 KB
Line 
1/*  dlentry.s   1.0 - 95/08/08
2 *
3 *  This file contains the entry veneer for RTEMS programs
4 *  downloaded to Papyrus.
5 *
6 *  Author:     Andrew Bray <andy@i-cubed.demon.co.uk>
7 *
8 *  COPYRIGHT (c) 1995 by i-cubed ltd.
9 *
10 *  To anyone who acknowledges that this file is provided "AS IS"
11 *  without any express or implied warranty:
12 *      permission to use, copy, modify, and distribute this file
13 *      for any purpose is hereby granted without fee, provided that
14 *      the above copyright notice and this notice appears in all
15 *      copies, and that the name of i-cubed limited not be used in
16 *      advertising or publicity pertaining to distribution of the
17 *      software without specific, written prior permission.
18 *      i-cubed limited makes no representations about the suitability
19 *      of this software for any purpose.
20 */
21
22#include "asm.h"
23
24/*
25 *  The Papyrus ELF link scripts support three special sections:
26 *    .entry    The actual entry point, this must contain less
27 *              than 256 bytes of code/data to fit below the
28 *              .vectors section.  This always preceeds any other
29 *              code or data.
30 *    .vectors  The section containing the interrupt entry veneers.
31 *    .entry2   Any code overflowing from .entry
32 *    .descriptors The PowerOpen function indirection blocks.
33 */
34
35/*
36 *  Downloaded code loads the vectors separately to 0x00000100,
37 *  so .entry can be over 256 bytes.
38 *
39 *  The other sections are linked in the following order:
40 *    .entry
41 *    .entry2
42 *    .text
43 *    .descriptors
44 *    .data
45 *    .bss
46 *  usually starting from 0x00020000.
47 *
48 *  The initial stack is set to run BELOW the code base address.
49 *
50 *  All the entry veneer has to do is to clear the BSS.
51 */
52
53/*
54 *  GDB likes to have debugging information for the entry veneer.
55 *  Here is some DWARF information.
56 */
57
58#if PPC_ASM == PPC_ASM_ELF
59        .section .entry,"ax",@progbits
60.L_text_b:
61.L_LC1:
62        .previous
63
64.section        .debug_sfnames
65.L_sfnames_b:
66        .byte "/home/andy/powerpc/rtems-3.2.0/c/src/lib/libcpu/ppc/ppc403/dlentry/"
67        .byte 0
68.L_F0:
69        .byte "dlentry.s"
70        .byte 0
71        .previous
72
73.section        .line
74.L_line_b:
75        .4byte  .L_line_e-.L_line_b
76        .4byte  .L_text_b
77.L_LE1:
78.L_line_last:
79        .4byte  0x0
80        .2byte  0xffff
81        .4byte  .L_text_e-.L_text_b
82.L_line_e:
83        .previous
84
85.section        .debug_srcinfo
86.L_srcinfo_b:
87        .4byte  .L_line_b
88        .4byte  .L_sfnames_b
89        .4byte  .L_text_b
90        .4byte  .L_text_e
91        .4byte  0xffffffff
92        .4byte  .L_LE1-.L_line_b
93        .4byte  .L_F0-.L_sfnames_b
94        .4byte  .L_line_last-.L_line_b
95        .4byte  0xffffffff
96        .previous
97
98.section        .debug_pubnames
99        .4byte  .L_debug_b
100        .4byte  .L_P0
101        .byte "download_entry"
102        .byte 0
103        .4byte  0x0
104        .byte 0
105        .previous
106
107.section        .debug_aranges
108        .4byte  .L_debug_b
109        .4byte  .L_text_b
110        .4byte  .L_text_e-.L_text_b
111        .4byte  0
112        .4byte  0
113        .4byte  0
114        .4byte  0
115        .4byte  0
116        .4byte  0
117        .4byte  0x0
118        .4byte  0x0
119        .previous
120
121.section        .debug
122.L_debug_b:
123.L_D1:
124        .4byte  .L_D1_e-.L_D1
125        .2byte  0x11    /* TAG_compile_unit */
126        .2byte  0x12    /* AT_sibling */
127        .4byte  .L_D2
128        .2byte  0x38    /* AT_name */
129        .byte "dlentry.s"
130        .byte 0
131        .2byte  0x258   /* AT_producer */
132        .byte "GAS 2.5.2"
133        .byte 0
134        .2byte  0x111   /* AT_low_pc */
135        .4byte  .L_text_b
136        .2byte  0x121   /* AT_high_pc */
137        .4byte  .L_text_e
138        .2byte  0x106   /* AT_stmt_list */
139        .4byte  .L_line_b
140        .2byte  0x1b8   /* AT_comp_dir */
141        .byte "/home/andy/powerpc/rtems-3.2.0/c/src/lib/libcpu/ppc/ppc403/dlentry/"
142        .byte 0
143        .2byte  0x8006  /* AT_sf_names */
144        .4byte  .L_sfnames_b
145        .2byte  0x8016  /* AT_src_info */
146        .4byte  .L_srcinfo_b
147.L_D1_e:
148.L_P0:
149.L_D3:
150        .4byte  .L_D3_e-.L_D3
151        .2byte  0x6     /* TAG_global_subroutine */
152        .2byte  0x12    /* AT_sibling */
153        .4byte  .L_D4
154        .2byte  0x38    /* AT_name */
155        .byte "download_entry"
156        .byte 0
157        .2byte  0x278   /* AT_prototyped */
158        .byte 0
159        .2byte  0x111   /* AT_low_pc */
160        .4byte  .L_text_b
161        .2byte  0x121   /* AT_high_pc */
162        .4byte  .L_text_e
163        .2byte  0x8041  /* AT_body_begin */
164        .4byte  .L_text_b
165        .2byte  0x8051  /* AT_body_end */
166        .4byte  .L_text_e
167.L_D3_e:
168
169.L_D4:
170        .4byte  .L_D4_e-.L_D4
171        .align 2
172.L_D4_e:
173.L_D2:
174        .previous
175#endif
176                               
177/*-------------------------------------------------------------------------------
178 * ROM Vector area.
179 *------------------------------------------------------------------------------*/
180#if PPC_ASM == PPC_ASM_ELF
181        .section .entry
182#else
183        .csect .text[PR]
184#endif
185
186        PUBLIC_VAR (download_entry)
187SYM(download_entry):
188        bl      .startup
189base_addr:     
190
191/*-------------------------------------------------------------------------------
192 * Parameters from linker
193 *------------------------------------------------------------------------------*/
194toc_pointer:   
195#if PPC_ASM == PPC_ASM_ELF
196        .long   s.got
197#else
198        .long   TOC[tc0]
199#endif
200bss_length:     
201        .long   bss.size
202bss_addr:       
203        .long   bss.start
204/*-------------------------------------------------------------------------------
205 * Reset_entry.
206 *------------------------------------------------------------------------------*/
207.startup:
208        /* Get start address, stack grows down from here... */
209        mflr    r1
210       
211        /* Assume Bank regs set up..., cache etc. */
212        bl      bssclr
213
214        /*-----------------------------------------------------------------------
215         * C_setup.
216         *----------------------------------------------------------------------*/
217        lwz     r2,toc_pointer-base_addr(r1)       /* set r2 to toc */
218        addi    r1,r1,-56-4              /* start stack at text_addr - 56 */
219        addi    r3,r0,0x0                /* clear r3 */
220        stw     r3, 0(r1)                /* Clear stack chain */
221        stw     r3, 4(r1)
222        stw     r3, 8(r1)
223        stw     r3, 12(r1)
224        .extern .main
225        b       .main                    /* call the first C routine */
226
227/*-------------------------------------------------------------------------------
228 * bssclr.
229 *------------------------------------------------------------------------------*/
230bssclr:
231        /*-----------------------------------------------------------------------
232         * Data move finished, zero out bss.
233         *----------------------------------------------------------------------*/
234        lwz     r2,bss_addr-base_addr(r1)         /* start of bss set by loader */
235        lwz     r3,bss_length-base_addr(r1)       /* bss length */
236        rlwinm. r3,r3,30,0x3FFFFFFF     /* form length/4 */
237        beqlr                           /* no bss */
238        mtctr   r3                      /* set ctr reg */
239        xor     r6,r6,r6                /* r6 = 0 */
240clear_bss:
241        stswi   r6,r2,0x4               /* store r6 */
242        addi    r3,r2,0x4               /* update r2 */
243        bdnz    clear_bss               /* decrement counter and loop */
244        blr                             /* return */
245.L_text_e:
246
247#if PPC_ABI == PPC_ABI_POWEROPEN
248        DESCRIPTOR (startup)
249#endif
Note: See TracBrowser for help on using the repository browser.