1/*	$NetBSD: cpuframe.h,v 1.10 2023/09/26 14:33:55 tsutsui 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. Neither the name of the University nor the names of its contributors
21 *    may be used to endorse or promote products derived from this software
22 *    without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah $Hdr: frame.h 1.8 92/12/20$
37 *
38 *	@(#)frame.h	8.1 (Berkeley) 6/10/93
39 */
40
41#ifndef	_M68K_CPUFRAME_H_
42#define	_M68K_CPUFRAME_H_
43
44struct frame {
45	struct trapframe {
46		int	tf_regs[16];
47		short	tf_pad;
48		short	tf_stackadj;
49		u_short	tf_sr;
50		u_int	tf_pc __packed;
51		u_short /* BITFIELDTYPE */ tf_format:4,
52			/* BITFIELDTYPE */ tf_vector:12;
53	} F_t;
54	union F_u {
55		struct fmt2 {
56			u_int	f_iaddr;
57		} F_fmt2;
58
59		struct fmt3 {
60			u_int	f_ea;
61		} F_fmt3;
62
63		struct fmt4 {
64			u_int	f_fa;
65			u_int	f_fslw;
66			/* for 060FP type 4 FP disabled frames: */
67#define			f_fea	f_fa
68#define			f_pcfi	f_fslw
69		} F_fmt4;
70
71		struct fmt7 {
72			u_int	f_ea;
73			u_short	f_ssw;
74			u_short	f_wb3s, f_wb2s, f_wb1s;
75			u_int	f_fa;
76			u_int	f_wb3a, f_wb3d;
77			u_int	f_wb2a, f_wb2d;
78			u_int	f_wb1a, f_wb1d;
79#define				f_pd0 f_wb1d
80			u_int	f_pd1, f_pd2, f_pd3;
81		} F_fmt7;
82
83		struct fmt8 {
84			u_short	f_ssw;
85			u_int	f_accaddr;
86			u_short	f_ir0;
87			u_short	f_dob;
88			u_short	f_ir1;
89			u_short	f_dib;
90			u_short	f_ir2;
91			u_short	f_irc;
92			u_short	f_maskpc;
93			u_short	f_iregs[15];
94		} __attribute__((packed)) F_fmt8;
95
96		struct fmt9 {
97			u_int	f_iaddr;
98			u_short	f_iregs[4];
99		} F_fmt9;
100
101		struct fmtA {
102			u_short	f_ir0;
103			u_short	f_ssw;
104			u_short	f_ipsc;
105			u_short	f_ipsb;
106			u_int	f_dcfa;
107			u_short	f_ir1, f_ir2;
108			u_int	f_dob;
109			u_short	f_ir3, f_ir4;
110		} F_fmtA;
111
112		struct fmtB {
113			u_short	f_ir0;
114			u_short	f_ssw;
115			u_short	f_ipsc;
116			u_short	f_ipsb;
117			u_int	f_dcfa;
118			u_short	f_ir1, f_ir2;
119			u_int	f_dob;
120			u_short	f_ir3, f_ir4;
121			u_short	f_ir5, f_ir6;
122			u_int	f_sba;
123			u_short	f_ir7, f_ir8;
124			u_int	f_dib;
125			u_short	f_iregs[22];
126		} F_fmtB;
127	} F_u;
128};
129
130#define	f_regs		F_t.tf_regs
131#define	f_stackadj	F_t.tf_stackadj
132#define	f_sr		F_t.tf_sr
133#define	f_pc		F_t.tf_pc
134#define	f_format	F_t.tf_format
135#define	f_vector	F_t.tf_vector
136#define	f_fmt2		F_u.F_fmt2
137#define	f_fmt3		F_u.F_fmt3
138#define	f_fmt4		F_u.F_fmt4
139#define	f_fmt7		F_u.F_fmt7
140#define	f_fmt8		F_u.F_fmt8
141#define	f_fmt9		F_u.F_fmt9
142#define	f_fmtA		F_u.F_fmtA
143#define	f_fmtB		F_u.F_fmtB
144
145struct switchframe {
146	u_int	sf_pc;
147};
148
149struct fpframe {
150	union FPF_u1 {
151		u_int	FPF_null;
152		struct {
153			u_char	FPF_version;
154			u_char	FPF_fsize;
155			u_short	FPF_res1;
156		} FPF_nonnull;
157	} FPF_u1;
158	union FPF_u2 {
159		struct fpidle {
160			u_short	fpf_ccr;
161			u_short	fpf_res2;
162			u_int	fpf_iregs1[8];
163			u_int	fpf_xops[3];
164			u_int	fpf_opreg;
165			u_int	fpf_biu;
166		} FPF_idle;
167
168		struct fpbusy {
169			u_int	fpf_iregs[53];
170		} FPF_busy;
171
172		struct fpunimp {
173			u_int	fpf_state[10];
174		} FPF_unimp;
175	} FPF_u2;
176	u_int	fpf_regs[8*3];
177	u_int	fpf_fpcr;
178	u_int	fpf_fpsr;
179	u_int	fpf_fpiar;
180};
181
182#define fpf_null	FPF_u1.FPF_null
183#define fpf_version	FPF_u1.FPF_nonnull.FPF_version
184#define fpf_fsize	FPF_u1.FPF_nonnull.FPF_fsize
185#define fpf_res1	FPF_u1.FPF_nonnull.FPF_res1
186#define fpf_idle	FPF_u2.FPF_idle
187#define fpf_busy	FPF_u2.FPF_busy
188#define fpf_unimp	FPF_u2.FPF_unimp
189
190/*
191 * This is incompatible with the earlier one; especially, an earlier frame
192 * must not be FRESTOREd on a 060 or vv, because a frame error exception is
193 * not guaranteed.
194 */
195
196
197struct fpframe060 {
198	u_short	fpf6_excp_exp;
199	u_char	fpf6_frmfmt;
200
201	u_char	fpf6_v;
202
203	u_long	fpf6_upper, fpf6_lower;
204};
205
206#endif	/* _M68K_CPUFRAME_H_ */
207