devctl.h: update for POSIX-1.2024
[newlib-cygwin.git] / newlib / libc / sys / h8300hms / crt0.S
blob05634113cc814af28bab5d77f00ab884382ca8f7
1 ; h8/300 and h8/300h start up file.
3 #include "setarch.h"
5 #ifdef __H8300__
7         .section .text
8         .global _start
9 _start:
10         mov.w   #_stack,sp
11         mov.w   #_edata,r0
12         mov.w   #_end,r2
13         sub.w   r1,r1
14         sub.w   r0,r2
15         jsr     @_memset
16 #ifdef __ELF__
17         mov.l   #__fini,r0
18         jsr     @_atexit
19 #ifdef __SIMULATOR__
20         jsr     @0xcc
21 #endif
22         jsr     @__init
23 #else
24 #ifdef __SIMULATOR__
25         jsr     @0xcc
26 #endif
27         jsr     @___main
28 #endif
29         jsr     @_main
30         jsr     @_exit
32         .section .stack
33 _stack: .word   1
35 #endif
37 #ifdef __H8300H__
39         .section .text
40         .global _start
41 _start:
42         mov.l   #_stack,sp
43         mov.l   #_edata,er0
44         mov.l   #_end,er2
45         sub.w   r1,r1
46         sub.l   er0,er2
47         jsr     @_memset
48 #ifdef __ELF__
49         mov.l   #__fini,er0
50         jsr     @_atexit
51 #ifdef __SIMULATOR__
52         jsr     @0xcc
53 #endif
54         jsr     @__init
55 #else
56 #ifdef __SIMULATOR__
57         jsr     @0xcc
58 #endif
59         jsr     @___main
60 #endif
61         jsr     @_main
62         jsr     @_exit
64         .section .stack
65 _stack: .long   1
67 #endif
69 #if defined (__H8300S__) || defined (__H8300SX__)
71         .section .text
72         .global _start
73 _start:
74         mov.l   #_stack,sp
75         mov.l   #_edata,er0
76         mov.l   #_end,er2
77         sub.w   r1,r1
78         sub.l   er0,er2
79         jsr     @_memset
80 #ifdef __ELF__
81         mov.l   #__fini,er0
82         jsr     @_atexit
83 #ifdef __SIMULATOR__
84         jsr     @0xcc
85 #endif
86         jsr     @__init
87 #else
88 #ifdef __SIMULATOR__
89         jsr     @0xcc
90 #endif
91         jsr     @___main
92 #endif
93         jsr     @_main
94         jsr     @_exit
96         .section .stack
97 _stack: .long   1
99 #endif