frame.h revision 1.11 1 1.11 is /* $NetBSD: frame.h,v 1.11 1996/03/12 22:21:51 is Exp $ */
2 1.8 cgd
3 1.1 cgd /*
4 1.1 cgd * Copyright (c) 1988 University of Utah.
5 1.6 mycroft * Copyright (c) 1982, 1990, 1993
6 1.6 mycroft * The Regents of the University of California. All rights reserved.
7 1.1 cgd *
8 1.1 cgd * This code is derived from software contributed to Berkeley by
9 1.1 cgd * the Systems Programming Group of the University of Utah Computer
10 1.1 cgd * Science Department.
11 1.1 cgd *
12 1.1 cgd * Redistribution and use in source and binary forms, with or without
13 1.1 cgd * modification, are permitted provided that the following conditions
14 1.1 cgd * are met:
15 1.1 cgd * 1. Redistributions of source code must retain the above copyright
16 1.1 cgd * notice, this list of conditions and the following disclaimer.
17 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
18 1.1 cgd * notice, this list of conditions and the following disclaimer in the
19 1.1 cgd * documentation and/or other materials provided with the distribution.
20 1.1 cgd * 3. All advertising materials mentioning features or use of this software
21 1.1 cgd * must display the following acknowledgement:
22 1.1 cgd * This product includes software developed by the University of
23 1.1 cgd * California, Berkeley and its contributors.
24 1.1 cgd * 4. Neither the name of the University nor the names of its contributors
25 1.1 cgd * may be used to endorse or promote products derived from this software
26 1.1 cgd * without specific prior written permission.
27 1.1 cgd *
28 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 1.1 cgd * SUCH DAMAGE.
39 1.1 cgd *
40 1.6 mycroft * from: Utah $Hdr: frame.h 1.8 92/12/20$
41 1.6 mycroft *
42 1.8 cgd * @(#)frame.h 8.1 (Berkeley) 6/10/93
43 1.1 cgd */
44 1.9 chopps
45 1.1 cgd struct frame {
46 1.10 mycroft struct trapframe {
47 1.10 mycroft int tf_regs[16];
48 1.10 mycroft short tf_pad;
49 1.10 mycroft short tf_stackadj;
50 1.10 mycroft u_short tf_sr;
51 1.10 mycroft u_int tf_pc;
52 1.10 mycroft u_short tf_format:4,
53 1.10 mycroft tf_vector:12;
54 1.10 mycroft } F_t;
55 1.1 cgd union F_u {
56 1.1 cgd struct fmt2 {
57 1.1 cgd u_int f_iaddr;
58 1.1 cgd } F_fmt2;
59 1.1 cgd
60 1.4 mw struct fmt3 {
61 1.6 mycroft u_int f_ea;
62 1.4 mw } F_fmt3;
63 1.4 mw
64 1.11 is struct fmt4 {
65 1.11 is u_int f_fa;
66 1.11 is u_int f_fslw;
67 1.11 is /* for 060FP type 4 FP disabled frames: */
68 1.11 is #define f_fea f_fa
69 1.11 is #define f_pcfi f_fslw
70 1.11 is } F_fmt4;
71 1.11 is
72 1.4 mw struct fmt7 {
73 1.4 mw u_int f_ea;
74 1.4 mw u_short f_ssw;
75 1.6 mycroft u_short f_wb3s, f_wb2s, f_wb1s;
76 1.4 mw u_int f_fa;
77 1.6 mycroft u_int f_wb3a, f_wb3d;
78 1.6 mycroft u_int f_wb2a, f_wb2d;
79 1.6 mycroft u_int f_wb1a, f_wb1d;
80 1.6 mycroft #define f_pd0 f_wb1d
81 1.6 mycroft u_int f_pd1, f_pd2, f_pd3;
82 1.4 mw } F_fmt7;
83 1.4 mw
84 1.1 cgd struct fmt9 {
85 1.1 cgd u_int f_iaddr;
86 1.1 cgd u_short f_iregs[4];
87 1.1 cgd } F_fmt9;
88 1.1 cgd
89 1.1 cgd struct fmtA {
90 1.1 cgd u_short f_ir0;
91 1.1 cgd u_short f_ssw;
92 1.1 cgd u_short f_ipsc;
93 1.1 cgd u_short f_ipsb;
94 1.1 cgd u_int f_dcfa;
95 1.1 cgd u_short f_ir1, f_ir2;
96 1.1 cgd u_int f_dob;
97 1.1 cgd u_short f_ir3, f_ir4;
98 1.1 cgd } F_fmtA;
99 1.1 cgd
100 1.1 cgd struct fmtB {
101 1.1 cgd u_short f_ir0;
102 1.1 cgd u_short f_ssw;
103 1.1 cgd u_short f_ipsc;
104 1.1 cgd u_short f_ipsb;
105 1.1 cgd u_int f_dcfa;
106 1.1 cgd u_short f_ir1, f_ir2;
107 1.1 cgd u_int f_dob;
108 1.1 cgd u_short f_ir3, f_ir4;
109 1.1 cgd u_short f_ir5, f_ir6;
110 1.1 cgd u_int f_sba;
111 1.1 cgd u_short f_ir7, f_ir8;
112 1.1 cgd u_int f_dib;
113 1.1 cgd u_short f_iregs[22];
114 1.1 cgd } F_fmtB;
115 1.1 cgd } F_u;
116 1.1 cgd };
117 1.1 cgd
118 1.10 mycroft #define f_regs F_t.tf_regs
119 1.10 mycroft #define f_pad F_t.tf_pad
120 1.10 mycroft #define f_stackadj F_t.tf_stackadj
121 1.10 mycroft #define f_sr F_t.tf_sr
122 1.10 mycroft #define f_pc F_t.tf_pc
123 1.10 mycroft #define f_format F_t.tf_format
124 1.10 mycroft #define f_vector F_t.tf_vector
125 1.1 cgd #define f_fmt2 F_u.F_fmt2
126 1.6 mycroft #define f_fmt3 F_u.F_fmt3
127 1.11 is #define f_fmt4 F_u.F_fmt4
128 1.4 mw #define f_fmt7 F_u.F_fmt7
129 1.6 mycroft #define f_fmt9 F_u.F_fmt9
130 1.1 cgd #define f_fmtA F_u.F_fmtA
131 1.1 cgd #define f_fmtB F_u.F_fmtB
132 1.10 mycroft
133 1.10 mycroft struct switchframe {
134 1.10 mycroft u_int sf_pc;
135 1.10 mycroft };
136 1.1 cgd
137 1.1 cgd /* common frame size */
138 1.1 cgd #define CFSIZE (sizeof(struct frame) - sizeof(union F_u))
139 1.11 is #define NFMTSIZE 9
140 1.1 cgd
141 1.1 cgd #define FMT0 0x0
142 1.1 cgd #define FMT1 0x1
143 1.1 cgd #define FMT2 0x2
144 1.4 mw #define FMT3 0x3
145 1.11 is #define FMT4 0x4
146 1.4 mw #define FMT7 0x7
147 1.1 cgd #define FMT9 0x9
148 1.1 cgd #define FMTA 0xA
149 1.1 cgd #define FMTB 0xB
150 1.1 cgd
151 1.1 cgd /* frame specific info sizes */
152 1.1 cgd #define FMT0SIZE 0
153 1.1 cgd #define FMT1SIZE 0
154 1.1 cgd #define FMT2SIZE sizeof(struct fmt2)
155 1.4 mw #define FMT3SIZE sizeof(struct fmt3)
156 1.11 is #define FMT4SIZE sizeof(struct fmt4)
157 1.4 mw #define FMT7SIZE sizeof(struct fmt7)
158 1.1 cgd #define FMT9SIZE sizeof(struct fmt9)
159 1.1 cgd #define FMTASIZE sizeof(struct fmtA)
160 1.1 cgd #define FMTBSIZE sizeof(struct fmtB)
161 1.1 cgd
162 1.1 cgd #define V_BUSERR 0x008
163 1.1 cgd #define V_ADDRERR 0x00C
164 1.1 cgd #define V_TRAP1 0x084
165 1.1 cgd
166 1.6 mycroft /* 68020/68030 SSW bits */
167 1.1 cgd #define SSW_RC 0x2000
168 1.1 cgd #define SSW_RB 0x1000
169 1.1 cgd #define SSW_DF 0x0100
170 1.1 cgd #define SSW_RM 0x0080
171 1.1 cgd #define SSW_RW 0x0040
172 1.1 cgd #define SSW_FCMASK 0x0007
173 1.1 cgd
174 1.6 mycroft /* 68040 SSW bits */
175 1.6 mycroft #define SSW4_CP 0x8000
176 1.6 mycroft #define SSW4_CU 0x4000
177 1.6 mycroft #define SSW4_CT 0x2000
178 1.6 mycroft #define SSW4_CM 0x1000
179 1.6 mycroft #define SSW4_MA 0x0800
180 1.6 mycroft #define SSW4_ATC 0x0400
181 1.6 mycroft #define SSW4_LK 0x0200
182 1.6 mycroft #define SSW4_RW 0x0100
183 1.6 mycroft #define SSW4_WBSV 0x0080 /* really in WB status, not SSW */
184 1.6 mycroft #define SSW4_SZMASK 0x0060
185 1.6 mycroft #define SSW4_SZLW 0x0000
186 1.6 mycroft #define SSW4_SZB 0x0020
187 1.6 mycroft #define SSW4_SZW 0x0040
188 1.6 mycroft #define SSW4_SZLN 0x0060
189 1.6 mycroft #define SSW4_TTMASK 0x0018
190 1.6 mycroft #define SSW4_TTNOR 0x0000
191 1.6 mycroft #define SSW4_TTM16 0x0008
192 1.6 mycroft #define SSW4_TMMASK 0x0007
193 1.6 mycroft #define SSW4_TMDCP 0x0000
194 1.6 mycroft #define SSW4_TMUD 0x0001
195 1.6 mycroft #define SSW4_TMUC 0x0002
196 1.6 mycroft #define SSW4_TMKD 0x0005
197 1.6 mycroft #define SSW4_TMKC 0x0006
198 1.6 mycroft
199 1.11 is /* 060 Fault Status Long Word (FPSP) */
200 1.11 is
201 1.11 is #define FSLW_MA 0x08000000
202 1.11 is #define FSLW_LK 0x02000000
203 1.11 is #define FSLW_RW 0x01800000
204 1.11 is #define FSLW_SIZE 0x00600000
205 1.11 is
206 1.11 is /*
207 1.11 is * We better define the FSLW_SIZE values here, as the table given in the
208 1.11 is * MC68060UM/AD rev. 0/1 p. 8-23 is wrong, and was corrected in the errata
209 1.11 is * document.
210 1.11 is */
211 1.11 is #define FSLW_SIZE_LONG 0x00000000
212 1.11 is #define FSLW_SIZE_BYTE 0x00200000
213 1.11 is #define FSLW_SIZE_WORD 0x00400000
214 1.11 is #define FSLW_SIZE_MV16 0x00600000
215 1.11 is
216 1.11 is #define FLSW_TT 0x00180000
217 1.11 is #define FSLW_TM 0x00070000
218 1.11 is
219 1.11 is #define FSLW_IO 0x00008000
220 1.11 is #define FSLW_PBE 0x00004000
221 1.11 is #define FSLW_SBE 0x00002000
222 1.11 is #define FSLW_PTA 0x00001000
223 1.11 is #define FSLW_PTB 0x00000800
224 1.11 is #define FSLW_IL 0x00000400
225 1.11 is #define FSLW_PF 0x00000200
226 1.11 is #define FSLW_SP 0x00000100
227 1.11 is #define FSLW_WP 0x00000080
228 1.11 is #define FSLW_TWE 0x00000040
229 1.11 is #define FSLW_RE 0x00000020
230 1.11 is #define FSLW_WE 0x00000010
231 1.11 is #define FSLW_TTR 0x00000008
232 1.11 is #define FSLW_BPE 0x00000004
233 1.11 is #define FSLW_SEE 0x00000001
234 1.11 is
235 1.1 cgd struct fpframe {
236 1.1 cgd union FPF_u1 {
237 1.1 cgd u_int FPF_null;
238 1.1 cgd struct {
239 1.1 cgd u_char FPF_version;
240 1.1 cgd u_char FPF_fsize;
241 1.1 cgd u_short FPF_res1;
242 1.1 cgd } FPF_nonnull;
243 1.1 cgd } FPF_u1;
244 1.1 cgd union FPF_u2 {
245 1.1 cgd struct fpidle {
246 1.1 cgd u_short fpf_ccr;
247 1.1 cgd u_short fpf_res2;
248 1.1 cgd u_int fpf_iregs1[8];
249 1.1 cgd u_int fpf_xops[3];
250 1.1 cgd u_int fpf_opreg;
251 1.1 cgd u_int fpf_biu;
252 1.1 cgd } FPF_idle;
253 1.1 cgd
254 1.1 cgd struct fpbusy {
255 1.1 cgd u_int fpf_iregs[53];
256 1.1 cgd } FPF_busy;
257 1.4 mw
258 1.6 mycroft struct fpunimp {
259 1.6 mycroft u_int fpf_state[10];
260 1.6 mycroft } FPF_unimp;
261 1.1 cgd } FPF_u2;
262 1.1 cgd u_int fpf_regs[8*3];
263 1.1 cgd u_int fpf_fpcr;
264 1.1 cgd u_int fpf_fpsr;
265 1.1 cgd u_int fpf_fpiar;
266 1.1 cgd };
267 1.1 cgd
268 1.1 cgd #define fpf_null FPF_u1.FPF_null
269 1.1 cgd #define fpf_version FPF_u1.FPF_nonnull.FPF_version
270 1.1 cgd #define fpf_fsize FPF_u1.FPF_nonnull.FPF_fsize
271 1.1 cgd #define fpf_res1 FPF_u1.FPF_nonnull.FPF_res1
272 1.1 cgd #define fpf_idle FPF_u2.FPF_idle
273 1.1 cgd #define fpf_busy FPF_u2.FPF_busy
274 1.6 mycroft #define fpf_unimp FPF_u2.FPF_unimp
275 1.11 is
276 1.11 is /*
277 1.11 is * This is incompatible with the earlier one; expecially, an earlier frame
278 1.11 is * must not be FRESTOREd on a 060 or vv, because a frame error exception is
279 1.11 is * not guaranteed.
280 1.11 is */
281 1.11 is
282 1.11 is
283 1.11 is struct fpframe060 {
284 1.11 is u_short fpf6_excp_exp;
285 1.11 is u_char fpf6_frmfmt;
286 1.11 is #define FPF6_FMT_NULL 0x00
287 1.11 is #define FPF6_FMT_IDLE 0x60
288 1.11 is #define FPF6_FMT_EXCP 0xe0
289 1.11 is
290 1.11 is u_char fpf6_v;
291 1.11 is #define FPF6_V_BSUN 0
292 1.11 is #define FPF6_V_INEX12 1
293 1.11 is #define FPF6_V_DZ 2
294 1.11 is #define FPF6_V_UNFL 3
295 1.11 is #define FPF6_V_OPERR 4
296 1.11 is #define FPF6_V_OVFL 5
297 1.11 is #define FPF6_V_SNAN 6
298 1.11 is #define FPF6_V_UNSUP 7
299 1.11 is
300 1.11 is u_long fpf6_upper, fpf6_lower;
301 1.11 is };
302