OSDN Git Service

* rtl.h (addr_diff_vec_flags): New typedef.
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / mot3300Mcrt0.S
1 /* The start module mcrt0.s for the SysV68 Motorola 3300 Delta Series.
2    Copyright (C) 1996 Free Software Foundation, Inc.
3    Contributed by Manfred Hollstein (manfred@lts.sel.alcatel.de).
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 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 #ifdef MOTOROLA
23 # define COMM           comm
24 # define DATA           data
25 # define EVEN           even
26 # define FILE(n)        file    n
27 # define GLOBAL_SYM(s)  global  s
28 # define LOCAL_LABEL(l) L%##l
29 # define SECTION(n)     section n
30 # define TEXT           text
31 #else /* Assume we are using GNU as.  */
32 # define COMM           .comm
33 # define DATA           .data
34 # define EVEN           .even
35 # define FILE(name)     .file   name
36 # define GLOBAL_SYM(s)  .globl  s
37 # define LOCAL_LABEL(l) .L.##l
38 # define SECTION(n)     .section        n
39 # define STRING(s)      .asciz  s
40 # define TEXT           .text
41 #endif
42
43         FILE ("mcrt0.s")
44         TEXT
45         GLOBAL_SYM (_start)
46 _start: mov.l   %d0,splimit%
47         subq.w  &8,%sp
48         mov.l   8(%sp),(%sp)
49         lea     12(%sp),%a0
50         mov.l   %a0,___Argv
51         mov.l   %a0,4(%sp)
52         mov.l   %a0,%a1
53 LOCAL_LABEL(0):
54         tst.l   (%a0)+
55         bne.b   LOCAL_LABEL(0)
56 #ifdef SGS_CMP_ORDER
57         cmpa.l  %a0,(%a1)
58 #else
59         cmpa.l  (%a1),%a0
60 #endif
61         blt.b   LOCAL_LABEL(1)
62         subq.w  &4,%a0
63 LOCAL_LABEL(1):
64         mov.l   %a0,8(%sp)
65         mov.l   %a0,environ
66         jsr     initfpu
67         
68         sub     &8,%sp
69         clr.l   %d0             /* if (! isatty (fileno (stderr))) */
70         mov.b   _iob+27,%d0
71         mov.l   %d0,-(%sp)
72         jsr     isatty
73         addq.w  &4,%sp
74         tst.l   %d0
75         bne.b   LOCAL_LABEL(isatty)
76         clr.l   -(%sp)          /*      setbuf (stderr, NULL) */
77         pea     _iob+28
78         jsr     setbuf
79         addq.w  &8,%sp
80 LOCAL_LABEL(isatty):
81         addq.w  &8,%sp
82
83         mov.l   &600,-(%sp)
84         mov.l   &etext,%d1
85         subi.l  &LOCAL_LABEL(endofstart),%d1
86         addq.l  &1,%d1
87         bclr    &0,%d1
88         addi.l  &4812,%d1
89         asr.l   &1,%d1
90         mov.l   %d1,-(%sp)
91         add.l   %d1,%d1
92         mov.l   %d1,-(%sp)
93         jsr     sbrk
94         addq.w  &4,%sp
95 #ifdef SGS_CMP_ORDER
96         cmpa.l  %a0,&-1
97 #else
98         cmpa.l  &-1,%a0
99 #endif
100         beq.b   LOCAL_LABEL(3)
101         mov.l   %a0,-(%sp)
102         add.l   &12,%a0
103         mov.l   %a0,_countbase
104         mov.l   &etext,-(%sp)
105         mov.l   &LOCAL_LABEL(endofstart),-(%sp)
106         jsr     monitor
107         lea     20(%sp),%sp
108         jsr     main
109         mov.l   %d0,(%sp)
110         jsr     exit
111 _exit:  moveq   &1,%d0
112         trap    &0
113         
114         GLOBAL_SYM (mcount)
115
116         EVEN
117 mcount: bra     mcount%
118
119 LOCAL_LABEL(errtxt):
120 #ifdef STRING
121         STRING ("No space for monitor buffer\n")
122 #else
123         byte    'N,'o,' ,'s,'p,'a,'c,'e,' ,'f,'o,'r,' ,'m,'o,'n
124         byte    'i,'t,'o,'r,' ,'b,'u,'f,'f,'e,'r,'\n,0
125 #endif
126
127         EVEN
128 LOCAL_LABEL(3):
129         mov.l   &28,-(%sp)
130         mov.l   &LOCAL_LABEL(errtxt),-(%sp)
131         moveq   &2,%d0
132         mov.l   %d0,-(%sp)
133         jsr     write
134         bra.b   _exit
135 LOCAL_LABEL(endofstart):
136         nop
137         
138         EVEN
139
140         COMM    splimit%,4
141         COMM    environ,4
142         COMM    _countbase,4
143
144 #ifdef STRING
145         SECTION (.comment)
146         STRING ("$Id: mot3300Mcrt0.S,v 1.1 1997/08/11 15:57:32 law Exp $\n")
147         STRING ("Contributed by manfred@lts.sel.alcatel.de (Manfred Hollstein, Germany)\n")
148 #else
149         byte    'C,'o,'n,'t,'r,'i,'b,'u,'t,'e,'d,' ,'b,'y
150         byte    ' ,'m,'a,'n,'f,'r,'e,'d,'@,'l,'t,'s,'.,'s
151         byte    'e,'l,'.,'a,'l,'c,'a,'t,'e,'l,'.,'d,'e,' 
152         byte    '(,'M,'a,'n,'f,'r,'e,'d,' ,'H,'o,'l,'l,'s
153         byte    't,'e,'i,'n,',,' ,'G,'e,'r,'m,'a,'n,'y,')
154         byte    10,0
155 #endif