OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [libgloss/] [m32r/] [crt0.S] - Blame information for rev 39

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
        .text
2
        .balign 4
3
        .global _start
4
_start:
5
 
6
        ld24    sp, _stack
7
        ldi     fp, #0
8
 
9
# Clear the BSS.  Do it in two parts for efficiency: longwords first
10
# for most of it, then the remaining 0 to 3 bytes.
11
 
12
        ld24    r2, __bss_start ; R2 = start of BSS
13
        ld24    r3, _end        ; R3 = end of BSS + 1
14
        sub     r3, r2          ; R3 = BSS size in bytes
15
        mv      r4, r3
16
        srli    r4, #2          ; R4 = BSS size in longwords (rounded down)
17
        ldi     r1, #0          ; clear R1 for longword store
18
        addi    r2, #-4         ; account for pre-inc store
19
        beqz    r4, .Lendloop1  ; any more to go?
20
.Lloop1:
21
        st      r1, @+r2        ; yep, zero out another longword
22
        addi    r4, #-1         ; decrement count
23
        bnez    r4, .Lloop1     ; go do some more
24
.Lendloop1:
25
        and3    r4, r3, #3      ; get no. of remaining BSS bytes to clear
26
        addi    r2, #4          ; account for pre-inc store
27
        beqz    r4, .Lendloop2  ; any more to go?
28
.Lloop2:
29
        stb     r1, @r2         ; yep, zero out another byte
30
        addi    r2, #1          ; bump address
31
        addi    r4, #-1         ; decrement count
32
        bnez    r4, .Lloop2     ; go do some more
33
.Lendloop2:
34
 
35
# Run code in the .init section.
36
# This will queue the .fini section to be run with atexit.
37
 
38
        bl      __init
39
 
40
# Call main, then exit.
41
 
42
        bl      main
43
        bl      exit
44
 
45
# If that fails just loop.
46
 
47
.Lexit:
48
        bra     .Lexit

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.