Welcome to mirror list, hosted at ThFree Co, Russian Federation.

crt0.S « iq2000 « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eff6b27831fb107d232f0c09d24e965ef763641f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
##==============================================================================
##
##	crt0.S
##
##	IQ2000 startup code
##
##==============================================================================
##
## Copyright (c) 2000, Cygnus Solutions, A Red Hat Company
## 
## The authors hereby grant permission to use, copy, modify, distribute,
## and license this software and its documentation for any purpose, provided
## that existing copyright notices are retained in all copies and that this
## notice is included verbatim in any distributions. No written agreement,
## license, or royalty fee is required for any of the authorized uses.
## Modifications to this software may be copyrighted by their authors
## 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
## they apply.
##
	
##------------------------------------------------------------------------------
	
	.file	"crt0.S"

##------------------------------------------------------------------------------
## Startup code
	.section .text
	.global	_start
_start:
	lui %29,%hi(__stack)
	ori %29,%29,%lo(__stack)

	lui %24,%hi(_edata)	# get start of bss
	ori %24,%24,%lo(_edata)

	lui %25,%hi(_end)	# get end of bss
	ori %25,%25,%lo(_end)

	beq	%24,%25,.L0	# check if end and start are the same
				# do nothing if no bss
	
.L1:
	sb %0,0(%24)		#  clear a byte and bump pointer
	addi %24,%24,1
	bne %24,%25,.L1
	nop
	
.L0:
	jal  _main		# call _main to run ctors/dtors
	nop
	xor %4,%4,%4
	jal main		# call main program
	xor %5,%5,%5
	jal exit		# all done, no need to return or
	or %4,%0,%2		# exit with main's return value

	.section .data
	.global __dso_handle
	.weak __dso_handle
__dso_handle:
	.long	0