Last change
on this file since 514 was
444,
checked in by satin@…, 7 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
692 bytes
|
Line | |
---|
1 | # FR30 startup code |
---|
2 | |
---|
3 | .section .text |
---|
4 | .global _start |
---|
5 | _start: |
---|
6 | |
---|
7 | ;; Initialise the stack pointer |
---|
8 | ldi:32 __stack, r0 |
---|
9 | mov r0, sp |
---|
10 | mov r0, fp |
---|
11 | |
---|
12 | ;; Zero the data space |
---|
13 | ldi:32 #_edata, r0 |
---|
14 | ldi:32 #_end, r1 |
---|
15 | ldi:8 #0, r2 |
---|
16 | .L0: |
---|
17 | st r2, @r0 |
---|
18 | add #4, r0 |
---|
19 | cmp r1, r0 |
---|
20 | blt .L0 |
---|
21 | |
---|
22 | ;; Call global and static constructors |
---|
23 | ldi:32 _init, r0 |
---|
24 | call @r0 |
---|
25 | |
---|
26 | ;; Setup destrcutors to be called from exit. |
---|
27 | ;; (Just in case main never returns....) |
---|
28 | ldi:32 atexit, r0 |
---|
29 | ldi:32 _fini, r4 |
---|
30 | call @r0 |
---|
31 | |
---|
32 | ;; Initialise argc, argv and envp to empty |
---|
33 | ldi:8 #0, r4 |
---|
34 | ldi:8 #0, r5 |
---|
35 | ldi:8 #0, r6 |
---|
36 | |
---|
37 | ;; Call main |
---|
38 | ldi:32 main, r0 |
---|
39 | call @r0 |
---|
40 | |
---|
41 | ;; Jump to exit |
---|
42 | ldi:32 exit, r0 |
---|
43 | call @r0 |
---|
44 | |
---|
45 | ;; Should never reach here |
---|
46 | int #9 |
---|
Note: See
TracBrowser
for help on using the repository browser.