frame.h revision 1.10 1 /* $NetBSD: frame.h,v 1.10 1995/05/12 12:45:24 mycroft Exp $ */
2
3 /*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1982, 1990, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. All advertising materials mentioning features or use of this software
21 * must display the following acknowledgement:
22 * This product includes software developed by the University of
23 * California, Berkeley and its contributors.
24 * 4. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * from: Utah $Hdr: frame.h 1.8 92/12/20$
41 *
42 * @(#)frame.h 8.1 (Berkeley) 6/10/93
43 */
44
45 struct frame {
46 struct trapframe {
47 int tf_regs[16];
48 short tf_pad;
49 short tf_stackadj;
50 u_short tf_sr;
51 u_int tf_pc;
52 u_short tf_format:4,
53 tf_vector:12;
54 } F_t;
55 union F_u {
56 struct fmt2 {
57 u_int f_iaddr;
58 } F_fmt2;
59
60 struct fmt3 {
61 u_int f_ea;
62 } F_fmt3;
63
64 struct fmt7 {
65 u_int f_ea;
66 u_short f_ssw;
67 u_short f_wb3s, f_wb2s, f_wb1s;
68 u_int f_fa;
69 u_int f_wb3a, f_wb3d;
70 u_int f_wb2a, f_wb2d;
71 u_int f_wb1a, f_wb1d;
72 #define f_pd0 f_wb1d
73 u_int f_pd1, f_pd2, f_pd3;
74 } F_fmt7;
75
76 struct fmt9 {
77 u_int f_iaddr;
78 u_short f_iregs[4];
79 } F_fmt9;
80
81 struct fmtA {
82 u_short f_ir0;
83 u_short f_ssw;
84 u_short f_ipsc;
85 u_short f_ipsb;
86 u_int f_dcfa;
87 u_short f_ir1, f_ir2;
88 u_int f_dob;
89 u_short f_ir3, f_ir4;
90 } F_fmtA;
91
92 struct fmtB {
93 u_short f_ir0;
94 u_short f_ssw;
95 u_short f_ipsc;
96 u_short f_ipsb;
97 u_int f_dcfa;
98 u_short f_ir1, f_ir2;
99 u_int f_dob;
100 u_short f_ir3, f_ir4;
101 u_short f_ir5, f_ir6;
102 u_int f_sba;
103 u_short f_ir7, f_ir8;
104 u_int f_dib;
105 u_short f_iregs[22];
106 } F_fmtB;
107 } F_u;
108 };
109
110 #define f_regs F_t.tf_regs
111 #define f_pad F_t.tf_pad
112 #define f_stackadj F_t.tf_stackadj
113 #define f_sr F_t.tf_sr
114 #define f_pc F_t.tf_pc
115 #define f_format F_t.tf_format
116 #define f_vector F_t.tf_vector
117 #define f_fmt2 F_u.F_fmt2
118 #define f_fmt3 F_u.F_fmt3
119 #define f_fmt7 F_u.F_fmt7
120 #define f_fmt9 F_u.F_fmt9
121 #define f_fmtA F_u.F_fmtA
122 #define f_fmtB F_u.F_fmtB
123
124 struct switchframe {
125 u_int sf_pc;
126 };
127
128 /* common frame size */
129 #define CFSIZE (sizeof(struct frame) - sizeof(union F_u))
130 #define NFMTSIZE 8
131
132 #define FMT0 0x0
133 #define FMT1 0x1
134 #define FMT2 0x2
135 #define FMT3 0x3
136 #define FMT7 0x7
137 #define FMT9 0x9
138 #define FMTA 0xA
139 #define FMTB 0xB
140
141 /* frame specific info sizes */
142 #define FMT0SIZE 0
143 #define FMT1SIZE 0
144 #define FMT2SIZE sizeof(struct fmt2)
145 #define FMT3SIZE sizeof(struct fmt3)
146 #define FMT7SIZE sizeof(struct fmt7)
147 #define FMT9SIZE sizeof(struct fmt9)
148 #define FMTASIZE sizeof(struct fmtA)
149 #define FMTBSIZE sizeof(struct fmtB)
150
151 #define V_BUSERR 0x008
152 #define V_ADDRERR 0x00C
153 #define V_TRAP1 0x084
154
155 /* 68020/68030 SSW bits */
156 #define SSW_RC 0x2000
157 #define SSW_RB 0x1000
158 #define SSW_DF 0x0100
159 #define SSW_RM 0x0080
160 #define SSW_RW 0x0040
161 #define SSW_FCMASK 0x0007
162
163 /* 68040 SSW bits */
164 #define SSW4_CP 0x8000
165 #define SSW4_CU 0x4000
166 #define SSW4_CT 0x2000
167 #define SSW4_CM 0x1000
168 #define SSW4_MA 0x0800
169 #define SSW4_ATC 0x0400
170 #define SSW4_LK 0x0200
171 #define SSW4_RW 0x0100
172 #define SSW4_WBSV 0x0080 /* really in WB status, not SSW */
173 #define SSW4_SZMASK 0x0060
174 #define SSW4_SZLW 0x0000
175 #define SSW4_SZB 0x0020
176 #define SSW4_SZW 0x0040
177 #define SSW4_SZLN 0x0060
178 #define SSW4_TTMASK 0x0018
179 #define SSW4_TTNOR 0x0000
180 #define SSW4_TTM16 0x0008
181 #define SSW4_TMMASK 0x0007
182 #define SSW4_TMDCP 0x0000
183 #define SSW4_TMUD 0x0001
184 #define SSW4_TMUC 0x0002
185 #define SSW4_TMKD 0x0005
186 #define SSW4_TMKC 0x0006
187
188 struct fpframe {
189 union FPF_u1 {
190 u_int FPF_null;
191 struct {
192 u_char FPF_version;
193 u_char FPF_fsize;
194 u_short FPF_res1;
195 } FPF_nonnull;
196 } FPF_u1;
197 union FPF_u2 {
198 struct fpidle {
199 u_short fpf_ccr;
200 u_short fpf_res2;
201 u_int fpf_iregs1[8];
202 u_int fpf_xops[3];
203 u_int fpf_opreg;
204 u_int fpf_biu;
205 } FPF_idle;
206
207 struct fpbusy {
208 u_int fpf_iregs[53];
209 } FPF_busy;
210
211 struct fpunimp {
212 u_int fpf_state[10];
213 } FPF_unimp;
214 } FPF_u2;
215 u_int fpf_regs[8*3];
216 u_int fpf_fpcr;
217 u_int fpf_fpsr;
218 u_int fpf_fpiar;
219 };
220
221 #define fpf_null FPF_u1.FPF_null
222 #define fpf_version FPF_u1.FPF_nonnull.FPF_version
223 #define fpf_fsize FPF_u1.FPF_nonnull.FPF_fsize
224 #define fpf_res1 FPF_u1.FPF_nonnull.FPF_res1
225 #define fpf_idle FPF_u2.FPF_idle
226 #define fpf_busy FPF_u2.FPF_busy
227 #define fpf_unimp FPF_u2.FPF_unimp
228