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

Subversion Repositories or1k

[/] [or1k/] [branches/] [newlib/] [newlib/] [newlib/] [libc/] [sys/] [d10v/] [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
        .global _start
3
        .type   _start,@function
4
        .stabs  "crt0.S",100,0,0,_start
5
        .stabs  "int:t(0,1)=r(0,1);-32768;32767;",128,0,0,0
6
        .stabs  "_start:F(0,1)",36,0,1,_start
7
 
8
_start:
9
 
10
; R14 always contains memory base address (0)
11
 
12
        ldi     r14,0
13
 
14
; Set the USER stack pointer.
15
 
16
        ldi     sp, 0x8000      ; SW
17
        mvtc    sp, psw         ; psw <- SW
18
        ldi     sp, _stack
19
        ldi     r0,0            ; zero arguments
20
        ldi     r1,0
21
 
22
; Clear the BSS.  Do it in two parts for efficiency: longwords first
23
; for most of it, then the remaining 0 to 3 bytes.
24
 
25
        ldi     r2, __bss_start ; R2 = start of BSS
26
        ldi     r3, _end        ; R3 = end of BSS + 1
27
        sub     r3, r2          ; R3 = BSS size in bytes
28
        mv      r4, r3
29
        srli    r4, 2           ; R4 = BSS size in longwords (rounded down)
30
loop1:
31
        cmpeqi  r4, 0           ; more longords to zero out?
32
        brf0t.s endloop1        ; nope
33
        st2w    r0, @r2+        ; yep, zero out another longword
34
        subi    r4, 1           ; decrement count
35
        bra.l   loop1           ; go do some more
36
 
37
endloop1:
38
        and3    r4, r3, 3       ; get no. of remaining BSS bytes to clear
39
loop2:
40
        cmpeqi  r4, 0           ; more bytes to zero out?
41
        brf0t.s endloop2        ; nope
42
        stb     r0, @r2         ; yep, zero out another byte
43
        addi    r2, 1           ; bump address
44
        subi    r4, 1           ; decrement count
45
        bra.s   loop2           ; go do some more
46
endloop2:
47
 
48
; Call main, then stop simulator
49
 
50
        bl      main
51
        bl      exit
52
        stop
53
.Lstart:
54
        .size   _start,.Lstart-_start
55
        .stabs  "",36,0,0,.Lstart-_start
56
 
57
        .section .stack
58
_stack: .long   1

powered by: WebSVN 2.1.0

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