Home | History | Annotate | Line # | Download | only in include
frame.h revision 1.11
      1 /*	$NetBSD: frame.h,v 1.11 1996/03/12 22:21:51 is 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 fmt4 {
     65 			u_int	f_fa;
     66 			u_int	f_fslw;
     67 			/* for 060FP type 4 FP disabled frames: */
     68 #define 		f_fea	f_fa
     69 #define 		f_pcfi	f_fslw
     70 		} F_fmt4;
     71 
     72 		struct fmt7 {
     73 			u_int	f_ea;
     74 			u_short	f_ssw;
     75 			u_short	f_wb3s, f_wb2s, f_wb1s;
     76 			u_int	f_fa;
     77 			u_int	f_wb3a, f_wb3d;
     78 			u_int	f_wb2a, f_wb2d;
     79 			u_int	f_wb1a, f_wb1d;
     80 #define				f_pd0 f_wb1d
     81 			u_int	f_pd1, f_pd2, f_pd3;
     82 		} F_fmt7;
     83 
     84 		struct fmt9 {
     85 			u_int	f_iaddr;
     86 			u_short	f_iregs[4];
     87 		} F_fmt9;
     88 
     89 		struct fmtA {
     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 		} F_fmtA;
     99 
    100 		struct fmtB {
    101 			u_short	f_ir0;
    102 			u_short	f_ssw;
    103 			u_short	f_ipsc;
    104 			u_short	f_ipsb;
    105 			u_int	f_dcfa;
    106 			u_short	f_ir1, f_ir2;
    107 			u_int	f_dob;
    108 			u_short	f_ir3, f_ir4;
    109 			u_short	f_ir5, f_ir6;
    110 			u_int	f_sba;
    111 			u_short	f_ir7, f_ir8;
    112 			u_int	f_dib;
    113 			u_short	f_iregs[22];
    114 		} F_fmtB;
    115 	} F_u;
    116 };
    117 
    118 #define	f_regs		F_t.tf_regs
    119 #define	f_pad		F_t.tf_pad
    120 #define	f_stackadj	F_t.tf_stackadj
    121 #define	f_sr		F_t.tf_sr
    122 #define	f_pc		F_t.tf_pc
    123 #define	f_format	F_t.tf_format
    124 #define	f_vector	F_t.tf_vector
    125 #define	f_fmt2		F_u.F_fmt2
    126 #define	f_fmt3		F_u.F_fmt3
    127 #define	f_fmt4		F_u.F_fmt4
    128 #define	f_fmt7		F_u.F_fmt7
    129 #define	f_fmt9		F_u.F_fmt9
    130 #define	f_fmtA		F_u.F_fmtA
    131 #define	f_fmtB		F_u.F_fmtB
    132 
    133 struct switchframe {
    134 	u_int	sf_pc;
    135 };
    136 
    137 /* common frame size */
    138 #define	CFSIZE		(sizeof(struct frame) - sizeof(union F_u))
    139 #define	NFMTSIZE	9
    140 
    141 #define	FMT0		0x0
    142 #define	FMT1		0x1
    143 #define	FMT2		0x2
    144 #define	FMT3		0x3
    145 #define	FMT4		0x4
    146 #define	FMT7		0x7
    147 #define	FMT9		0x9
    148 #define	FMTA		0xA
    149 #define	FMTB		0xB
    150 
    151 /* frame specific info sizes */
    152 #define	FMT0SIZE	0
    153 #define	FMT1SIZE	0
    154 #define	FMT2SIZE	sizeof(struct fmt2)
    155 #define	FMT3SIZE	sizeof(struct fmt3)
    156 #define	FMT4SIZE	sizeof(struct fmt4)
    157 #define	FMT7SIZE	sizeof(struct fmt7)
    158 #define	FMT9SIZE	sizeof(struct fmt9)
    159 #define	FMTASIZE	sizeof(struct fmtA)
    160 #define	FMTBSIZE	sizeof(struct fmtB)
    161 
    162 #define	V_BUSERR	0x008
    163 #define	V_ADDRERR	0x00C
    164 #define	V_TRAP1		0x084
    165 
    166 /* 68020/68030 SSW bits */
    167 #define	SSW_RC		0x2000
    168 #define	SSW_RB		0x1000
    169 #define	SSW_DF		0x0100
    170 #define	SSW_RM		0x0080
    171 #define	SSW_RW		0x0040
    172 #define	SSW_FCMASK	0x0007
    173 
    174 /* 68040 SSW bits */
    175 #define	SSW4_CP		0x8000
    176 #define	SSW4_CU		0x4000
    177 #define	SSW4_CT		0x2000
    178 #define	SSW4_CM		0x1000
    179 #define	SSW4_MA		0x0800
    180 #define	SSW4_ATC	0x0400
    181 #define	SSW4_LK		0x0200
    182 #define	SSW4_RW		0x0100
    183 #define SSW4_WBSV	0x0080	/* really in WB status, not SSW */
    184 #define	SSW4_SZMASK	0x0060
    185 #define	SSW4_SZLW	0x0000
    186 #define	SSW4_SZB	0x0020
    187 #define	SSW4_SZW	0x0040
    188 #define	SSW4_SZLN	0x0060
    189 #define	SSW4_TTMASK	0x0018
    190 #define	SSW4_TTNOR	0x0000
    191 #define	SSW4_TTM16	0x0008
    192 #define	SSW4_TMMASK	0x0007
    193 #define	SSW4_TMDCP	0x0000
    194 #define	SSW4_TMUD	0x0001
    195 #define	SSW4_TMUC	0x0002
    196 #define	SSW4_TMKD	0x0005
    197 #define	SSW4_TMKC	0x0006
    198 
    199 /* 060 Fault Status Long Word (FPSP) */
    200 
    201 #define FSLW_MA		0x08000000
    202 #define FSLW_LK		0x02000000
    203 #define FSLW_RW		0x01800000
    204 #define FSLW_SIZE	0x00600000
    205 
    206 /*
    207  * We better define the FSLW_SIZE values here, as the table given in the
    208  * MC68060UM/AD rev. 0/1 p. 8-23 is wrong, and was corrected in the errata
    209  * document.
    210  */
    211 #define FSLW_SIZE_LONG	0x00000000
    212 #define FSLW_SIZE_BYTE	0x00200000
    213 #define FSLW_SIZE_WORD	0x00400000
    214 #define FSLW_SIZE_MV16	0x00600000
    215 
    216 #define FLSW_TT		0x00180000
    217 #define FSLW_TM		0x00070000
    218 
    219 #define FSLW_IO		0x00008000
    220 #define FSLW_PBE	0x00004000
    221 #define FSLW_SBE	0x00002000
    222 #define FSLW_PTA	0x00001000
    223 #define FSLW_PTB 	0x00000800
    224 #define FSLW_IL 	0x00000400
    225 #define FSLW_PF 	0x00000200
    226 #define FSLW_SP 	0x00000100
    227 #define FSLW_WP 	0x00000080
    228 #define FSLW_TWE 	0x00000040
    229 #define FSLW_RE 	0x00000020
    230 #define FSLW_WE 	0x00000010
    231 #define FSLW_TTR 	0x00000008
    232 #define FSLW_BPE 	0x00000004
    233 #define FSLW_SEE 	0x00000001
    234 
    235 struct fpframe {
    236 	union FPF_u1 {
    237 		u_int	FPF_null;
    238 		struct {
    239 			u_char	FPF_version;
    240 			u_char	FPF_fsize;
    241 			u_short	FPF_res1;
    242 		} FPF_nonnull;
    243 	} FPF_u1;
    244 	union FPF_u2 {
    245 		struct fpidle {
    246 			u_short	fpf_ccr;
    247 			u_short	fpf_res2;
    248 			u_int	fpf_iregs1[8];
    249 			u_int	fpf_xops[3];
    250 			u_int	fpf_opreg;
    251 			u_int	fpf_biu;
    252 		} FPF_idle;
    253 
    254 		struct fpbusy {
    255 			u_int	fpf_iregs[53];
    256 		} FPF_busy;
    257 
    258 		struct fpunimp {
    259 			u_int	fpf_state[10];
    260 		} FPF_unimp;
    261 	} FPF_u2;
    262 	u_int	fpf_regs[8*3];
    263 	u_int	fpf_fpcr;
    264 	u_int	fpf_fpsr;
    265 	u_int	fpf_fpiar;
    266 };
    267 
    268 #define fpf_null	FPF_u1.FPF_null
    269 #define fpf_version	FPF_u1.FPF_nonnull.FPF_version
    270 #define fpf_fsize	FPF_u1.FPF_nonnull.FPF_fsize
    271 #define fpf_res1	FPF_u1.FPF_nonnull.FPF_res1
    272 #define fpf_idle	FPF_u2.FPF_idle
    273 #define fpf_busy	FPF_u2.FPF_busy
    274 #define fpf_unimp	FPF_u2.FPF_unimp
    275 
    276 /*
    277  * This is incompatible with the earlier one; expecially, an earlier frame
    278  * must not be FRESTOREd on a 060 or vv, because a frame error exception is
    279  * not guaranteed.
    280  */
    281 
    282 
    283 struct fpframe060 {
    284 	u_short	fpf6_excp_exp;
    285 	u_char	fpf6_frmfmt;
    286 #define FPF6_FMT_NULL	0x00
    287 #define FPF6_FMT_IDLE	0x60
    288 #define FPF6_FMT_EXCP	0xe0
    289 
    290 	u_char	fpf6_v;
    291 #define	FPF6_V_BSUN	0
    292 #define	FPF6_V_INEX12	1
    293 #define	FPF6_V_DZ	2
    294 #define	FPF6_V_UNFL	3
    295 #define	FPF6_V_OPERR	4
    296 #define	FPF6_V_OVFL	5
    297 #define	FPF6_V_SNAN	6
    298 #define	FPF6_V_UNSUP	7
    299 
    300 	u_long	fpf6_upper, fpf6_lower;
    301 };
    302