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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [iq2000/] [crt0.S] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
##==============================================================================
2
##
3
##      crt0.S
4
##
5
##      IQ2000 startup code
6
##
7
##==============================================================================
8
##
9
## Copyright (c) 2000, Cygnus Solutions, A Red Hat Company
10
##
11
## The authors hereby grant permission to use, copy, modify, distribute,
12
## and license this software and its documentation for any purpose, provided
13
## that existing copyright notices are retained in all copies and that this
14
## notice is included verbatim in any distributions. No written agreement,
15
## license, or royalty fee is required for any of the authorized uses.
16
## Modifications to this software may be copyrighted by their authors
17
## and need not follow the licensing terms described here, provided that
18
## the new terms are clearly indicated on the first page of each file where
19
## they apply.
20
##
21
 
22
##------------------------------------------------------------------------------
23
 
24
        .file   "crt0.S"
25
 
26
##------------------------------------------------------------------------------
27
## Startup code
28
        .section .text
29
        .global _start
30
_start:
31
        lui %29,%hi(__stack)
32
        ori %29,%29,%lo(__stack)
33
 
34
        lui %24,%hi(_edata)     # get start of bss
35
        ori %24,%24,%lo(_edata)
36
 
37
        lui %25,%hi(_end)       # get end of bss
38
        ori %25,%25,%lo(_end)
39
 
40
        beq     %24,%25,.L0     # check if end and start are the same
41
                                # do nothing if no bss
42
 
43
.L1:
44
        sb %0,0(%24)            #  clear a byte and bump pointer
45
        addi %24,%24,1
46
        bne %24,%25,.L1
47
        nop
48
 
49
.L0:
50
        jal  _main              # call _main to run ctors/dtors
51
        nop
52
        xor %4,%4,%4
53
        jal main                # call main program
54
        xor %5,%5,%5
55
        jal exit                # all done, no need to return or
56
        or %4,%0,%2             # exit with main's return value
57
 
58
        .section .data
59
        .global __dso_handle
60
        .weak __dso_handle
61
__dso_handle:
62
        .long   0

powered by: WebSVN 2.1.0

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