source: rtems/c/src/lib/libbsp/m32c/m32cbsp/start/start.S @ 820d1ab0

4.104.115
Last change on this file since 820d1ab0 was 820d1ab0, checked in by Chris Johns <chrisj@…>, on 04/28/09 at 06:34:00

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

  • start/start.S: Update for boot_card command line change.
  • Property mode set to 100644
File size: 4.3 KB
Line 
1/*
2
3Copyright (c) 2005 Red Hat Incorporated.
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9    Redistributions of source code must retain the above copyright
10    notice, this list of conditions and the following disclaimer.
11
12    Redistributions in binary form must reproduce the above copyright
13    notice, this list of conditions and the following disclaimer in the
14    documentation and/or other materials provided with the distribution.
15
16    The name of Red Hat Incorporated may not be used to endorse
17    or promote products derived from this software without specific
18    prior written permission.
19
20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23DISCLAIMED.  IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
24DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31*/
32
33#warning Call to boot_card has changed and needs checking.
34#warning The call is "void boot_card(const char* cmdline);"
35#warning You need to pass a NULL.
36#warning Please check and remove these errors.
37       
38#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
39#define A16
40#define A(n,w) n
41#define W w
42#define ALIGN 1
43#else
44#define A24
45#define A(n,w) w
46#define W l
47#define ALIGN 2
48#endif
49
50        .text
51
52        .global _start
53_start:
54.LFB2:
55        fset    U       /* User stack */
56        ldc     #__stack,sp
57
58#ifdef A16
59        mov.b   #%hi8(__romdatastart),r1h
60        mov.w   #%lo16(__romdatastart),a0
61        mov.w   #__datastart,a1
62#else
63        mov.l   #__romdatastart,a0
64        mov.l   #__datastart,a1
65#endif
66        mov.w   #__romdatacopysize,r3
67        shl.w   #-1,r3
68        smovf.w
69
70#ifdef A16
71        mov.w   #__bssstart,a1
72#else
73        mov.l   #__bssstart,a1
74#endif
75        mov.w   #__bsssize,r3
76        shl.w   #-1,r3
77        mov.w   #0,r0
78        sstr.w
79
80        /* jsr.a        __m32c_init */
81
82        jsr.a   _boot_card
83.LFE2:
84
85#ifdef A24
86        /* rv in r0, ok for arg0 */
87#else
88        mov.w   r0,r1
89#endif
90
91        jsr.a   _sys_exit
92
93        .text
94
95        .global _m32c_run_preinit_array
96        .type   _m32c_run_preinit_array,@function
97_m32c_run_preinit_array:
98        mov.W   #__preinit_array_start,a0
99        mov.W   #__preinit_array_end,a1
100        jmp.w   _m32c_run_inilist
101
102        .global _m32c_run_init_array
103        .type   _m32c_run_init_array,@function
104_m32c_run_init_array:
105        mov.W   #__init_array_start,a0
106        mov.W   #__init_array_end,a1
107        jmp.w   _m32c_run_inilist
108
109        .global _m32c_run_fini_array
110        .type   _m32c_run_fini_array,@function
111_m32c_run_fini_array:
112        mov.W   #__fini_array_start,a0
113        mov.W   #__fini_array_end,a1
114        /* fall through */
115
116_m32c_run_inilist:
117next_inilist:
118        cmp.W   a0,a1
119        jeq     done_inilist
120        pushm   a0,a1
121        mov.W   [a0],a0
122#ifdef A16
123        mov.b:s #0,a1   /* zero extends */
124        jsri.a  a1a0
125#else
126        jsri.a  a0
127#endif
128        popm    a0,a1
129        add.W   A(#2,#4),a0
130        jmp.b   next_inilist
131done_inilist:
132        rts
133
134        .section        .init,"ax",@progbits
135
136        .global __init
137        .global __m32c_init
138__init:
139__m32c_init:
140        enter   #0
141        exitd
142
143        .section        .fini,"ax",@progbits
144
145        .global __fini
146        .global __m32c_fini
147__fini:
148__m32c_fini:
149        enter   #0
150        jsr.a   _m32c_run_fini_array
151        exitd
152
153
154;;; Provide Dwarf unwinding information that will help GDB stop
155;;; backtraces at the right place.  This is stolen from assembly
156;;; code generated by GCC with -dA.
157        .section        .debug_frame,"",@progbits
158.Lframe0:
159        .4byte  .LECIE0-.LSCIE0 ; Length of Common Information Entry
160.LSCIE0:
161        .4byte  0xffffffff      ; CIE Identifier Tag
162        .byte   0x1     ; CIE Version
163        .ascii "\0"     ; CIE Augmentation
164        .uleb128 0x1    ; CIE Code Alignment Factor
165        .sleb128 -1     ; CIE Data Alignment Factor
166        .byte   0xd     ; CIE RA Column
167        .byte   0xc     ; DW_CFA_def_cfa
168        .uleb128 0xc
169        .uleb128 0x3
170        .byte   0x8d    ; DW_CFA_offset, column 0xd
171        .uleb128 0x3
172        .p2align ALIGN
173.LECIE0:
174.LSFDE0:
175        .4byte  .LEFDE0-.LASFDE0        ; FDE Length
176.LASFDE0:
177        .4byte  .Lframe0        ; FDE CIE offset
178        .4byte  .LFB2           ; FDE initial location
179        .4byte  .LFE2-.LFB2     ; FDE address range
180        .byte   0xf             ; DW_CFA_def_cfa_expression
181        .uleb128 1              ; length of expression
182        .byte   0x30            ; DW_OP_lit0
183        .p2align ALIGN
184.LEFDE0:
185
186        .text
Note: See TracBrowser for help on using the repository browser.