trap.h revision 58342
191592Smarkm/*- 212099Sjoerg * Copyright (c) 1990 The Regents of the University of California. 312099Sjoerg * All rights reserved. 491592Smarkm * 512099Sjoerg * This code is derived from software contributed to Berkeley by 612099Sjoerg * William Jolitz. 712099Sjoerg * 812099Sjoerg * Redistribution and use in source and binary forms, with or without 912099Sjoerg * modification, are permitted provided that the following conditions 1012099Sjoerg * are met: 1112099Sjoerg * 1. Redistributions of source code must retain the above copyright 1212099Sjoerg * notice, this list of conditions and the following disclaimer. 1312099Sjoerg * 2. Redistributions in binary form must reproduce the above copyright 1412099Sjoerg * notice, this list of conditions and the following disclaimer in the 1512099Sjoerg * documentation and/or other materials provided with the distribution. 1612099Sjoerg * 3. All advertising materials mentioning features or use of this software 1712099Sjoerg * must display the following acknowledgement: 1812099Sjoerg * This product includes software developed by the University of 1912099Sjoerg * California, Berkeley and its contributors. 2012099Sjoerg * 4. Neither the name of the University nor the names of its contributors 2112099Sjoerg * may be used to endorse or promote products derived from this software 2212099Sjoerg * without specific prior written permission. 2312099Sjoerg * 2412099Sjoerg * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2512099Sjoerg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2612099Sjoerg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2712099Sjoerg * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2812099Sjoerg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2912099Sjoerg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3012099Sjoerg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3112099Sjoerg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3212099Sjoerg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3312099Sjoerg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3412099Sjoerg * SUCH DAMAGE. 3591592Smarkm * 3691592Smarkm * from: @(#)trap.h 5.4 (Berkeley) 5/9/91 3791592Smarkm * $FreeBSD: head/sys/i386/include/trap.h 58342 2000-03-20 10:22:19Z cracauer $ 3812099Sjoerg */ 3991592Smarkm 4012099Sjoerg#ifndef _MACHINE_TRAP_H_ 4112099Sjoerg#define _MACHINE_TRAP_H_ 4212099Sjoerg 4312099Sjoerg/* 4412099Sjoerg * Trap type values 4512099Sjoerg * also known in trap.c for name strings 4612099Sjoerg */ 4712099Sjoerg 4812099Sjoerg#define T_PRIVINFLT 1 /* privileged instruction */ 4912099Sjoerg#define T_BPTFLT 3 /* breakpoint instruction */ 5012099Sjoerg#define T_ARITHTRAP 6 /* arithmetic trap */ 5112099Sjoerg#define T_ASTFLT 7 /* system forced exception */ 5212099Sjoerg#define T_PROTFLT 9 /* protection fault */ 5312099Sjoerg#define T_TRCTRAP 10 /* debug exception (sic) */ 5412099Sjoerg#define T_PAGEFLT 12 /* page fault */ 5512099Sjoerg#define T_ALIGNFLT 14 /* alignment fault */ 5612099Sjoerg 5712099Sjoerg#define T_DIVIDE 18 /* integer divide fault */ 5812099Sjoerg#define T_NMI 19 /* non-maskable trap */ 5912099Sjoerg#define T_OFLOW 20 /* overflow trap */ 6012099Sjoerg#define T_BOUND 21 /* bound instruction fault */ 6112099Sjoerg#define T_DNA 22 /* device not available fault */ 6291592Smarkm#define T_DOUBLEFLT 23 /* double fault */ 6391592Smarkm#define T_FPOPFLT 24 /* fp coprocessor operand fetch fault */ 6491592Smarkm#define T_TSSFLT 25 /* invalid tss fault */ 6591592Smarkm#define T_SEGNPFLT 26 /* segment not present fault */ 6691592Smarkm#define T_STKFLT 27 /* stack fault */ 6791592Smarkm#define T_MCHK 28 /* machine check trap */ 6891592Smarkm#define T_RESERVED 29 /* reserved (unknown) */ 6991592Smarkm 7091592Smarkm/* XXX most of the following codes aren't used, but could be. */ 7191592Smarkm 7291592Smarkm/* definitions for <sys/signal.h> */ 7391592Smarkm#define ILL_RESAD_FAULT T_RESADFLT 7491592Smarkm#define ILL_PRIVIN_FAULT T_PRIVINFLT 7591592Smarkm#define ILL_RESOP_FAULT T_RESOPFLT 7691592Smarkm#define ILL_ALIGN_FAULT T_ALIGNFLT 7791592Smarkm#define ILL_FPOP_FAULT T_FPOPFLT /* coprocessor operand fault */ 7891592Smarkm 7991592Smarkm/* portable macros for SIGFPE/ARITHTRAP */ 8091592Smarkm#define FPE_INTOVF 1 /* integer overflow */ 8112099Sjoerg#define FPE_INTDIV 2 /* integer divide by zero */ 8212099Sjoerg#define FPE_FLTDIV 3 /* floating point divide by zero */ 8312099Sjoerg#define FPE_FLTOVF 4 /* floating point overflow */ 8412099Sjoerg#define FPE_FLTUND 5 /* floating point underflow */ 8512099Sjoerg#define FPE_FLTRES 6 /* floating point inexact result */ 8691592Smarkm#define FPE_FLTINV 7 /* invalid floating point operation */ 8712099Sjoerg#define FPE_FLTSUB 8 /* subscript out of range */ 8891592Smarkm 8912099Sjoerg/* old FreeBSD macros, deprecated */ 9012099Sjoerg#define FPE_INTOVF_TRAP 0x1 /* integer overflow */ 9180284Sobrien#define FPE_INTDIV_TRAP 0x2 /* integer divide by zero */ 9280284Sobrien#define FPE_FLTDIV_TRAP 0x3 /* floating/decimal divide by zero */ 9312099Sjoerg#define FPE_FLTOVF_TRAP 0x4 /* floating overflow */ 9412099Sjoerg#define FPE_FLTUND_TRAP 0x5 /* floating underflow */ 9512099Sjoerg#define FPE_FPU_NP_TRAP 0x6 /* floating point unit not present */ 9612099Sjoerg#define FPE_SUBRNG_TRAP 0x7 /* subrange out of bounds */ 9791592Smarkm 9891592Smarkm/* codes for SIGBUS */ 9912099Sjoerg#define BUS_PAGE_FAULT T_PAGEFLT /* page fault protection base */ 10080284Sobrien#define BUS_SEGNP_FAULT T_SEGNPFLT /* segment not present */ 10180284Sobrien#define BUS_STK_FAULT T_STKFLT /* stack segment */ 10212099Sjoerg#define BUS_SEGM_FAULT T_RESERVED /* segment protection base */ 10312099Sjoerg 10412099Sjoerg/* Trap's coming from user mode */ 10512099Sjoerg#define T_USER 0x100 10612099Sjoerg 10712099Sjoerg#endif /* !_MACHINE_TRAP_H_ */ 10812099Sjoerg