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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [libgloss/] [mt/] [crt0-16-003.S] - Blame information for rev 861

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

Line No. Rev Author Line
1 207 jeremybenn
; crt0.s - Startup code for the mrisc1. This code initializes the C
2
;              run-time model.
3
;
4
;
5
; Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6
;
7
;  The authors hereby grant permission to use, copy, modify, distribute,
8
;  and license this software and its documentation for any purpose, provided
9
;  that existing copyright notices are retained in all copies and that this
10
;  notice is included verbatim in any distributions. No written agreement,
11
;  license, or royalty fee is required for any of the authorized uses.
12
;  Modifications to this software may be copyrighted by their authors
13
;  and need not follow the licensing terms described here, provided that
14
;  the new terms are clearly indicated on the first page of each file where
15
;  they apply.
16
;
17
 
18
        ; Create a label for the start of the eh_frame section.
19
        .section .eh_frame
20
__eh_frame_begin:
21
 
22
        .text
23
        .global _start
24
_start:
25
        ;; Initialize the stack pointer
26
        ldui    sp, #%hi16(__stack)
27
        addui   sp, sp, #%lo16(__stack)
28
        or      fp, sp, sp
29
        ;; Zero the bss space
30
        ldui    r9, #%hi16(__bss_start)
31
        addui   r9, r9, #%lo16(__bss_start)
32
        ldui    r10, #%hi16(__bss_end)
33
        addui   r10, r10, #%lo16(__bss_end)
34
        or      r0, r0, r0
35
        brle    r10, r9, .Lnext1
36
        or      r0, r0, r0
37
.Lcpy0:
38
        stw     r0, r9, #0
39
        addi    r9, r9, #4
40
        or      r0, r0, r0      ; nop
41
        brle    r9, r10, .Lcpy0
42
        or      r0, r0, r0      ; nop
43
 
44
.Lnext1:
45
        ;; Copy data from ROM to Frame Buffer (on-chip memory)
46
        ldui    r9, #%hi16(_fbdata_start)
47
        ori     r9, r9, #%lo16(_fbdata_start)
48
        ldui    r10, #%hi16(_fbdata_end)
49
        ori     r10, r10, #%lo16(_fbdata_end)
50
        ldui    r11, #%hi16(_fbdata_vma)
51
        brle    r10, r9, .Lnext2
52
        ori     r11, r11, #%lo16(_fbdata_vma)
53
.Lcpy1:
54
        ldw     r5, r9, #$0
55
        addi    r9, r9, #$4
56
        stw     r5, r11, #$0
57
        brlt    r9, r10, .Lcpy1
58
        addi    r11, r11, #$4
59
 
60
.Lnext2:
61
        ;; Zero the frame buffer bss section
62
        ldui    r9, #%hi16(_fbbss_start)
63
        ori     r9, r9, #%lo16(_fbbss_start)
64
        ldui    r10, #%hi16(_fbbss_end)
65
        ori     r10, r10, #%lo16(_fbbss_end)
66
        or      r0, r0, r0
67
        brle    r10, r9, .Lnext3
68
        or      r0, r0, r0
69
.Lcpy2:
70
        stw     r0, r9, #$0
71
        addi    r9, r9, #$4
72
        or      r0, r0, r0
73
        brle    r9, r10, .Lcpy2
74
        or      r0, r0, r0
75
 
76
.Lnext3:
77
        ;; Call global and static constructors
78
        ldui    r10, #%hi16(_init)
79
        ori     r10, r10, #%lo16(_init)
80
        or      r0, r0, r0      ; nop
81
        jal     r14, r10
82
        or      r0, r0, r0      ; nop
83
 
84
        ;; Call main
85
        ldui    r10, #%hi16(main)
86
        ori     r10, r10, #%lo16(main)
87
        or      r0, r0, r0      ; nop
88
        jal     r14, r10
89
        or      r0, r0, r0      ; nop
90
 
91
        ;; DJK - Added 12Nov01. Pass main's return value to exit.
92
        or      r1, r11, r0
93
 
94
        ;; Jump to exit
95
        ldui    r10, #%hi16(exit)
96
        ori     r10, r10, #%lo16(exit)
97
        or      r0, r0, r0      ; nop
98
        jal     r14, r10
99
        or      r0, r0, r0      ; nop
100
 
101
        ;; Exit does not return, however, this code is to catch an
102
        ;;   error if it does. Set the processor into sleep mode.
103
        ori     r1, r0, #$1
104
        stw     r1, r0, #%lo16(_DEBUG_HALT_REG)
105
        or      r0, r0, r0
106
        or      r0, r0, r0
107
        or      r0, r0, r0
108
        or      r0, r0, r0
109
        or      r0, r0, r0
110
.Lend:
111
        jmp .Lend
112
        or      r0, r0, r0

powered by: WebSVN 2.1.0

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