source: trunk/libs/newlib/src/libgloss/cris/crt0.S @ 458

Last change on this file since 458 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.4 KB
RevLine 
[444]1/* Generic simplistic start-up-stub for CRIS/CRISv32.
2   Copyright (C) 1993-2005, 2007, 2017 Axis Communications.
3   All rights reserved.
4
5   Redistribution and use in source and binary forms, with or without
6   modification, are permitted provided that the following conditions
7   are met:
8
9   1. Redistributions of source code must retain the above copyright
10      notice, this list of conditions and the following disclaimer.
11
12   2. Neither the name of Axis Communications nor the names of its
13      contributors may be used to endorse or promote products derived
14      from this software without specific prior written permission.
15
16   THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
17   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
20   COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27   POSSIBILITY OF SUCH DAMAGE.  */
28
29#include "newlib.h"
30
31#undef cris
32#undef L
33#ifdef __NO_UNDERSCORES__
34#define L(x) x
35#else
36#define L(x) _ ## x
37#endif
38
39#ifdef HAVE_INITFINI_ARRAY
40#define _init __libc_init_array
41#define _fini __libc_fini_array
42#endif
43
44; Rudimentary v0..v32-compatible startup stub.
45
46#ifdef __ELF__
47 .section .startup,"ax"
48#endif
49 .global __start
50 nop
51__start:
52 move.d 0f,$r9
53 jump $r9
54 setf
55
56#ifndef __ELF__
57
58; For a.out, everything read-only and code-wise goes into a
59; single section, so we can't separate the interrupt table from
60; the startup code if we want to have files in-between.
61#define IN_CRT0
62#include "irqtable.S"
63
64#else
65
66; The interrupt table (at offset 12, irq #3) is expected here.
67; The simplest way to make sure we link it in, is to sacrifice
68; some memory and refer to it with a relocation.
69 .text
70 .dword __irqtable_at_irq3
71
72#endif /* __ELF__ */
73
740:
75 move.d __setup,$r9
76 jsr $r9
77 nop
78#ifdef __ELF__
79 jsr L(_init)
80 nop
81 move.d L(_fini),$r10
82 jsr L(atexit)
83 nop
84#endif
85 jsr L(main)
86 nop
87 jsr L(exit)
88 nop
890:
90 nop
91 ba 0b
92 nop
Note: See TracBrowser for help on using the repository browser.