1 // Inferno utils/5c/5.out.h
2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/5.out.h
3 //
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
6 // Portions Copyright © 1997-1999 Vita Nuova Limited
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
8 // Portions Copyright © 2004,2006 Bruce Ellis
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
11 // Portions Copyright © 2009 The Go Authors. All rights reserved.
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a copy
14 // of this software and associated documentation files (the "Software"), to deal
15 // in the Software without restriction, including without limitation the rights
16 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 // copies of the Software, and to permit persons to whom the Software is
18 // furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included in
21 // all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 // THE SOFTWARE.
30
31 #define NSNAME 8
32 #define NSYM 50
33 #define NREG 16
34
35 #define NOPROF (1<<0)
36 #define DUPOK (1<<1)
37 #define NOSPLIT (1<<2)
38 #define ALLTHUMBS (1<<3)
39
40 #define REGRET 0
41 /* -1 disables use of REGARG */
42 #define REGARG -1
43 /* compiler allocates R1 up as temps */
44 /* compiler allocates register variables R3 up */
45 #define REGEXT 10
46 /* these two registers are declared in runtime.h */
47 #define REGG (REGEXT-0)
48 #define REGM (REGEXT-1)
49 /* compiler allocates external registers R10 down */
50 #define REGTMP 11
51 #define REGSB 12
52 #define REGSP 13
53 #define REGLINK 14
54 #define REGPC 15
55
56 #define NFREG 8
57 #define FREGRET 0
58 #define FREGEXT 7
59 #define FREGTMP 15
60 /* compiler allocates register variables F0 up */
61 /* compiler allocates external registers F7 down */
62
63 enum as
64 {
65 AXXX,
66
67 AAND,
68 AEOR,
69 ASUB,
70 ARSB,
71 AADD,
72 AADC,
73 ASBC,
74 ARSC,
75 ATST,
76 ATEQ,
77 ACMP,
78 ACMN,
79 AORR,
80 ABIC,
81
82 AMVN,
83
84 AB,
85 ABL,
86
87 /*
88 * Do not reorder or fragment the conditional branch
89 * opcodes, or the predication code will break
90 */
91 ABEQ,
92 ABNE,
93 ABCS,
94 ABHS,
95 ABCC,
96 ABLO,
97 ABMI,
98 ABPL,
99 ABVS,
100 ABVC,
101 ABHI,
102 ABLS,
103 ABGE,
104 ABLT,
105 ABGT,
106 ABLE,
107
108 AMOVWD,
109 AMOVWF,
110 AMOVDW,
111 AMOVFW,
112 AMOVFD,
113 AMOVDF,
114 AMOVF,
115 AMOVD,
116
117 ACMPF,
118 ACMPD,
119 AADDF,
120 AADDD,
121 ASUBF,
122 ASUBD,
123 AMULF,
124 AMULD,
125 ADIVF,
126 ADIVD,
127 ASQRTF,
128 ASQRTD,
129
130 ASRL,
131 ASRA,
132 ASLL,
133 AMULU,
134 ADIVU,
135 AMUL,
136 ADIV,
137 AMOD,
138 AMODU,
139
140 AMOVB,
141 AMOVBU,
142 AMOVH,
143 AMOVHU,
144 AMOVW,
145 AMOVM,
146 ASWPBU,
147 ASWPW,
148
149 ANOP,
150 ARFE,
151 ASWI,
152 AMULA,
153
154 ADATA,
155 AGLOBL,
156 AGOK,
157 AHISTORY,
158 ANAME,
159 ARET,
160 ATEXT,
161 AWORD,
162 ADYNT_,
163 AINIT_,
164 ABCASE,
165 ACASE,
166
167 AEND,
168
169 AMULL,
170 AMULAL,
171 AMULLU,
172 AMULALU,
173
174 ABX,
175 ABXRET,
176 ADWORD,
177
178 ASIGNAME,
179
180 ALDREX,
181 ASTREX,
182
183 ALDREXD,
184 ASTREXD,
185
186 ALAST,
187 };
188
189 /* scond byte */
190 #define C_SCOND ((1<<4)-1)
191 #define C_SBIT (1<<4)
192 #define C_PBIT (1<<5)
193 #define C_WBIT (1<<6)
194 #define C_FBIT (1<<7) /* psr flags-only */
195 #define C_UBIT (1<<7) /* up bit, unsigned bit */
196
197 #define C_SCOND_EQ 0
198 #define C_SCOND_NE 1
199 #define C_SCOND_HS 2
200 #define C_SCOND_LO 3
201 #define C_SCOND_MI 4
202 #define C_SCOND_PL 5
203 #define C_SCOND_VS 6
204 #define C_SCOND_VC 7
205 #define C_SCOND_HI 8
206 #define C_SCOND_LS 9
207 #define C_SCOND_GE 10
208 #define C_SCOND_LT 11
209 #define C_SCOND_GT 12
210 #define C_SCOND_LE 13
211 #define C_SCOND_NONE 14
212 #define C_SCOND_NV 15
213
214 /* D_SHIFT type */
215 #define SHIFT_LL 0<<5
216 #define SHIFT_LR 1<<5
217 #define SHIFT_AR 2<<5
218 #define SHIFT_RR 3<<5
219
220 /* type/name */
221 #define D_GOK 0
222 #define D_NONE 1
223
224 /* type */
225 #define D_BRANCH (D_NONE+1)
226 #define D_OREG (D_NONE+2)
227 #define D_CONST (D_NONE+7)
228 #define D_FCONST (D_NONE+8)
229 #define D_SCONST (D_NONE+9)
230 #define D_PSR (D_NONE+10)
231 #define D_REG (D_NONE+12)
232 #define D_FREG (D_NONE+13)
233 #define D_FILE (D_NONE+16)
234 #define D_OCONST (D_NONE+17)
235 #define D_FILE1 (D_NONE+18)
236
237 #define D_SHIFT (D_NONE+19)
238 #define D_FPCR (D_NONE+20)
239 #define D_REGREG (D_NONE+21)
240 #define D_ADDR (D_NONE+22)
241
242 #define D_SBIG (D_NONE+23)
243 #define D_CONST2 (D_NONE+24)
244
245 /* name */
246 #define D_EXTERN (D_NONE+3)
247 #define D_STATIC (D_NONE+4)
248 #define D_AUTO (D_NONE+5)
249 #define D_PARAM (D_NONE+6)
250
251 /* internal only */
252 #define D_SIZE (D_NONE+40)
253 #define D_PCREL (D_NONE+41)
254
255 /*
256 * this is the ranlib header
257 */
258 #define SYMDEF "__.SYMDEF"
259
260 /*
261 * this is the simulated IEEE floating point
262 */
263 typedef struct ieee Ieee;
264 struct ieee
265 {
266 int32 l; /* contains ls-man 0xffffffff */
267 int32 h; /* contains sign 0x80000000
268 exp 0x7ff00000
269 ms-man 0x000fffff */
270 };