xref: /netbsd/sys/arch/m68k/include/cpuframe.h (revision 6550d01e)
1 /*	$NetBSD: cpuframe.h,v 1.4 2005/12/11 12:17:53 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 1982, 1990, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * the Systems Programming Group of the University of Utah Computer
9  * Science Department.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  * from: Utah $Hdr: frame.h 1.8 92/12/20$
36  *
37  *	@(#)frame.h	8.1 (Berkeley) 6/10/93
38  */
39 /*
40  * Copyright (c) 1988 University of Utah.
41  *
42  * This code is derived from software contributed to Berkeley by
43  * the Systems Programming Group of the University of Utah Computer
44  * Science Department.
45  *
46  * Redistribution and use in source and binary forms, with or without
47  * modification, are permitted provided that the following conditions
48  * are met:
49  * 1. Redistributions of source code must retain the above copyright
50  *    notice, this list of conditions and the following disclaimer.
51  * 2. Redistributions in binary form must reproduce the above copyright
52  *    notice, this list of conditions and the following disclaimer in the
53  *    documentation and/or other materials provided with the distribution.
54  * 3. All advertising materials mentioning features or use of this software
55  *    must display the following acknowledgement:
56  *	This product includes software developed by the University of
57  *	California, Berkeley and its contributors.
58  * 4. Neither the name of the University nor the names of its contributors
59  *    may be used to endorse or promote products derived from this software
60  *    without specific prior written permission.
61  *
62  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72  * SUCH DAMAGE.
73  *
74  * from: Utah $Hdr: frame.h 1.8 92/12/20$
75  *
76  *	@(#)frame.h	8.1 (Berkeley) 6/10/93
77  */
78 
79 #ifndef	_M68K_CPUFRAME_H_
80 #define	_M68K_CPUFRAME_H_
81 
82 struct frame {
83 	struct trapframe {
84 		int	tf_regs[16];
85 		short	tf_pad;
86 		short	tf_stackadj;
87 		u_short	tf_sr;
88 		u_int	tf_pc;
89 		u_short /* BITFIELDTYPE */ tf_format:4,
90 			/* BITFIELDTYPE */ tf_vector:12;
91 	} __attribute__((packed)) F_t;
92 	union F_u {
93 		struct fmt2 {
94 			u_int	f_iaddr;
95 		} F_fmt2;
96 
97 		struct fmt3 {
98 			u_int	f_ea;
99 		} F_fmt3;
100 
101 		struct fmt4 {
102 			u_int	f_fa;
103 			u_int	f_fslw;
104 			/* for 060FP type 4 FP disabled frames: */
105 #define 		f_fea	f_fa
106 #define 		f_pcfi	f_fslw
107 		} F_fmt4;
108 
109 		struct fmt7 {
110 			u_int	f_ea;
111 			u_short	f_ssw;
112 			u_short	f_wb3s, f_wb2s, f_wb1s;
113 			u_int	f_fa;
114 			u_int	f_wb3a, f_wb3d;
115 			u_int	f_wb2a, f_wb2d;
116 			u_int	f_wb1a, f_wb1d;
117 #define				f_pd0 f_wb1d
118 			u_int	f_pd1, f_pd2, f_pd3;
119 		} F_fmt7;
120 
121 		struct fmt8 {
122 			u_short	f_ssw;
123 			u_int	f_accaddr;
124 			u_short	f_ir0;
125 			u_short	f_dob;
126 			u_short	f_ir1;
127 			u_short	f_dib;
128 			u_short	f_ir2;
129 			u_short	f_irc;
130 			u_short	f_maskpc;
131 			u_short	f_iregs[15];
132 		} __attribute__((packed)) F_fmt8;
133 
134 		struct fmt9 {
135 			u_int	f_iaddr;
136 			u_short	f_iregs[4];
137 		} F_fmt9;
138 
139 		struct fmtA {
140 			u_short	f_ir0;
141 			u_short	f_ssw;
142 			u_short	f_ipsc;
143 			u_short	f_ipsb;
144 			u_int	f_dcfa;
145 			u_short	f_ir1, f_ir2;
146 			u_int	f_dob;
147 			u_short	f_ir3, f_ir4;
148 		} F_fmtA;
149 
150 		struct fmtB {
151 			u_short	f_ir0;
152 			u_short	f_ssw;
153 			u_short	f_ipsc;
154 			u_short	f_ipsb;
155 			u_int	f_dcfa;
156 			u_short	f_ir1, f_ir2;
157 			u_int	f_dob;
158 			u_short	f_ir3, f_ir4;
159 			u_short	f_ir5, f_ir6;
160 			u_int	f_sba;
161 			u_short	f_ir7, f_ir8;
162 			u_int	f_dib;
163 			u_short	f_iregs[22];
164 		} F_fmtB;
165 	} F_u;
166 };
167 
168 #define	f_regs		F_t.tf_regs
169 #define	f_pad		F_t.tf_pad
170 #define	f_stackadj	F_t.tf_stackadj
171 #define	f_sr		F_t.tf_sr
172 #define	f_pc		F_t.tf_pc
173 #define	f_format	F_t.tf_format
174 #define	f_vector	F_t.tf_vector
175 #define	f_fmt2		F_u.F_fmt2
176 #define	f_fmt3		F_u.F_fmt3
177 #define	f_fmt4		F_u.F_fmt4
178 #define	f_fmt7		F_u.F_fmt7
179 #define	f_fmt8		F_u.F_fmt8
180 #define	f_fmt9		F_u.F_fmt9
181 #define	f_fmtA		F_u.F_fmtA
182 #define	f_fmtB		F_u.F_fmtB
183 
184 struct switchframe {
185 	u_int	sf_pc;
186 };
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 
229 /*
230  * This is incompatible with the earlier one; expecially, an earlier frame
231  * must not be FRESTOREd on a 060 or vv, because a frame error exception is
232  * not guaranteed.
233  */
234 
235 
236 struct fpframe060 {
237 	u_short	fpf6_excp_exp;
238 	u_char	fpf6_frmfmt;
239 
240 	u_char	fpf6_v;
241 
242 	u_long	fpf6_upper, fpf6_lower;
243 };
244 
245 #endif	/* _M68K_CPUFRAME_H_ */
246