xref: /openbsd-src/gnu/usr.bin/gcc/gcc/config/ip2k/crt0.S (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
1;
2;   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
3;   Contributed by Red Hat, Inc.
4;
5; This file is part of GNU CC.
6;
7; GNU CC is free software; you can redistribute it and/or modify
8; it under the terms of the GNU General Public License as published by
9; the Free Software Foundation; either version 2, or (at your option)
10; any later version.
11;
12; In addition to the permissions in the GNU General Public License, the
13; Free Software Foundation gives you unlimited permission to link the
14; compiled version of this file with other programs, and to distribute
15; those programs without any restriction coming from the use of this
16; file.  (The General Public License restrictions do apply in other
17; respects; for example, they cover modification of the file, and
18; distribution when not linked into another program.)
19;
20; GNU CC is distributed in the hope that it will be useful,
21; but WITHOUT ANY WARRANTY; without even the implied warranty of
22; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23; GNU General Public License for more details.
24;
25; You should have received a copy of the GNU General Public License
26; along with GNU CC; see the file COPYING.  If not, write to
27; the Free Software Foundation, 59 Temple Place - Suite 330,
28; Boston, MA 02111-1307, USA.
29;
30
31	.file	"crt0.S"
32	.text
33	.global	__start
34	.func	__start
35__start:
36	clr	$ff		; Insure we have a zero available
37	mov	w,#%hi8data(__stack) ; set up stack
38	mov	sph,w		;
39	mov	w,#%lo8data(__stack)
40	mov	spl,w
41
42	push	#0		; Set argc/argv.
43	push	#0		; Only required for testing
44	push	#0		;  purposes and "ansi" main.
45	push	#0
46	page	_main
47	call	_main
48	push	$81		; use return value to call exit()
49	push	$80
50	page	_exit
51	call	_exit
52	break			; Should never return
53	.endfunc
54