trap.h revision 80709
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 3750477Speter * $FreeBSD: head/sys/amd64/include/trap.h 79609 2001-07-12 06:32:51Z peter $ 384Srgrimes */ 394Srgrimes 40719Swollman#ifndef _MACHINE_TRAP_H_ 415603Sbde#define _MACHINE_TRAP_H_ 42719Swollman 434Srgrimes/* 444Srgrimes * Trap type values 454Srgrimes * also known in trap.c for name strings 464Srgrimes */ 474Srgrimes 484Srgrimes#define T_PRIVINFLT 1 /* privileged instruction */ 494Srgrimes#define T_BPTFLT 3 /* breakpoint instruction */ 504Srgrimes#define T_ARITHTRAP 6 /* arithmetic trap */ 514Srgrimes#define T_PROTFLT 9 /* protection fault */ 525603Sbde#define T_TRCTRAP 10 /* debug exception (sic) */ 534Srgrimes#define T_PAGEFLT 12 /* page fault */ 544Srgrimes#define T_ALIGNFLT 14 /* alignment fault */ 554Srgrimes 564Srgrimes#define T_DIVIDE 18 /* integer divide fault */ 574Srgrimes#define T_NMI 19 /* non-maskable trap */ 584Srgrimes#define T_OFLOW 20 /* overflow trap */ 594Srgrimes#define T_BOUND 21 /* bound instruction fault */ 604Srgrimes#define T_DNA 22 /* device not available fault */ 614Srgrimes#define T_DOUBLEFLT 23 /* double fault */ 624Srgrimes#define T_FPOPFLT 24 /* fp coprocessor operand fetch fault */ 634Srgrimes#define T_TSSFLT 25 /* invalid tss fault */ 644Srgrimes#define T_SEGNPFLT 26 /* segment not present fault */ 654Srgrimes#define T_STKFLT 27 /* stack fault */ 6617520Sdg#define T_MCHK 28 /* machine check trap */ 6779609Speter#define T_XMMFLT 29 /* SIMD floating-point exception */ 6879609Speter#define T_RESERVED 30 /* reserved (unknown) */ 694Srgrimes 705603Sbde/* XXX most of the following codes aren't used, but could be. */ 715603Sbde 724Srgrimes/* definitions for <sys/signal.h> */ 734Srgrimes#define ILL_RESAD_FAULT T_RESADFLT 744Srgrimes#define ILL_PRIVIN_FAULT T_PRIVINFLT 754Srgrimes#define ILL_RESOP_FAULT T_RESOPFLT 764Srgrimes#define ILL_ALIGN_FAULT T_ALIGNFLT 774Srgrimes#define ILL_FPOP_FAULT T_FPOPFLT /* coprocessor operand fault */ 784Srgrimes 7949098Scracauer/* portable macros for SIGFPE/ARITHTRAP */ 8058342Scracauer#define FPE_INTOVF 1 /* integer overflow */ 8158342Scracauer#define FPE_INTDIV 2 /* integer divide by zero */ 8249081Scracauer#define FPE_FLTDIV 3 /* floating point divide by zero */ 8349081Scracauer#define FPE_FLTOVF 4 /* floating point overflow */ 8449081Scracauer#define FPE_FLTUND 5 /* floating point underflow */ 8549081Scracauer#define FPE_FLTRES 6 /* floating point inexact result */ 8649081Scracauer#define FPE_FLTINV 7 /* invalid floating point operation */ 8749081Scracauer#define FPE_FLTSUB 8 /* subscript out of range */ 8849081Scracauer 8949081Scracauer/* old FreeBSD macros, deprecated */ 9049098Scracauer#define FPE_INTOVF_TRAP 0x1 /* integer overflow */ 9149098Scracauer#define FPE_INTDIV_TRAP 0x2 /* integer divide by zero */ 9249098Scracauer#define FPE_FLTDIV_TRAP 0x3 /* floating/decimal divide by zero */ 9349098Scracauer#define FPE_FLTOVF_TRAP 0x4 /* floating overflow */ 9449098Scracauer#define FPE_FLTUND_TRAP 0x5 /* floating underflow */ 9549098Scracauer#define FPE_FPU_NP_TRAP 0x6 /* floating point unit not present */ 9649098Scracauer#define FPE_SUBRNG_TRAP 0x7 /* subrange out of bounds */ 974Srgrimes 984Srgrimes/* codes for SIGBUS */ 994Srgrimes#define BUS_PAGE_FAULT T_PAGEFLT /* page fault protection base */ 1004Srgrimes#define BUS_SEGNP_FAULT T_SEGNPFLT /* segment not present */ 1014Srgrimes#define BUS_STK_FAULT T_STKFLT /* stack segment */ 1024Srgrimes#define BUS_SEGM_FAULT T_RESERVED /* segment protection base */ 1034Srgrimes 1044Srgrimes/* Trap's coming from user mode */ 1054Srgrimes#define T_USER 0x100 1065603Sbde 1075603Sbde#endif /* !_MACHINE_TRAP_H_ */ 108