2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / config / ip2k / crt0.S
blob17133ce99fe0e41ed084db6f42c60cf6d6be80bb
2 ;   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
3 ;   Contributed by Red Hat, Inc.
5 ; This file is part of GCC.
7 ; GCC 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.
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.)
20 ; GCC 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.
25 ; You should have received a copy of the GNU General Public License
26 ; along with GCC; see the file COPYING.  If not, write to
27 ; the Free Software Foundation, 59 Temple Place - Suite 330,
28 ; Boston, MA 02111-1307, USA.
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
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