source: trunk/libs/newlib/src/libgloss/mn10300/crt0.S @ 639

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

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

File size: 1.7 KB
Line 
1##==============================================================================
2##
3##      crt0.S
4##
5##      MN10300 startup code
6##
7##==============================================================================
8##
9## Copyright (c) 1995, 1996, 1997, 1998 Cygnus Solutions
10##
11## The authors hereby grant permission to use, copy, modify, distribute,
12## and license this software and its documentation for any purpose, provided
13## that existing copyright notices are retained in all copies and that this
14## notice is included verbatim in any distributions. No written agreement,
15## license, or royalty fee is required for any of the authorized uses.
16## Modifications to this software may be copyrighted by their authors
17## and need not follow the licensing terms described here, provided that
18## the new terms are clearly indicated on the first page of each file where
19## they apply.
20##
21       
22##------------------------------------------------------------------------------
23       
24        .file   "crt0.S"
25
26##------------------------------------------------------------------------------
27## Startup code
28        .section .text
29        .global _start
30_start:
31        mov _stack-8,a0         # Load up the stack pointer
32        mov a0,sp
33
34        mov _edata,a0           # Get the start/end of bss
35        mov _end,a1
36
37        cmp a0,a1               # If no bss, then do nothing
38        beq .L0
39
40        clr d0                  # clear d0
41
42.L1:
43        movbu d0,(a0)           # Clear a byte and bump pointer
44        inc a0
45        cmp a0,a1
46        bne .L1
47
48.L0:
49        call ___main,[],0       # Call __main to run ctors/dtors
50        clr d0
51        clr d1
52        mov d0,(4,sp)
53        call _main,[],0         # Call main program
54        call _exit,[],0         # All done, no need to return or
55                                # deallocate our stack.
56
57        .section .stack
58_stack: .long   1
59
60        .section .data
61        .global ___dso_handle
62        .weak ___dso_handle
63___dso_handle:
64        .long   0
Note: See TracBrowser for help on using the repository browser.