OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [papyrus/] [dlentry/] [dlentry.S] - Blame information for rev 607

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.