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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [mt/] [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
# Startup Code for the Morpho mt
2
 
3
# Create a label for the start of the eh_frame section.
4
        .section .eh_frame
5
__eh_frame_begin:
6
 
7
        .section .text
8
        .global _start
9
_start:
10
 
11
        ;; Initialise the stack pointer
12
        ldui    sp, #%hi16(__stack)
13
        addui   sp, sp, #%lo16(__stack)
14
        or      fp, sp, sp
15
 
16
        ;; Zero the data space
17
        ldui    r9, #%hi16(_edata)
18
        addui   r9, r9, #%lo16(_edata)
19
        ldui    r10, #%hi16(_end)
20
        addui   r10, r10, #%lo16(_end)
21
        addi    r5,  r0, #0
22
 
23
.L0:
24
        stw     r5, r9, #0
25
        addi    r9, r9, #4
26
        or      r0, r0, r0      ; nop
27
        brle    r9, r10, .L0
28
        or      r0, r0, r0      ; nop
29
 
30
        ;; Call global and static constructors
31
        ldui    r10, #%hi16(_init)
32
        addui   r10, r10, #%lo16(_init)
33
        or      r0, r0, r0      ; nop
34
        jal     r14, r10
35
        or      r0, r0, r0      ; nop
36
        ;;  Setup destructors to be called from exit.
37
        ;;  (Just in case main never returns....)
38
        ldui    r10, #%hi16(atexit)
39
        addui   r10, r10, #%lo16(atexit)
40
        ldui    r1, #%hi16(_fini)
41
        addui   r1, r1, #%lo16(_fini)
42
        or      r0, r0, r0      ; nop
43
        jal     r14, r10
44
        or      r0, r0, r0      ; nop
45
 
46
        ;;  Initialise argc, argv and envp to empty
47
        addi    r1, r0, #0
48
        addi    r2, r0, #0
49
        addi    r3, r0, #0
50
 
51
        ;; Call main
52
        ldui    r10, #%hi16(main)
53
        addui   r10, r10, #%lo16(main)
54
        or      r0, r0, r0      ; nop
55
        jal     r14, r10
56
        or      r0, r0, r0      ; nop
57
 
58
        ;; Jump to exit
59
        ldui    r10, #%hi16(exit)
60
        addui   r10, r10, #%lo16(exit)
61
        or      r0, r0, r0      ; nop
62
        jal     r14, r10
63
        or      r0, r0, r0      ; nop

powered by: WebSVN 2.1.0

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