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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
; ARC start up file
2
; In the absence of a custom linker script, go with something simple.
3
; We do not support passing arguments to "main", but this is an embedded
4
; system anyway.
5
;
6
; We call init/fini here without cpu prefixes because there is always
7
; only one .init/.fini section per image.
8
 
9
        .section .text
10
        .align 4
11
 
12
        .global start
13
start:
14
 
15
        mov     sp,end          ; Round "sp" up to page after "end".
16
        add     sp,sp,4095
17
        and     sp,sp,-4096
18
 
19
        ld      r8,[stack_size] ; Add stack size to "sp".
20
        add     sp,sp,r8
21
 
22
        st      sp,[sbrk_start] ; Initialize malloc heap.
23
        st      sp,[sbrk_loc]
24
 
25
        sub     sp,sp,16        ; callee expects 16 bytes already "pushed".
26
        mov     fp,0            ; Top of stack frame indicator.
27
 
28
        mov     r0,edata        ; Zero bss.
29
        mov     r2,end
30
        sub     r2,r2,r0
31
        mov     r1,0
32
 
33
#ifdef __base__
34
        bl.nd   _memset
35
        bl.nd   init            ; .init section entry point.
36
        mov     r0,%st(fini)    ; .fini section entry point.
37
        bl.nd   _atexit
38
        mov     r0,0            ; argc
39
        mov     r1,0            ; argv
40
        bl.nd   _main
41
        bl.nd   _exit
42
#endif
43
 
44
#ifdef __host__
45
        bl.nd   _host_memset
46
        bl.nd   init            ; .init section entry point.
47
        mov     r0,%st(fini)    ; .fini section entry point.
48
        bl.nd   _host_atexit
49
        mov     r0,0            ; argc
50
        mov     r1,0            ; argv
51
        bl.nd   _host_main
52
        bl.nd   _host_exit
53
#endif
54
 
55
#ifdef __graphics__
56
        bl.nd   _graphics_memset
57
        bl.nd   init            ; .init section entry point.
58
        mov     r0,%st(fini)    ; .fini section entry point.
59
        bl.nd   _graphics_atexit
60
        mov     r0,0            ; argc
61
        mov     r1,0            ; argv
62
        bl.nd   _graphics_main
63
        bl.nd   _graphics_exit
64
#endif
65
 
66
#ifdef __audio__
67
        bl.nd   _audio_memset
68
        bl.nd   init            ; .init section entry point.
69
        mov     r0,%st(fini)    ; .fini section entry point.
70
        bl.nd   _audio_atexit
71
        mov     r0,0            ; argc
72
        mov     r1,0            ; argv
73
        bl.nd   _audio_main
74
        bl.nd   _audio_exit
75
#endif

powered by: WebSVN 2.1.0

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