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