trap.h revision 719
14Srgrimes/*-
24Srgrimes * Copyright (c) 1990 The Regents of the University of California.
34Srgrimes * All rights reserved.
44Srgrimes *
54Srgrimes * This code is derived from software contributed to Berkeley by
64Srgrimes * William Jolitz.
74Srgrimes *
84Srgrimes * Redistribution and use in source and binary forms, with or without
94Srgrimes * modification, are permitted provided that the following conditions
104Srgrimes * are met:
114Srgrimes * 1. Redistributions of source code must retain the above copyright
124Srgrimes *    notice, this list of conditions and the following disclaimer.
134Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
144Srgrimes *    notice, this list of conditions and the following disclaimer in the
154Srgrimes *    documentation and/or other materials provided with the distribution.
164Srgrimes * 3. All advertising materials mentioning features or use of this software
174Srgrimes *    must display the following acknowledgement:
184Srgrimes *	This product includes software developed by the University of
194Srgrimes *	California, Berkeley and its contributors.
204Srgrimes * 4. Neither the name of the University nor the names of its contributors
214Srgrimes *    may be used to endorse or promote products derived from this software
224Srgrimes *    without specific prior written permission.
234Srgrimes *
244Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
254Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
264Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
274Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
284Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
294Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
304Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
314Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
324Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
334Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
344Srgrimes * SUCH DAMAGE.
354Srgrimes *
36621Srgrimes *	from: @(#)trap.h	5.4 (Berkeley) 5/9/91
37719Swollman *	$Id: trap.h,v 1.2 1993/10/16 14:39:37 rgrimes Exp $
384Srgrimes */
394Srgrimes
40719Swollman#ifndef _MACHINE_TRAP_H_
41719Swollman#define _MACHINE_TRAP_H_ 1
42719Swollman
434Srgrimes/*
444Srgrimes * Trap type values
454Srgrimes * also known in trap.c for name strings
464Srgrimes */
474Srgrimes
484Srgrimes#define	T_RESADFLT	0	/* reserved addressing */
494Srgrimes#define	T_PRIVINFLT	1	/* privileged instruction */
504Srgrimes#define	T_RESOPFLT	2	/* reserved operand */
514Srgrimes#define	T_BPTFLT	3	/* breakpoint instruction */
524Srgrimes#define	T_SYSCALL	5	/* system call (kcall) */
534Srgrimes#define	T_ARITHTRAP	6	/* arithmetic trap */
544Srgrimes#define	T_ASTFLT	7	/* system forced exception */
554Srgrimes#define	T_SEGFLT	8	/* segmentation (limit) fault */
564Srgrimes#define	T_PROTFLT	9	/* protection fault */
574Srgrimes#define	T_TRCTRAP	10	/* trace trap */
584Srgrimes#define	T_PAGEFLT	12	/* page fault */
594Srgrimes#define	T_TABLEFLT	13	/* page table fault */
604Srgrimes#define	T_ALIGNFLT	14	/* alignment fault */
614Srgrimes#define	T_KSPNOTVAL	15	/* kernel stack pointer not valid */
624Srgrimes#define	T_BUSERR	16	/* bus error */
634Srgrimes#define	T_KDBTRAP	17	/* kernel debugger trap */
644Srgrimes
654Srgrimes#define	T_DIVIDE	18	/* integer divide fault */
664Srgrimes#define	T_NMI		19	/* non-maskable trap */
674Srgrimes#define	T_OFLOW		20	/* overflow trap */
684Srgrimes#define	T_BOUND		21	/* bound instruction fault */
694Srgrimes#define	T_DNA		22	/* device not available fault */
704Srgrimes#define	T_DOUBLEFLT	23	/* double fault */
714Srgrimes#define	T_FPOPFLT	24	/* fp coprocessor operand fetch fault */
724Srgrimes#define	T_TSSFLT	25	/* invalid tss fault */
734Srgrimes#define	T_SEGNPFLT	26	/* segment not present fault */
744Srgrimes#define	T_STKFLT	27	/* stack fault */
754Srgrimes#define	T_RESERVED	28	/* reserved fault base */
764Srgrimes
774Srgrimes/* definitions for <sys/signal.h> */
784Srgrimes#define	    ILL_RESAD_FAULT	T_RESADFLT
794Srgrimes#define	    ILL_PRIVIN_FAULT	T_PRIVINFLT
804Srgrimes#define	    ILL_RESOP_FAULT	T_RESOPFLT
814Srgrimes#define	    ILL_ALIGN_FAULT	T_ALIGNFLT
824Srgrimes#define	    ILL_FPOP_FAULT	T_FPOPFLT	/* coprocessor operand fault */
834Srgrimes
844Srgrimes/* codes for SIGFPE/ARITHTRAP */
854Srgrimes#define	    FPE_INTOVF_TRAP	0x1	/* integer overflow */
864Srgrimes#define	    FPE_INTDIV_TRAP	0x2	/* integer divide by zero */
874Srgrimes#define	    FPE_FLTDIV_TRAP	0x3	/* floating/decimal divide by zero */
884Srgrimes#define	    FPE_FLTOVF_TRAP	0x4	/* floating overflow */
894Srgrimes#define	    FPE_FLTUND_TRAP	0x5	/* floating underflow */
904Srgrimes#define	    FPE_FPU_NP_TRAP	0x6	/* floating point unit not present */
914Srgrimes#define	    FPE_SUBRNG_TRAP	0x7	/* subrange out of bounds */
924Srgrimes
934Srgrimes/* codes for SIGBUS */
944Srgrimes#define	    BUS_PAGE_FAULT	T_PAGEFLT	/* page fault protection base */
954Srgrimes#define	    BUS_SEGNP_FAULT	T_SEGNPFLT	/* segment not present */
964Srgrimes#define	    BUS_STK_FAULT	T_STKFLT	/* stack segment */
974Srgrimes#define	    BUS_SEGM_FAULT	T_RESERVED	/* segment protection base */
984Srgrimes
994Srgrimes/* Trap's coming from user mode */
1004Srgrimes#define	T_USER	0x100
101719Swollman#endif /* _MACHINE_TRAP_H_ */
102