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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [libgloss/] [sparc/] [crt0-701.S] - Blame information for rev 310

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

Line No. Rev Author Line
1 148 jeremybenn
/* crt0.S for the sparclet 701.
2
 
3
   At the moment, all the necessary syscalls are here.
4
   Convention has them in a separate file but libgloss is still in
5
   too much flux.  */
6
 
7
        .text
8
 
9
        .global start
10
start:
11
 
12
! zero bss
13
 
14
        sethi %hi(_end), %o1
15
        or %o1, %lo(_end), %o1
16
        sethi %hi(_edata), %o0
17
        or %o0, %lo (_edata), %o0
18
        sub %o1, %o0, %o1
19
Lzero_bss:
20
        subcc %o1, 4, %o1
21
        clr [%o0]
22
        bne Lzero_bss
23
        add %o0, 4, %o0
24
 
25
! set up argc, argv, envp (?)
26
 
27
        ld [%sp+64], %o0
28
        sll %o0, 2, %o2
29
        add %o2, 4, %o2
30
        add %sp, 68, %o1
31
        add %o1, %o2, %o2
32
        sethi %hi(_environ), %o3
33
        st %o2, [%o3+%lo(_environ)]
34
 
35
! call main, exit
36
 
37
        call _main
38
        sub %sp, 32, %sp
39
        call _exit
40
        nop
41
 
42
! void _exit (int rc)
43
 
44
        .global __exit
45
__exit:
46
        mov 1, %g1
47
        ta 0
48
! If that does not work, just loop forever.
49
Lloop_forever:
50
        b Lloop_forever
51
        nop
52
 
53
! int _open (char *, int)
54
 
55
        .global _open
56
_open:
57
        mov 5, %g1
58
        ta 0
59
        bcc Lnoerr
60
        nop
61
        b Lcerror
62
        nop
63
 
64
! int _close (int)
65
 
66
        .global _close
67
_close:
68
        mov 6, %g1
69
        ta 0
70
        bcc Lnoerr
71
        nop
72
        b Lcerror
73
        nop
74
 
75
! int read (int, char *, int)
76
 
77
        .global _read
78
_read:
79
        mov 3, %g1
80
        ta 0
81
        bcc Lnoerr
82
        nop
83
        b Lcerror
84
        nop
85
 
86
! int write (int, char *, int)
87
 
88
        .global _write
89
_write:
90
        mov 4, %g1
91
        ta 0
92
        bcc Lnoerr
93
        nop
94
        b Lcerror
95
        nop
96
 
97
Lnoerr:
98
        retl
99
        nop
100
 
101
Lcerror:
102
        sethi %hi(__impure_ptr), %g1
103
        st %o0, [%g1+%lo(__impure_ptr)]
104
        retl
105
        mov -1, %o0

powered by: WebSVN 2.1.0

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