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