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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [libgloss/] [mcore/] [crt0.S] - Blame information for rev 56

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

Line No. Rev Author Line
1 56 joel
// MCore StartUp Code.
2
 
3
        .import main
4
        .import exit
5
 
6
        .text
7
        .export _start
8
_start:
9
        .export _mainCRTStartup
10
_mainCRTStartup:
11
        // Initialise the stack pointer
12
        lrw     r1, _stack
13
        mov     r0, r1
14
 
15
        // Zero the .bss data space
16
        lrw     r1, __bss_start__
17
        lrw     r2, __bss_end__
18
        movi    r3, 0
19
.L0:
20
        st      r3, (r1, 0)
21
        addi    r1, 4
22
        cmphs   r1, r2
23
        bf      .L0
24
#ifdef __ELF__
25
        // Call the global/static constructors
26
        jbsr    _init
27
 
28
        // Setup destructors to be called from exit,
29
        // just in case main never returns...
30
        lrw     r2, _fini
31
        jbsr    atexit
32
#endif
33
 
34
        // Initialise the parameters to main()
35
        movi    r2, 0   // argc
36
        movi    r3, 0   // argv
37
        movi    r4, 0   // envp
38
 
39
        // Call main
40
        jbsr    main
41
 
42
        // Call exit
43
        movi    r2, 0
44
        jbsr    exit
45
 
46
        // We should never reach here.
47
        bkpt
48
 
49
 

powered by: WebSVN 2.1.0

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