xref: /netbsd-src/sys/arch/m68k/include/frame.h (revision ce0bb6e8d2e560ecacbe865a848624f94498063b)
1 /*	$NetBSD: frame.h,v 1.8 1994/10/26 07:50:47 cgd 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 	int	f_regs[16];
47 	short	f_pad;
48 	short	f_stackadj;
49 	u_short	f_sr;
50 	u_int	f_pc;
51 	u_short	f_format:4,
52 		f_vector:12;
53 	union F_u {
54 		struct fmt2 {
55 			u_int	f_iaddr;
56 		} F_fmt2;
57 
58 		struct fmt3 {
59 			u_int	f_ea;
60 		} F_fmt3;
61 
62 		struct fmt7 {
63 			u_int	f_ea;
64 			u_short	f_ssw;
65 			u_short	f_wb3s, f_wb2s, f_wb1s;
66 			u_int	f_fa;
67 			u_int	f_wb3a, f_wb3d;
68 			u_int	f_wb2a, f_wb2d;
69 			u_int	f_wb1a, f_wb1d;
70 #define				f_pd0 f_wb1d
71 			u_int	f_pd1, f_pd2, f_pd3;
72 		} F_fmt7;
73 
74 		struct fmt9 {
75 			u_int	f_iaddr;
76 			u_short	f_iregs[4];
77 		} F_fmt9;
78 
79 		struct fmtA {
80 			u_short	f_ir0;
81 			u_short	f_ssw;
82 			u_short	f_ipsc;
83 			u_short	f_ipsb;
84 			u_int	f_dcfa;
85 			u_short	f_ir1, f_ir2;
86 			u_int	f_dob;
87 			u_short	f_ir3, f_ir4;
88 		} F_fmtA;
89 
90 		struct fmtB {
91 			u_short	f_ir0;
92 			u_short	f_ssw;
93 			u_short	f_ipsc;
94 			u_short	f_ipsb;
95 			u_int	f_dcfa;
96 			u_short	f_ir1, f_ir2;
97 			u_int	f_dob;
98 			u_short	f_ir3, f_ir4;
99 			u_short	f_ir5, f_ir6;
100 			u_int	f_sba;
101 			u_short	f_ir7, f_ir8;
102 			u_int	f_dib;
103 			u_short	f_iregs[22];
104 		} F_fmtB;
105 	} F_u;
106 };
107 
108 #define	f_fmt2		F_u.F_fmt2
109 #define	f_fmt3		F_u.F_fmt3
110 #define	f_fmt7		F_u.F_fmt7
111 #define	f_fmt9		F_u.F_fmt9
112 #define	f_fmtA		F_u.F_fmtA
113 #define	f_fmtB		F_u.F_fmtB
114 
115 /* common frame size */
116 #define	CFSIZE		(sizeof(struct frame) - sizeof(union F_u))
117 #define	NFMTSIZE	8
118 
119 #define	FMT0		0x0
120 #define	FMT1		0x1
121 #define	FMT2		0x2
122 #define	FMT3		0x3
123 #define	FMT7		0x7
124 #define	FMT9		0x9
125 #define	FMTA		0xA
126 #define	FMTB		0xB
127 
128 /* frame specific info sizes */
129 #define	FMT0SIZE	0
130 #define	FMT1SIZE	0
131 #define	FMT2SIZE	sizeof(struct fmt2)
132 #define	FMT3SIZE	sizeof(struct fmt3)
133 #define	FMT7SIZE	sizeof(struct fmt7)
134 #define	FMT9SIZE	sizeof(struct fmt9)
135 #define	FMTASIZE	sizeof(struct fmtA)
136 #define	FMTBSIZE	sizeof(struct fmtB)
137 
138 #define	V_BUSERR	0x008
139 #define	V_ADDRERR	0x00C
140 #define	V_TRAP1		0x084
141 
142 /* 68020/68030 SSW bits */
143 #define	SSW_RC		0x2000
144 #define	SSW_RB		0x1000
145 #define	SSW_DF		0x0100
146 #define	SSW_RM		0x0080
147 #define	SSW_RW		0x0040
148 #define	SSW_FCMASK	0x0007
149 
150 /* 68040 SSW bits */
151 #define	SSW4_CP		0x8000
152 #define	SSW4_CU		0x4000
153 #define	SSW4_CT		0x2000
154 #define	SSW4_CM		0x1000
155 #define	SSW4_MA		0x0800
156 #define	SSW4_ATC	0x0400
157 #define	SSW4_LK		0x0200
158 #define	SSW4_RW		0x0100
159 #define SSW4_WBSV	0x0080	/* really in WB status, not SSW */
160 #define	SSW4_SZMASK	0x0060
161 #define	SSW4_SZLW	0x0000
162 #define	SSW4_SZB	0x0020
163 #define	SSW4_SZW	0x0040
164 #define	SSW4_SZLN	0x0060
165 #define	SSW4_TTMASK	0x0018
166 #define	SSW4_TTNOR	0x0000
167 #define	SSW4_TTM16	0x0008
168 #define	SSW4_TMMASK	0x0007
169 #define	SSW4_TMDCP	0x0000
170 #define	SSW4_TMUD	0x0001
171 #define	SSW4_TMUC	0x0002
172 #define	SSW4_TMKD	0x0005
173 #define	SSW4_TMKC	0x0006
174 
175 struct fpframe {
176 	union FPF_u1 {
177 		u_int	FPF_null;
178 		struct {
179 			u_char	FPF_version;
180 			u_char	FPF_fsize;
181 			u_short	FPF_res1;
182 		} FPF_nonnull;
183 	} FPF_u1;
184 	union FPF_u2 {
185 		struct fpidle {
186 			u_short	fpf_ccr;
187 			u_short	fpf_res2;
188 			u_int	fpf_iregs1[8];
189 			u_int	fpf_xops[3];
190 			u_int	fpf_opreg;
191 			u_int	fpf_biu;
192 		} FPF_idle;
193 
194 		struct fpbusy {
195 			u_int	fpf_iregs[53];
196 		} FPF_busy;
197 
198 		struct fpunimp {
199 			u_int	fpf_state[10];
200 		} FPF_unimp;
201 	} FPF_u2;
202 	u_int	fpf_regs[8*3];
203 	u_int	fpf_fpcr;
204 	u_int	fpf_fpsr;
205 	u_int	fpf_fpiar;
206 };
207 
208 #define fpf_null	FPF_u1.FPF_null
209 #define fpf_version	FPF_u1.FPF_nonnull.FPF_version
210 #define fpf_fsize	FPF_u1.FPF_nonnull.FPF_fsize
211 #define fpf_res1	FPF_u1.FPF_nonnull.FPF_res1
212 #define fpf_idle	FPF_u2.FPF_idle
213 #define fpf_busy	FPF_u2.FPF_busy
214 #define fpf_unimp	FPF_u2.FPF_unimp
215