trap.h revision 227290
165253Sache/*-
265253Sache * Copyright (c) 1990 The Regents of the University of California.
365253Sache * All rights reserved.
465253Sache *
565253Sache * This code is derived from software contributed to Berkeley by
665253Sache * William Jolitz.
765253Sache *
865253Sache * Redistribution and use in source and binary forms, with or without
965253Sache * modification, are permitted provided that the following conditions
1065253Sache * are met:
1165253Sache * 1. Redistributions of source code must retain the above copyright
1265253Sache *    notice, this list of conditions and the following disclaimer.
1365253Sache * 2. Redistributions in binary form must reproduce the above copyright
1465253Sache *    notice, this list of conditions and the following disclaimer in the
1565253Sache *    documentation and/or other materials provided with the distribution.
1665253Sache * 4. Neither the name of the University nor the names of its contributors
1765253Sache *    may be used to endorse or promote products derived from this software
1865253Sache *    without specific prior written permission.
1965253Sache *
2065253Sache * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2165253Sache * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2265253Sache * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2365253Sache * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2465253Sache * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2565253Sache * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2665253Sache * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2765253Sache * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2865253Sache * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2965253Sache * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3065253Sache * SUCH DAMAGE.
3165253Sache *
3265253Sache *	from: @(#)trap.h	5.4 (Berkeley) 5/9/91
3365253Sache * $FreeBSD: head/sys/i386/include/trap.h 227290 2011-11-07 01:53:25Z rstone $
3465253Sache */
3565253Sache
3665253Sache#ifndef _MACHINE_TRAP_H_
3765253Sache#define	_MACHINE_TRAP_H_
3865253Sache
3965253Sache/*
4065253Sache * Trap type values
4165253Sache * also known in trap.c for name strings
4265253Sache */
4365253Sache
4465253Sache#define	T_PRIVINFLT	1	/* privileged instruction */
4565253Sache#define	T_BPTFLT	3	/* breakpoint instruction */
4665253Sache#define	T_ARITHTRAP	6	/* arithmetic trap */
4765253Sache#define	T_PROTFLT	9	/* protection fault */
4865253Sache#define	T_TRCTRAP	10	/* debug exception (sic) */
4965253Sache#define	T_PAGEFLT	12	/* page fault */
5065253Sache#define	T_ALIGNFLT	14	/* alignment fault */
5165253Sache
5265253Sache#define	T_DIVIDE	18	/* integer divide fault */
5365253Sache#define	T_NMI		19	/* non-maskable trap */
5465253Sache#define	T_OFLOW		20	/* overflow trap */
5565253Sache#define	T_BOUND		21	/* bound instruction fault */
5665253Sache#define	T_DNA		22	/* device not available fault */
5765253Sache#define	T_DOUBLEFLT	23	/* double fault */
5865253Sache#define	T_FPOPFLT	24	/* fp coprocessor operand fetch fault */
5965253Sache#define	T_TSSFLT	25	/* invalid tss fault */
6065253Sache#define	T_SEGNPFLT	26	/* segment not present fault */
6165253Sache#define	T_STKFLT	27	/* stack fault */
6265253Sache#define	T_MCHK		28	/* machine check trap */
6365253Sache#define	T_XMMFLT	29	/* SIMD floating-point exception */
6465253Sache#define	T_RESERVED	30	/* reserved (unknown) */
6565253Sache#define	T_DTRACE_RET	32	/* DTrace pid return */
6665253Sache#define	T_DTRACE_PROBE	33	/* DTrace fasttrap probe */
6765253Sache
6865253Sache/* XXX most of the following codes aren't used, but could be. */
6965253Sache
7065253Sache/* definitions for <sys/signal.h> */
7165253Sache#define	    ILL_RESAD_FAULT	T_RESADFLT
7265253Sache#define	    ILL_PRIVIN_FAULT	T_PRIVINFLT
7365253Sache#define	    ILL_RESOP_FAULT	T_RESOPFLT
7465253Sache#define	    ILL_ALIGN_FAULT	T_ALIGNFLT
7565253Sache#define	    ILL_FPOP_FAULT	T_FPOPFLT	/* coprocessor operand fault */
7665253Sache
7765253Sache/* old FreeBSD macros, deprecated */
7865253Sache#define	FPE_INTOVF_TRAP	0x1	/* integer overflow */
7965253Sache#define	FPE_INTDIV_TRAP	0x2	/* integer divide by zero */
8065253Sache#define	FPE_FLTDIV_TRAP	0x3	/* floating/decimal divide by zero */
8165253Sache#define	FPE_FLTOVF_TRAP	0x4	/* floating overflow */
8265253Sache#define	FPE_FLTUND_TRAP	0x5	/* floating underflow */
8365253Sache#define	FPE_FPU_NP_TRAP	0x6	/* floating point unit not present  */
8465253Sache#define	FPE_SUBRNG_TRAP	0x7	/* subrange out of bounds */
8565253Sache
8665253Sache/* codes for SIGBUS */
8765253Sache#define	    BUS_PAGE_FAULT	T_PAGEFLT	/* page fault protection base */
8865253Sache#define	    BUS_SEGNP_FAULT	T_SEGNPFLT	/* segment not present */
8965253Sache#define	    BUS_STK_FAULT	T_STKFLT	/* stack segment */
9065253Sache#define	    BUS_SEGM_FAULT	T_RESERVED	/* segment protection base */
9165253Sache
9265253Sache/* Trap's coming from user mode */
9365253Sache#define	T_USER	0x100
9465253Sache
9565253Sache#endif /* !_MACHINE_TRAP_H_ */
9665253Sache