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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [iq2000/] [crt0.S] - Diff between revs 158 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 158 Rev 816
##==============================================================================
##==============================================================================
##
##
##      crt0.S
##      crt0.S
##
##
##      IQ2000 startup code
##      IQ2000 startup code
##
##
##==============================================================================
##==============================================================================
##
##
## Copyright (c) 2000, Cygnus Solutions, A Red Hat Company
## Copyright (c) 2000, Cygnus Solutions, A Red Hat Company
##
##
## The authors hereby grant permission to use, copy, modify, distribute,
## The authors hereby grant permission to use, copy, modify, distribute,
## and license this software and its documentation for any purpose, provided
## and license this software and its documentation for any purpose, provided
## that existing copyright notices are retained in all copies and that this
## that existing copyright notices are retained in all copies and that this
## notice is included verbatim in any distributions. No written agreement,
## notice is included verbatim in any distributions. No written agreement,
## license, or royalty fee is required for any of the authorized uses.
## license, or royalty fee is required for any of the authorized uses.
## Modifications to this software may be copyrighted by their authors
## Modifications to this software may be copyrighted by their authors
## and need not follow the licensing terms described here, provided that
## and need not follow the licensing terms described here, provided that
## the new terms are clearly indicated on the first page of each file where
## the new terms are clearly indicated on the first page of each file where
## they apply.
## they apply.
##
##
##------------------------------------------------------------------------------
##------------------------------------------------------------------------------
        .file   "crt0.S"
        .file   "crt0.S"
##------------------------------------------------------------------------------
##------------------------------------------------------------------------------
## Startup code
## Startup code
        .section .text
        .section .text
        .global _start
        .global _start
_start:
_start:
        lui %29,%hi(__stack)
        lui %29,%hi(__stack)
        ori %29,%29,%lo(__stack)
        ori %29,%29,%lo(__stack)
        lui %24,%hi(_edata)     # get start of bss
        lui %24,%hi(_edata)     # get start of bss
        ori %24,%24,%lo(_edata)
        ori %24,%24,%lo(_edata)
        lui %25,%hi(_end)       # get end of bss
        lui %25,%hi(_end)       # get end of bss
        ori %25,%25,%lo(_end)
        ori %25,%25,%lo(_end)
        beq     %24,%25,.L0     # check if end and start are the same
        beq     %24,%25,.L0     # check if end and start are the same
                                # do nothing if no bss
                                # do nothing if no bss
.L1:
.L1:
        sb %0,0(%24)            #  clear a byte and bump pointer
        sb %0,0(%24)            #  clear a byte and bump pointer
        addi %24,%24,1
        addi %24,%24,1
        bne %24,%25,.L1
        bne %24,%25,.L1
        nop
        nop
.L0:
.L0:
        jal  _main              # call _main to run ctors/dtors
        jal  _main              # call _main to run ctors/dtors
        nop
        nop
        xor %4,%4,%4
        xor %4,%4,%4
        jal main                # call main program
        jal main                # call main program
        xor %5,%5,%5
        xor %5,%5,%5
        jal exit                # all done, no need to return or
        jal exit                # all done, no need to return or
        or %4,%0,%2             # exit with main's return value
        or %4,%0,%2             # exit with main's return value
        .section .data
        .section .data
        .global __dso_handle
        .global __dso_handle
        .weak __dso_handle
        .weak __dso_handle
__dso_handle:
__dso_handle:
        .long   0
        .long   0
 
 

powered by: WebSVN 2.1.0

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