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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [libgloss/] [m32r/] [crt0.S] - Blame information for rev 258

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

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

powered by: WebSVN 2.1.0

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