annotate src/startup.s @ 3:54739a11be66
- .data copy and .bss clearing
- also made sure .data and .bss start and end markers are dword-aligned to make
sure I can copy 4bytes at a time
author |
John Tsiombikas <nuclear@member.fsf.org> |
date |
Tue, 31 Jan 2017 07:11:17 +0200 |
parents |
909c22dc18d2 |
children |
862f8a034cae |
rev |
line source |
nuclear@0
|
1 .text
|
nuclear@0
|
2 .extern main
|
nuclear@0
|
3
|
nuclear@0
|
4 .global start
|
nuclear@0
|
5 start:
|
nuclear@3
|
6 | copy .data section from ROM to RAM
|
nuclear@3
|
7 move.l #_data_lma, %a0
|
nuclear@3
|
8 move.l #_data_start, %a1
|
nuclear@3
|
9 move.l #_data_end, %a2
|
nuclear@3
|
10 cmp.l %a1, %a2
|
nuclear@3
|
11 beq.s 1f | skip data copy if the section is empty
|
nuclear@3
|
12 0: move.l (%a0)+, (%a1)+
|
nuclear@3
|
13 cmp.l %a1, %a2
|
nuclear@3
|
14 bne.s 0b
|
nuclear@3
|
15 1:
|
nuclear@3
|
16
|
nuclear@3
|
17 | zero the .bss section
|
nuclear@3
|
18 move.l #_bss_start, %a0
|
nuclear@3
|
19 move.l #_bss_end, %a1
|
nuclear@3
|
20 cmp.l %a0, %a1
|
nuclear@3
|
21 beq.s 1f | skip bss zeroing if the section is empty
|
nuclear@3
|
22 0: clr.l (%a0)+
|
nuclear@3
|
23 cmp.l %a0, %a1
|
nuclear@3
|
24 bne.s 0b
|
nuclear@3
|
25 1:
|
nuclear@0
|
26 jsr main
|
nuclear@0
|
27 stop #0x2700
|