1 /* $NetBSD: cpuframe.h,v 1.11 2026/03/14 21:03:40 thorpej 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 44 struct 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 struct { 52 u_short /* BITFIELDTYPE */ fv_format:4, 53 /* BITFIELDTYPE */ fv_vector:12; 54 } tf_forvec __packed; 55 } F_t; 56 union F_u { 57 struct fmt2 { 58 u_int f_iaddr; 59 } F_fmt2; 60 61 struct fmt3 { 62 u_int f_ea; 63 } F_fmt3; 64 65 struct fmt4 { 66 u_int f_fa; 67 u_int f_fslw; 68 /* for 060FP type 4 FP disabled frames: */ 69 #define f_fea f_fa 70 #define f_pcfi f_fslw 71 } F_fmt4; 72 73 struct fmt7 { 74 u_int f_ea; 75 u_short f_ssw; 76 u_short f_wb3s, f_wb2s, f_wb1s; 77 u_int f_fa; 78 u_int f_wb3a, f_wb3d; 79 u_int f_wb2a, f_wb2d; 80 u_int f_wb1a, f_wb1d; 81 #define f_pd0 f_wb1d 82 u_int f_pd1, f_pd2, f_pd3; 83 } F_fmt7; 84 85 struct fmt8 { 86 u_short f_ssw; 87 u_int f_accaddr; 88 u_short f_ir0; 89 u_short f_dob; 90 u_short f_ir1; 91 u_short f_dib; 92 u_short f_ir2; 93 u_short f_irc; 94 u_short f_maskpc; 95 u_short f_iregs[15]; 96 } __attribute__((packed)) F_fmt8; 97 98 struct fmt9 { 99 u_int f_iaddr; 100 u_short f_iregs[4]; 101 } F_fmt9; 102 103 struct fmtA { 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 } F_fmtA; 113 114 struct fmtB { 115 u_short f_ir0; 116 u_short f_ssw; 117 u_short f_ipsc; 118 u_short f_ipsb; 119 u_int f_dcfa; 120 u_short f_ir1, f_ir2; 121 u_int f_dob; 122 u_short f_ir3, f_ir4; 123 u_short f_ir5, f_ir6; 124 u_int f_sba; 125 u_short f_ir7, f_ir8; 126 u_int f_dib; 127 u_short f_iregs[22]; 128 } F_fmtB; 129 } F_u; 130 }; 131 132 #define f_regs F_t.tf_regs 133 #define _f_pad F_t.tf_pad 134 #define f_stackadj F_t.tf_stackadj 135 #define f_sr F_t.tf_sr 136 #define f_pc F_t.tf_pc 137 #define f_forvec F_t.tf_forvec 138 #define f_format F_t.tf_forvec.fv_format 139 #define f_vector F_t.tf_forvec.fv_vector 140 #define f_fmt2 F_u.F_fmt2 141 #define f_fmt3 F_u.F_fmt3 142 #define f_fmt4 F_u.F_fmt4 143 #define f_fmt7 F_u.F_fmt7 144 #define f_fmt8 F_u.F_fmt8 145 #define f_fmt9 F_u.F_fmt9 146 #define f_fmtA F_u.F_fmtA 147 #define f_fmtB F_u.F_fmtB 148 149 #define tf_format tf_forvec.fv_format 150 #define tf_vector tf_forvec.fv_vector 151 152 struct switchframe { 153 u_int sf_pc; 154 }; 155 156 struct fpframe { 157 union FPF_u1 { 158 u_int FPF_null; 159 struct { 160 u_char FPF_version; 161 u_char FPF_fsize; 162 u_short FPF_res1; 163 } FPF_nonnull; 164 } FPF_u1; 165 union FPF_u2 { 166 struct fpidle { 167 u_short fpf_ccr; 168 u_short fpf_res2; 169 u_int fpf_iregs1[8]; 170 u_int fpf_xops[3]; 171 u_int fpf_opreg; 172 u_int fpf_biu; 173 } FPF_idle; 174 175 struct fpbusy { 176 u_int fpf_iregs[53]; 177 } FPF_busy; 178 179 struct fpunimp { 180 u_int fpf_state[10]; 181 } FPF_unimp; 182 } FPF_u2; 183 u_int fpf_regs[8*3]; 184 u_int fpf_fpcr; 185 u_int fpf_fpsr; 186 u_int fpf_fpiar; 187 }; 188 189 #define fpf_null FPF_u1.FPF_null 190 #define fpf_version FPF_u1.FPF_nonnull.FPF_version 191 #define fpf_fsize FPF_u1.FPF_nonnull.FPF_fsize 192 #define fpf_res1 FPF_u1.FPF_nonnull.FPF_res1 193 #define fpf_idle FPF_u2.FPF_idle 194 #define fpf_busy FPF_u2.FPF_busy 195 #define fpf_unimp FPF_u2.FPF_unimp 196 197 /* 198 * This is incompatible with the earlier one; especially, an earlier frame 199 * must not be FRESTOREd on a 060 or vv, because a frame error exception is 200 * not guaranteed. 201 */ 202 203 204 struct fpframe060 { 205 u_short fpf6_excp_exp; 206 u_char fpf6_frmfmt; 207 208 u_char fpf6_v; 209 210 u_long fpf6_upper, fpf6_lower; 211 }; 212 213 #endif /* _M68K_CPUFRAME_H_ */ 214