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 * 4. Neither the name of the University nor the names of its contributors
174Srgrimes *    may be used to endorse or promote products derived from this software
184Srgrimes *    without specific prior written permission.
194Srgrimes *
204Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
214Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
224Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
234Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
244Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
254Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
264Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
274Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
284Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
294Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
304Srgrimes * SUCH DAMAGE.
314Srgrimes *
32621Srgrimes *	from: @(#)trap.h	5.4 (Berkeley) 5/9/91
3350477Speter * $FreeBSD$
344Srgrimes */
354Srgrimes
36719Swollman#ifndef _MACHINE_TRAP_H_
375603Sbde#define	_MACHINE_TRAP_H_
38719Swollman
394Srgrimes/*
404Srgrimes * Trap type values
414Srgrimes * also known in trap.c for name strings
424Srgrimes */
434Srgrimes
444Srgrimes#define	T_PRIVINFLT	1	/* privileged instruction */
454Srgrimes#define	T_BPTFLT	3	/* breakpoint instruction */
464Srgrimes#define	T_ARITHTRAP	6	/* arithmetic trap */
474Srgrimes#define	T_PROTFLT	9	/* protection fault */
485603Sbde#define	T_TRCTRAP	10	/* debug exception (sic) */
494Srgrimes#define	T_PAGEFLT	12	/* page fault */
504Srgrimes#define	T_ALIGNFLT	14	/* alignment fault */
514Srgrimes
524Srgrimes#define	T_DIVIDE	18	/* integer divide fault */
534Srgrimes#define	T_NMI		19	/* non-maskable trap */
544Srgrimes#define	T_OFLOW		20	/* overflow trap */
554Srgrimes#define	T_BOUND		21	/* bound instruction fault */
564Srgrimes#define	T_DNA		22	/* device not available fault */
574Srgrimes#define	T_DOUBLEFLT	23	/* double fault */
584Srgrimes#define	T_FPOPFLT	24	/* fp coprocessor operand fetch fault */
594Srgrimes#define	T_TSSFLT	25	/* invalid tss fault */
604Srgrimes#define	T_SEGNPFLT	26	/* segment not present fault */
614Srgrimes#define	T_STKFLT	27	/* stack fault */
6217520Sdg#define	T_MCHK		28	/* machine check trap */
6379609Speter#define	T_XMMFLT	29	/* SIMD floating-point exception */
6479609Speter#define	T_RESERVED	30	/* reserved (unknown) */
65227290Srstone#define	T_DTRACE_RET	32	/* DTrace pid return */
664Srgrimes
675603Sbde/* XXX most of the following codes aren't used, but could be. */
685603Sbde
694Srgrimes/* definitions for <sys/signal.h> */
704Srgrimes#define	    ILL_RESAD_FAULT	T_RESADFLT
714Srgrimes#define	    ILL_PRIVIN_FAULT	T_PRIVINFLT
724Srgrimes#define	    ILL_RESOP_FAULT	T_RESOPFLT
734Srgrimes#define	    ILL_ALIGN_FAULT	T_ALIGNFLT
744Srgrimes#define	    ILL_FPOP_FAULT	T_FPOPFLT	/* coprocessor operand fault */
754Srgrimes
7649081Scracauer/* old FreeBSD macros, deprecated */
7749098Scracauer#define	FPE_INTOVF_TRAP	0x1	/* integer overflow */
7849098Scracauer#define	FPE_INTDIV_TRAP	0x2	/* integer divide by zero */
7949098Scracauer#define	FPE_FLTDIV_TRAP	0x3	/* floating/decimal divide by zero */
8049098Scracauer#define	FPE_FLTOVF_TRAP	0x4	/* floating overflow */
8149098Scracauer#define	FPE_FLTUND_TRAP	0x5	/* floating underflow */
8249098Scracauer#define	FPE_FPU_NP_TRAP	0x6	/* floating point unit not present  */
8349098Scracauer#define	FPE_SUBRNG_TRAP	0x7	/* subrange out of bounds */
844Srgrimes
854Srgrimes/* codes for SIGBUS */
864Srgrimes#define	    BUS_PAGE_FAULT	T_PAGEFLT	/* page fault protection base */
874Srgrimes#define	    BUS_SEGNP_FAULT	T_SEGNPFLT	/* segment not present */
884Srgrimes#define	    BUS_STK_FAULT	T_STKFLT	/* stack segment */
894Srgrimes#define	    BUS_SEGM_FAULT	T_RESERVED	/* segment protection base */
904Srgrimes
914Srgrimes/* Trap's coming from user mode */
924Srgrimes#define	T_USER	0x100
935603Sbde
945603Sbde#endif /* !_MACHINE_TRAP_H_ */
95