1 /* $NetBSD: frame.h,v 1.18 2001/08/16 23:45:12 fredette 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 fmt8 { 88 u_short f_ssw; 89 u_int f_accaddr; 90 u_short f_ir0; 91 u_short f_dob; 92 u_short f_ir1; 93 u_short f_dib; 94 u_short f_ir2; 95 u_short f_irc; 96 u_short f_maskpc; 97 u_short f_iregs[15]; 98 } __attribute__((packed)) F_fmt8; 99 100 struct fmt9 { 101 u_int f_iaddr; 102 u_short f_iregs[4]; 103 } F_fmt9; 104 105 struct fmtA { 106 u_short f_ir0; 107 u_short f_ssw; 108 u_short f_ipsc; 109 u_short f_ipsb; 110 u_int f_dcfa; 111 u_short f_ir1, f_ir2; 112 u_int f_dob; 113 u_short f_ir3, f_ir4; 114 } F_fmtA; 115 116 struct fmtB { 117 u_short f_ir0; 118 u_short f_ssw; 119 u_short f_ipsc; 120 u_short f_ipsb; 121 u_int f_dcfa; 122 u_short f_ir1, f_ir2; 123 u_int f_dob; 124 u_short f_ir3, f_ir4; 125 u_short f_ir5, f_ir6; 126 u_int f_sba; 127 u_short f_ir7, f_ir8; 128 u_int f_dib; 129 u_short f_iregs[22]; 130 } F_fmtB; 131 } F_u; 132 }; 133 134 #define f_regs F_t.tf_regs 135 #define f_pad F_t.tf_pad 136 #define f_stackadj F_t.tf_stackadj 137 #define f_sr F_t.tf_sr 138 #define f_pc F_t.tf_pc 139 #define f_format F_t.tf_format 140 #define f_vector F_t.tf_vector 141 #define f_fmt2 F_u.F_fmt2 142 #define f_fmt3 F_u.F_fmt3 143 #define f_fmt4 F_u.F_fmt4 144 #define f_fmt7 F_u.F_fmt7 145 #define f_fmt8 F_u.F_fmt8 146 #define f_fmt9 F_u.F_fmt9 147 #define f_fmtA F_u.F_fmtA 148 #define f_fmtB F_u.F_fmtB 149 150 struct switchframe { 151 u_int sf_pc; 152 }; 153 154 /* common frame size */ 155 #define CFSIZE (sizeof(struct frame) - sizeof(union F_u)) 156 #define NFMTSIZE 9 157 158 #define FMT0 0x0 159 #define FMT1 0x1 160 #define FMT2 0x2 161 #define FMT3 0x3 162 #define FMT4 0x4 163 #define FMT7 0x7 164 #define FMT8 0x8 165 #define FMT9 0x9 166 #define FMTA 0xA 167 #define FMTB 0xB 168 169 /* frame specific info sizes */ 170 #define FMT0SIZE 0 171 #define FMT1SIZE 0 172 #define FMT2SIZE sizeof(struct fmt2) 173 #define FMT3SIZE sizeof(struct fmt3) 174 #define FMT4SIZE sizeof(struct fmt4) 175 #define FMT7SIZE sizeof(struct fmt7) 176 #define FMT8SIZE sizeof(struct fmt8) 177 #define FMT9SIZE sizeof(struct fmt9) 178 #define FMTASIZE sizeof(struct fmtA) 179 #define FMTBSIZE sizeof(struct fmtB) 180 181 #define V_BUSERR 0x008 182 #define V_ADDRERR 0x00C 183 #define V_TRAP1 0x084 184 185 /* 68010 SSW bits */ 186 #define SSW1_RR 0x8000 187 #define SSW1_IF 0x2000 188 #define SSW1_DF 0x1000 189 #define SSW1_RM 0x0800 190 #define SSW1_HI 0x0400 191 #define SSW1_BX 0x0200 192 #define SSW1_RW 0x0100 193 #define SSW1_FCMASK 0x000F 194 195 /* 68020/68030 SSW bits */ 196 #define SSW_RC 0x2000 197 #define SSW_RB 0x1000 198 #define SSW_DF 0x0100 199 #define SSW_RM 0x0080 200 #define SSW_RW 0x0040 201 #define SSW_FCMASK 0x0007 202 203 /* 68040 SSW bits */ 204 #define SSW4_CP 0x8000 205 #define SSW4_CU 0x4000 206 #define SSW4_CT 0x2000 207 #define SSW4_CM 0x1000 208 #define SSW4_MA 0x0800 209 #define SSW4_ATC 0x0400 210 #define SSW4_LK 0x0200 211 #define SSW4_RW 0x0100 212 #define SSW4_WBSV 0x0080 /* really in WB status, not SSW */ 213 #define SSW4_SZMASK 0x0060 214 #define SSW4_SZLW 0x0000 215 #define SSW4_SZB 0x0020 216 #define SSW4_SZW 0x0040 217 #define SSW4_SZLN 0x0060 218 #define SSW4_TTMASK 0x0018 219 #define SSW4_TTNOR 0x0000 220 #define SSW4_TTM16 0x0008 221 #define SSW4_TMMASK 0x0007 222 #define SSW4_TMDCP 0x0000 223 #define SSW4_TMUD 0x0001 224 #define SSW4_TMUC 0x0002 225 #define SSW4_TMKD 0x0005 226 #define SSW4_TMKC 0x0006 227 228 /* 060 Fault Status Long Word (FPSP) */ 229 230 #define FSLW_MA 0x08000000 231 #define FSLW_LK 0x02000000 232 #define FSLW_RW 0x01800000 233 234 #define FSLW_RW_R 0x01000000 235 #define FSLW_RW_W 0x00800000 236 237 #define FSLW_SIZE 0x00600000 238 /* 239 * We better define the FSLW_SIZE values here, as the table given in the 240 * MC68060UM/AD rev. 0/1 p. 8-23 is wrong, and was corrected in the errata 241 * document. 242 */ 243 #define FSLW_SIZE_LONG 0x00000000 244 #define FSLW_SIZE_BYTE 0x00200000 245 #define FSLW_SIZE_WORD 0x00400000 246 #define FSLW_SIZE_MV16 0x00600000 247 248 #define FLSW_TT 0x00180000 249 #define FSLW_TM 0x00070000 250 #define FSLW_TM_SV 0x00040000 251 252 253 254 #define FSLW_IO 0x00008000 255 #define FSLW_PBE 0x00004000 256 #define FSLW_SBE 0x00002000 257 #define FSLW_PTA 0x00001000 258 #define FSLW_PTB 0x00000800 259 #define FSLW_IL 0x00000400 260 #define FSLW_PF 0x00000200 261 #define FSLW_SP 0x00000100 262 #define FSLW_WP 0x00000080 263 #define FSLW_TWE 0x00000040 264 #define FSLW_RE 0x00000020 265 #define FSLW_WE 0x00000010 266 #define FSLW_TTR 0x00000008 267 #define FSLW_BPE 0x00000004 268 #define FSLW_SEE 0x00000001 269 270 struct fpframe { 271 union FPF_u1 { 272 u_int FPF_null; 273 struct { 274 u_char FPF_version; 275 u_char FPF_fsize; 276 u_short FPF_res1; 277 } FPF_nonnull; 278 } FPF_u1; 279 union FPF_u2 { 280 struct fpidle { 281 u_short fpf_ccr; 282 u_short fpf_res2; 283 u_int fpf_iregs1[8]; 284 u_int fpf_xops[3]; 285 u_int fpf_opreg; 286 u_int fpf_biu; 287 } FPF_idle; 288 289 struct fpbusy { 290 u_int fpf_iregs[53]; 291 } FPF_busy; 292 293 struct fpunimp { 294 u_int fpf_state[10]; 295 } FPF_unimp; 296 } FPF_u2; 297 u_int fpf_regs[8*3]; 298 u_int fpf_fpcr; 299 u_int fpf_fpsr; 300 u_int fpf_fpiar; 301 }; 302 303 #define fpf_null FPF_u1.FPF_null 304 #define fpf_version FPF_u1.FPF_nonnull.FPF_version 305 #define fpf_fsize FPF_u1.FPF_nonnull.FPF_fsize 306 #define fpf_res1 FPF_u1.FPF_nonnull.FPF_res1 307 #define fpf_idle FPF_u2.FPF_idle 308 #define fpf_busy FPF_u2.FPF_busy 309 #define fpf_unimp FPF_u2.FPF_unimp 310 311 /* 312 * This is incompatible with the earlier one; expecially, an earlier frame 313 * must not be FRESTOREd on a 060 or vv, because a frame error exception is 314 * not guaranteed. 315 */ 316 317 318 struct fpframe060 { 319 u_short fpf6_excp_exp; 320 u_char fpf6_frmfmt; 321 #define FPF6_FMT_NULL 0x00 322 #define FPF6_FMT_IDLE 0x60 323 #define FPF6_FMT_EXCP 0xe0 324 325 u_char fpf6_v; 326 #define FPF6_V_BSUN 0 327 #define FPF6_V_INEX12 1 328 #define FPF6_V_DZ 2 329 #define FPF6_V_UNFL 3 330 #define FPF6_V_OPERR 4 331 #define FPF6_V_OVFL 5 332 #define FPF6_V_SNAN 6 333 #define FPF6_V_UNSUP 7 334 335 u_long fpf6_upper, fpf6_lower; 336 }; 337 338 #if defined(_KERNEL) 339 /* 340 * Utility function to relocate the initial frame, make room to restore an 341 * exception frame and reenter the syscall. 342 */ 343 void reenter_syscall __P((struct frame *, int)) __attribute__((__noreturn__)); 344 #endif 345 346 #endif /* _M68K_FRAME_H_ */ 347