Home | History | Annotate | Line # | Download | only in include
frame.h revision 1.20
      1  1.20       agc /*	$NetBSD: frame.h,v 1.20 2003/08/07 16:28:13 agc Exp $	*/
      2   1.8       cgd 
      3   1.1       cgd /*
      4   1.6   mycroft  * Copyright (c) 1982, 1990, 1993
      5   1.6   mycroft  *	The Regents of the University of California.  All rights reserved.
      6  1.20       agc  *
      7  1.20       agc  * This code is derived from software contributed to Berkeley by
      8  1.20       agc  * the Systems Programming Group of the University of Utah Computer
      9  1.20       agc  * Science Department.
     10  1.20       agc  *
     11  1.20       agc  * Redistribution and use in source and binary forms, with or without
     12  1.20       agc  * modification, are permitted provided that the following conditions
     13  1.20       agc  * are met:
     14  1.20       agc  * 1. Redistributions of source code must retain the above copyright
     15  1.20       agc  *    notice, this list of conditions and the following disclaimer.
     16  1.20       agc  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.20       agc  *    notice, this list of conditions and the following disclaimer in the
     18  1.20       agc  *    documentation and/or other materials provided with the distribution.
     19  1.20       agc  * 3. Neither the name of the University nor the names of its contributors
     20  1.20       agc  *    may be used to endorse or promote products derived from this software
     21  1.20       agc  *    without specific prior written permission.
     22  1.20       agc  *
     23  1.20       agc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  1.20       agc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  1.20       agc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  1.20       agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  1.20       agc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  1.20       agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  1.20       agc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  1.20       agc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  1.20       agc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  1.20       agc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  1.20       agc  * SUCH DAMAGE.
     34  1.20       agc  *
     35  1.20       agc  * from: Utah $Hdr: frame.h 1.8 92/12/20$
     36  1.20       agc  *
     37  1.20       agc  *	@(#)frame.h	8.1 (Berkeley) 6/10/93
     38  1.20       agc  */
     39  1.20       agc /*
     40  1.20       agc  * Copyright (c) 1988 University of Utah.
     41   1.1       cgd  *
     42   1.1       cgd  * This code is derived from software contributed to Berkeley by
     43   1.1       cgd  * the Systems Programming Group of the University of Utah Computer
     44   1.1       cgd  * Science Department.
     45   1.1       cgd  *
     46   1.1       cgd  * Redistribution and use in source and binary forms, with or without
     47   1.1       cgd  * modification, are permitted provided that the following conditions
     48   1.1       cgd  * are met:
     49   1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     50   1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     51   1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     52   1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     53   1.1       cgd  *    documentation and/or other materials provided with the distribution.
     54   1.1       cgd  * 3. All advertising materials mentioning features or use of this software
     55   1.1       cgd  *    must display the following acknowledgement:
     56   1.1       cgd  *	This product includes software developed by the University of
     57   1.1       cgd  *	California, Berkeley and its contributors.
     58   1.1       cgd  * 4. Neither the name of the University nor the names of its contributors
     59   1.1       cgd  *    may be used to endorse or promote products derived from this software
     60   1.1       cgd  *    without specific prior written permission.
     61   1.1       cgd  *
     62   1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     63   1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     64   1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     65   1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     66   1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     67   1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     68   1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     69   1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     70   1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     71   1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     72   1.1       cgd  * SUCH DAMAGE.
     73   1.1       cgd  *
     74   1.6   mycroft  * from: Utah $Hdr: frame.h 1.8 92/12/20$
     75   1.6   mycroft  *
     76   1.8       cgd  *	@(#)frame.h	8.1 (Berkeley) 6/10/93
     77   1.1       cgd  */
     78   1.9    chopps 
     79  1.13       gwr #ifndef	_M68K_FRAME_H_
     80  1.13       gwr #define	_M68K_FRAME_H_
     81  1.13       gwr 
     82   1.1       cgd struct frame {
     83  1.10   mycroft 	struct trapframe {
     84  1.10   mycroft 		int	tf_regs[16];
     85  1.10   mycroft 		short	tf_pad;
     86  1.10   mycroft 		short	tf_stackadj;
     87  1.10   mycroft 		u_short	tf_sr;
     88  1.10   mycroft 		u_int	tf_pc;
     89  1.10   mycroft 		u_short	tf_format:4,
     90  1.10   mycroft 			tf_vector:12;
     91  1.15   mycroft 	} __attribute__((packed)) F_t;
     92   1.1       cgd 	union F_u {
     93   1.1       cgd 		struct fmt2 {
     94   1.1       cgd 			u_int	f_iaddr;
     95   1.1       cgd 		} F_fmt2;
     96   1.1       cgd 
     97   1.4        mw 		struct fmt3 {
     98   1.6   mycroft 			u_int	f_ea;
     99   1.4        mw 		} F_fmt3;
    100   1.4        mw 
    101  1.11        is 		struct fmt4 {
    102  1.11        is 			u_int	f_fa;
    103  1.11        is 			u_int	f_fslw;
    104  1.11        is 			/* for 060FP type 4 FP disabled frames: */
    105  1.11        is #define 		f_fea	f_fa
    106  1.11        is #define 		f_pcfi	f_fslw
    107  1.11        is 		} F_fmt4;
    108  1.11        is 
    109   1.4        mw 		struct fmt7 {
    110   1.4        mw 			u_int	f_ea;
    111   1.4        mw 			u_short	f_ssw;
    112   1.6   mycroft 			u_short	f_wb3s, f_wb2s, f_wb1s;
    113   1.4        mw 			u_int	f_fa;
    114   1.6   mycroft 			u_int	f_wb3a, f_wb3d;
    115   1.6   mycroft 			u_int	f_wb2a, f_wb2d;
    116   1.6   mycroft 			u_int	f_wb1a, f_wb1d;
    117   1.6   mycroft #define				f_pd0 f_wb1d
    118   1.6   mycroft 			u_int	f_pd1, f_pd2, f_pd3;
    119   1.4        mw 		} F_fmt7;
    120   1.4        mw 
    121  1.17  fredette 		struct fmt8 {
    122  1.17  fredette 			u_short	f_ssw;
    123  1.17  fredette 			u_int	f_accaddr;
    124  1.17  fredette 			u_short	f_ir0;
    125  1.17  fredette 			u_short	f_dob;
    126  1.17  fredette 			u_short	f_ir1;
    127  1.17  fredette 			u_short	f_dib;
    128  1.17  fredette 			u_short	f_ir2;
    129  1.17  fredette 			u_short	f_irc;
    130  1.17  fredette 			u_short	f_maskpc;
    131  1.17  fredette 			u_short	f_iregs[15];
    132  1.18  fredette 		} __attribute__((packed)) F_fmt8;
    133  1.17  fredette 
    134   1.1       cgd 		struct fmt9 {
    135   1.1       cgd 			u_int	f_iaddr;
    136   1.1       cgd 			u_short	f_iregs[4];
    137   1.1       cgd 		} F_fmt9;
    138   1.1       cgd 
    139   1.1       cgd 		struct fmtA {
    140   1.1       cgd 			u_short	f_ir0;
    141   1.1       cgd 			u_short	f_ssw;
    142   1.1       cgd 			u_short	f_ipsc;
    143   1.1       cgd 			u_short	f_ipsb;
    144   1.1       cgd 			u_int	f_dcfa;
    145   1.1       cgd 			u_short	f_ir1, f_ir2;
    146   1.1       cgd 			u_int	f_dob;
    147   1.1       cgd 			u_short	f_ir3, f_ir4;
    148   1.1       cgd 		} F_fmtA;
    149   1.1       cgd 
    150   1.1       cgd 		struct fmtB {
    151   1.1       cgd 			u_short	f_ir0;
    152   1.1       cgd 			u_short	f_ssw;
    153   1.1       cgd 			u_short	f_ipsc;
    154   1.1       cgd 			u_short	f_ipsb;
    155   1.1       cgd 			u_int	f_dcfa;
    156   1.1       cgd 			u_short	f_ir1, f_ir2;
    157   1.1       cgd 			u_int	f_dob;
    158   1.1       cgd 			u_short	f_ir3, f_ir4;
    159   1.1       cgd 			u_short	f_ir5, f_ir6;
    160   1.1       cgd 			u_int	f_sba;
    161   1.1       cgd 			u_short	f_ir7, f_ir8;
    162   1.1       cgd 			u_int	f_dib;
    163   1.1       cgd 			u_short	f_iregs[22];
    164   1.1       cgd 		} F_fmtB;
    165   1.1       cgd 	} F_u;
    166   1.1       cgd };
    167   1.1       cgd 
    168  1.10   mycroft #define	f_regs		F_t.tf_regs
    169  1.10   mycroft #define	f_pad		F_t.tf_pad
    170  1.10   mycroft #define	f_stackadj	F_t.tf_stackadj
    171  1.10   mycroft #define	f_sr		F_t.tf_sr
    172  1.10   mycroft #define	f_pc		F_t.tf_pc
    173  1.10   mycroft #define	f_format	F_t.tf_format
    174  1.10   mycroft #define	f_vector	F_t.tf_vector
    175   1.1       cgd #define	f_fmt2		F_u.F_fmt2
    176   1.6   mycroft #define	f_fmt3		F_u.F_fmt3
    177  1.11        is #define	f_fmt4		F_u.F_fmt4
    178   1.4        mw #define	f_fmt7		F_u.F_fmt7
    179  1.17  fredette #define	f_fmt8		F_u.F_fmt8
    180   1.6   mycroft #define	f_fmt9		F_u.F_fmt9
    181   1.1       cgd #define	f_fmtA		F_u.F_fmtA
    182   1.1       cgd #define	f_fmtB		F_u.F_fmtB
    183  1.10   mycroft 
    184  1.10   mycroft struct switchframe {
    185  1.10   mycroft 	u_int	sf_pc;
    186  1.10   mycroft };
    187   1.1       cgd 
    188   1.1       cgd /* common frame size */
    189   1.1       cgd #define	CFSIZE		(sizeof(struct frame) - sizeof(union F_u))
    190  1.11        is #define	NFMTSIZE	9
    191   1.1       cgd 
    192   1.1       cgd #define	FMT0		0x0
    193   1.1       cgd #define	FMT1		0x1
    194   1.1       cgd #define	FMT2		0x2
    195   1.4        mw #define	FMT3		0x3
    196  1.11        is #define	FMT4		0x4
    197   1.4        mw #define	FMT7		0x7
    198  1.17  fredette #define	FMT8		0x8
    199   1.1       cgd #define	FMT9		0x9
    200   1.1       cgd #define	FMTA		0xA
    201   1.1       cgd #define	FMTB		0xB
    202   1.1       cgd 
    203   1.1       cgd /* frame specific info sizes */
    204   1.1       cgd #define	FMT0SIZE	0
    205   1.1       cgd #define	FMT1SIZE	0
    206   1.1       cgd #define	FMT2SIZE	sizeof(struct fmt2)
    207   1.4        mw #define	FMT3SIZE	sizeof(struct fmt3)
    208  1.11        is #define	FMT4SIZE	sizeof(struct fmt4)
    209   1.4        mw #define	FMT7SIZE	sizeof(struct fmt7)
    210  1.17  fredette #define	FMT8SIZE	sizeof(struct fmt8)
    211   1.1       cgd #define	FMT9SIZE	sizeof(struct fmt9)
    212   1.1       cgd #define	FMTASIZE	sizeof(struct fmtA)
    213   1.1       cgd #define	FMTBSIZE	sizeof(struct fmtB)
    214   1.1       cgd 
    215   1.1       cgd #define	V_BUSERR	0x008
    216   1.1       cgd #define	V_ADDRERR	0x00C
    217   1.1       cgd #define	V_TRAP1		0x084
    218  1.17  fredette 
    219  1.17  fredette /* 68010 SSW bits */
    220  1.17  fredette #define SSW1_RR		0x8000
    221  1.17  fredette #define SSW1_IF		0x2000
    222  1.17  fredette #define SSW1_DF		0x1000
    223  1.17  fredette #define SSW1_RM		0x0800
    224  1.17  fredette #define SSW1_HI		0x0400
    225  1.17  fredette #define SSW1_BX		0x0200
    226  1.17  fredette #define SSW1_RW		0x0100
    227  1.17  fredette #define SSW1_FCMASK	0x000F
    228   1.1       cgd 
    229   1.6   mycroft /* 68020/68030 SSW bits */
    230   1.1       cgd #define	SSW_RC		0x2000
    231   1.1       cgd #define	SSW_RB		0x1000
    232   1.1       cgd #define	SSW_DF		0x0100
    233   1.1       cgd #define	SSW_RM		0x0080
    234   1.1       cgd #define	SSW_RW		0x0040
    235   1.1       cgd #define	SSW_FCMASK	0x0007
    236   1.1       cgd 
    237   1.6   mycroft /* 68040 SSW bits */
    238   1.6   mycroft #define	SSW4_CP		0x8000
    239   1.6   mycroft #define	SSW4_CU		0x4000
    240   1.6   mycroft #define	SSW4_CT		0x2000
    241   1.6   mycroft #define	SSW4_CM		0x1000
    242   1.6   mycroft #define	SSW4_MA		0x0800
    243   1.6   mycroft #define	SSW4_ATC	0x0400
    244   1.6   mycroft #define	SSW4_LK		0x0200
    245   1.6   mycroft #define	SSW4_RW		0x0100
    246   1.6   mycroft #define SSW4_WBSV	0x0080	/* really in WB status, not SSW */
    247   1.6   mycroft #define	SSW4_SZMASK	0x0060
    248   1.6   mycroft #define	SSW4_SZLW	0x0000
    249   1.6   mycroft #define	SSW4_SZB	0x0020
    250   1.6   mycroft #define	SSW4_SZW	0x0040
    251   1.6   mycroft #define	SSW4_SZLN	0x0060
    252   1.6   mycroft #define	SSW4_TTMASK	0x0018
    253   1.6   mycroft #define	SSW4_TTNOR	0x0000
    254   1.6   mycroft #define	SSW4_TTM16	0x0008
    255   1.6   mycroft #define	SSW4_TMMASK	0x0007
    256   1.6   mycroft #define	SSW4_TMDCP	0x0000
    257   1.6   mycroft #define	SSW4_TMUD	0x0001
    258   1.6   mycroft #define	SSW4_TMUC	0x0002
    259   1.6   mycroft #define	SSW4_TMKD	0x0005
    260   1.6   mycroft #define	SSW4_TMKC	0x0006
    261   1.6   mycroft 
    262  1.11        is /* 060 Fault Status Long Word (FPSP) */
    263  1.11        is 
    264  1.11        is #define FSLW_MA		0x08000000
    265  1.11        is #define FSLW_LK		0x02000000
    266  1.11        is #define FSLW_RW		0x01800000
    267  1.12        is 
    268  1.12        is #define FSLW_RW_R	0x01000000
    269  1.12        is #define FSLW_RW_W	0x00800000
    270  1.12        is 
    271  1.11        is #define FSLW_SIZE	0x00600000
    272  1.11        is /*
    273  1.11        is  * We better define the FSLW_SIZE values here, as the table given in the
    274  1.11        is  * MC68060UM/AD rev. 0/1 p. 8-23 is wrong, and was corrected in the errata
    275  1.11        is  * document.
    276  1.11        is  */
    277  1.11        is #define FSLW_SIZE_LONG	0x00000000
    278  1.11        is #define FSLW_SIZE_BYTE	0x00200000
    279  1.11        is #define FSLW_SIZE_WORD	0x00400000
    280  1.11        is #define FSLW_SIZE_MV16	0x00600000
    281  1.11        is 
    282  1.11        is #define FLSW_TT		0x00180000
    283  1.11        is #define FSLW_TM		0x00070000
    284  1.12        is #define FSLW_TM_SV	0x00040000
    285  1.12        is 
    286  1.12        is 
    287  1.11        is 
    288  1.11        is #define FSLW_IO		0x00008000
    289  1.11        is #define FSLW_PBE	0x00004000
    290  1.11        is #define FSLW_SBE	0x00002000
    291  1.11        is #define FSLW_PTA	0x00001000
    292  1.11        is #define FSLW_PTB 	0x00000800
    293  1.11        is #define FSLW_IL 	0x00000400
    294  1.11        is #define FSLW_PF 	0x00000200
    295  1.11        is #define FSLW_SP 	0x00000100
    296  1.11        is #define FSLW_WP 	0x00000080
    297  1.11        is #define FSLW_TWE 	0x00000040
    298  1.11        is #define FSLW_RE 	0x00000020
    299  1.11        is #define FSLW_WE 	0x00000010
    300  1.11        is #define FSLW_TTR 	0x00000008
    301  1.11        is #define FSLW_BPE 	0x00000004
    302  1.11        is #define FSLW_SEE 	0x00000001
    303  1.11        is 
    304   1.1       cgd struct fpframe {
    305   1.1       cgd 	union FPF_u1 {
    306   1.1       cgd 		u_int	FPF_null;
    307   1.1       cgd 		struct {
    308   1.1       cgd 			u_char	FPF_version;
    309   1.1       cgd 			u_char	FPF_fsize;
    310   1.1       cgd 			u_short	FPF_res1;
    311   1.1       cgd 		} FPF_nonnull;
    312   1.1       cgd 	} FPF_u1;
    313   1.1       cgd 	union FPF_u2 {
    314   1.1       cgd 		struct fpidle {
    315   1.1       cgd 			u_short	fpf_ccr;
    316   1.1       cgd 			u_short	fpf_res2;
    317   1.1       cgd 			u_int	fpf_iregs1[8];
    318   1.1       cgd 			u_int	fpf_xops[3];
    319   1.1       cgd 			u_int	fpf_opreg;
    320   1.1       cgd 			u_int	fpf_biu;
    321   1.1       cgd 		} FPF_idle;
    322   1.1       cgd 
    323   1.1       cgd 		struct fpbusy {
    324   1.1       cgd 			u_int	fpf_iregs[53];
    325   1.1       cgd 		} FPF_busy;
    326   1.4        mw 
    327   1.6   mycroft 		struct fpunimp {
    328   1.6   mycroft 			u_int	fpf_state[10];
    329   1.6   mycroft 		} FPF_unimp;
    330   1.1       cgd 	} FPF_u2;
    331   1.1       cgd 	u_int	fpf_regs[8*3];
    332   1.1       cgd 	u_int	fpf_fpcr;
    333   1.1       cgd 	u_int	fpf_fpsr;
    334   1.1       cgd 	u_int	fpf_fpiar;
    335   1.1       cgd };
    336   1.1       cgd 
    337   1.1       cgd #define fpf_null	FPF_u1.FPF_null
    338   1.1       cgd #define fpf_version	FPF_u1.FPF_nonnull.FPF_version
    339   1.1       cgd #define fpf_fsize	FPF_u1.FPF_nonnull.FPF_fsize
    340   1.1       cgd #define fpf_res1	FPF_u1.FPF_nonnull.FPF_res1
    341   1.1       cgd #define fpf_idle	FPF_u2.FPF_idle
    342   1.1       cgd #define fpf_busy	FPF_u2.FPF_busy
    343   1.6   mycroft #define fpf_unimp	FPF_u2.FPF_unimp
    344  1.11        is 
    345  1.11        is /*
    346  1.11        is  * This is incompatible with the earlier one; expecially, an earlier frame
    347  1.11        is  * must not be FRESTOREd on a 060 or vv, because a frame error exception is
    348  1.11        is  * not guaranteed.
    349  1.11        is  */
    350  1.11        is 
    351  1.11        is 
    352  1.11        is struct fpframe060 {
    353  1.11        is 	u_short	fpf6_excp_exp;
    354  1.11        is 	u_char	fpf6_frmfmt;
    355  1.11        is #define FPF6_FMT_NULL	0x00
    356  1.11        is #define FPF6_FMT_IDLE	0x60
    357  1.11        is #define FPF6_FMT_EXCP	0xe0
    358  1.11        is 
    359  1.11        is 	u_char	fpf6_v;
    360  1.11        is #define	FPF6_V_BSUN	0
    361  1.11        is #define	FPF6_V_INEX12	1
    362  1.11        is #define	FPF6_V_DZ	2
    363  1.11        is #define	FPF6_V_UNFL	3
    364  1.11        is #define	FPF6_V_OPERR	4
    365  1.11        is #define	FPF6_V_OVFL	5
    366  1.11        is #define	FPF6_V_SNAN	6
    367  1.11        is #define	FPF6_V_UNSUP	7
    368  1.11        is 
    369  1.11        is 	u_long	fpf6_upper, fpf6_lower;
    370  1.11        is };
    371  1.16    kleink 
    372  1.16    kleink #if defined(_KERNEL)
    373  1.16    kleink /*
    374  1.16    kleink  * Utility function to relocate the initial frame, make room to restore an
    375  1.16    kleink  * exception frame and reenter the syscall.
    376  1.16    kleink  */
    377  1.16    kleink void reenter_syscall __P((struct frame *, int)) __attribute__((__noreturn__));
    378  1.19   thorpej 
    379  1.19   thorpej /*
    380  1.19   thorpej  * Create an FPU "idle" frame for use by cpu_setmcontext()
    381  1.19   thorpej  */
    382  1.19   thorpej extern void m68k_make_fpu_idle_frame(void);
    383  1.19   thorpej extern struct fpframe m68k_cached_fpu_idle_frame;
    384  1.19   thorpej #endif	/* _KERNEL */
    385  1.13       gwr 
    386  1.13       gwr #endif	/* _M68K_FRAME_H_ */
    387