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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [d10v/] [crt0.S] - Blame information for rev 855

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

Line No. Rev Author Line
1 148 jeremybenn
        .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 and SYSTEM stack pointers.
15
 
16
        ldi     r0, 0           ; zero arguments
17
        ldi     r1, 0
18
        mvtc    r0, psw         ; select SPI and set it
19
        ldi     sp, _stack
20
        ldi     r10, 0x8000     ; select SPU/FP and set it
21
        mvtc r10, psw || ldi r11, 0;  clear stack frame
22
        ldi     sp, _stack - 0x200
23
        ldi     r13, 0
24
 
25
; Clear the BSS.  Do it in two parts for efficiency: longwords first
26
; for most of it, then the remaining 0 to 3 bytes.
27
 
28
        ldi     r2, __bss_start ; R2 = start of BSS
29
        ldi     r3, _end        ; R3 = end of BSS + 1
30
        sub     r3, r2          ; R3 = BSS size in bytes
31
        mv      r4, r3
32
        srli    r4, 2           ; R4 = BSS size in longwords (rounded down)
33
loop1:
34
        cmpeqi  r4, 0           ; more longords to zero out?
35
        brf0t.s endloop1        ; nope
36
        st2w    r0, @r2+        ; yep, zero out another longword
37
        subi    r4, 1           ; decrement count
38
        bra.l   loop1           ; go do some more
39
 
40
endloop1:
41
        and3    r4, r3, 3       ; get no. of remaining BSS bytes to clear
42
loop2:
43
        cmpeqi  r4, 0           ; more bytes to zero out?
44
        brf0t.s endloop2        ; nope
45
        stb     r0, @r2         ; yep, zero out another byte
46
        addi    r2, 1           ; bump address
47
        subi    r4, 1           ; decrement count
48
        bra.s   loop2           ; go do some more
49
endloop2:
50
; Call main, then stop simulator
51
        st r11, @-sp
52
        st r13, @-sp
53
        mv r11, sp
54
 
55
        bl      main
56
        bl      exit
57
        stop
58
.Lstart:
59
        .size   _start,.Lstart-_start
60
        .stabs  "",36,0,0,.Lstart-_start
61
 
62
        .section .stack
63
_stack: .long   1

powered by: WebSVN 2.1.0

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