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/] [erc32-crt0.S] - Blame information for rev 179

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

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 * This is based on the file srt0.s provided with the binary
3
 * distribution of the SPARC Instruction Simulator (SIS) found
4
 * at ftp://ftp.estec.esa.nl/pub/ws/wsd/erc32.
5
 */
6
 
7
#include "asm.h"
8
 
9
        .data
10
        .align  8
11
SYM(environ):
12
        .long   0
13
 
14
        .text
15
 
16
        .globl SYM(start)
17
SYM(start):
18
        sethi   %hi(__stack), %g1
19
        or      %g1,%lo(__stack),%g1
20
        mov     %g1, %sp                ! set the stack pointer
21
        mov     %sp, %fp
22
 
23
        /* clear the bss */
24
        sethi %hi(__bss_start),%g2
25
        or    %g2,%lo(__bss_start),%g2  ! start of bss
26
        sethi %hi(_end),%g3
27
        or    %g3,%lo(_end),%g3         ! end of bss
28
        mov   %g0,%g1                   ! so std has two zeros
29
zerobss:
30
        std    %g0,[%g2]
31
        add    %g2,8,%g2
32
        cmp    %g2,%g3
33
        bleu,a zerobss
34
        nop
35
 
36
        /* move data segment to proper location */
37
 
38
#if 0
39
relocd:
40
        set (_endtext),%g2              ! g2 = start of data in aout file
41
        set (_environ),%g4              ! g4 = start of where data should go
42
        set (_edata),%g3                ! g3 = end of where data should go
43
        subcc   %g3, %g4, %g5           ! g5 = length of data
44
 
45
        subcc   %g4, %g2, %g0           ! need to relocate data ?
46
        ble     initok
47
        ld      [%g4], %g6
48
        subcc   %g6, 1, %g0
49
        be      initok
50
mvdata:
51
        subcc   %g5, 8, %g5
52
        ldd     [%g2 + %g5], %g6
53
        bg      mvdata
54
        std     %g6, [%g4 + %g5]
55
 
56
initok:
57
#endif
58
 
59
        call    SYM(__fix_ctors)
60
        nop
61
        call    SYM(main)
62
        nop
63
 
64
        /* call exit from the C library so atexit gets called, and the
65
         * C++ destructors get run. This calls our exit routine below    * when it's done.
66
         */
67
        call    SYM(exit)
68
        nop
69
 
70
        .globl  SYM(_exit)
71
SYM(_exit):
72
        set     0xdeadd00d, %o1         ! Magic number for simulator.
73
        ta      0                       ! Halt if _main returns ...
74
        nop
75
 

powered by: WebSVN 2.1.0

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