1 /*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)trap.h 8.1 (Berkeley) 06/11/93 11 */ 12 13 /* 14 * Trap type values 15 * also known in trap.c for name strings 16 */ 17 18 #define T_RESADFLT 0 /* reserved addressing */ 19 #define T_PRIVINFLT 1 /* privileged instruction */ 20 #define T_RESOPFLT 2 /* reserved operand */ 21 #define T_BPTFLT 3 /* breakpoint instruction */ 22 #define T_SYSCALL 5 /* system call (kcall) */ 23 #define T_ARITHTRAP 6 /* arithmetic trap */ 24 #define T_ASTFLT 7 /* system forced exception */ 25 #define T_SEGFLT 8 /* segmentation (limit) fault */ 26 #define T_PROTFLT 9 /* protection fault */ 27 #define T_TRCTRAP 10 /* trace trap */ 28 #define T_PAGEFLT 12 /* page fault */ 29 #define T_TABLEFLT 13 /* page table fault */ 30 #define T_ALIGNFLT 14 /* alignment fault */ 31 #define T_KSPNOTVAL 15 /* kernel stack pointer not valid */ 32 #define T_BUSERR 16 /* bus error */ 33 #define T_KDBTRAP 17 /* kernel debugger trap */ 34 35 #define T_DIVIDE 18 /* integer divide fault */ 36 #define T_NMI 19 /* non-maskable trap */ 37 #define T_OFLOW 20 /* overflow trap */ 38 #define T_BOUND 21 /* bound instruction fault */ 39 #define T_DNA 22 /* device not available fault */ 40 #define T_DOUBLEFLT 23 /* double fault */ 41 #define T_FPOPFLT 24 /* fp coprocessor operand fetch fault */ 42 #define T_TSSFLT 25 /* invalid tss fault */ 43 #define T_SEGNPFLT 26 /* segment not present fault */ 44 #define T_STKFLT 27 /* stack fault */ 45 #define T_RESERVED 28 /* reserved fault base */ 46 47 /* definitions for <sys/signal.h> */ 48 #define ILL_RESAD_FAULT T_RESADFLT 49 #define ILL_PRIVIN_FAULT T_PRIVINFLT 50 #define ILL_RESOP_FAULT T_RESOPFLT 51 #define ILL_ALIGN_FAULT T_ALIGNFLT 52 #define ILL_FPOP_FAULT T_FPOPFLT /* coprocessor operand fault */ 53 54 /* codes for SIGFPE/ARITHTRAP */ 55 #define FPE_INTOVF_TRAP 0x1 /* integer overflow */ 56 #define FPE_INTDIV_TRAP 0x2 /* integer divide by zero */ 57 #define FPE_FLTDIV_TRAP 0x3 /* floating/decimal divide by zero */ 58 #define FPE_FLTOVF_TRAP 0x4 /* floating overflow */ 59 #define FPE_FLTUND_TRAP 0x5 /* floating underflow */ 60 #define FPE_FPU_NP_TRAP 0x6 /* floating point unit not present */ 61 #define FPE_SUBRNG_TRAP 0x7 /* subrange out of bounds */ 62 63 /* codes for SIGBUS */ 64 #define BUS_PAGE_FAULT T_PAGEFLT /* page fault protection base */ 65 #define BUS_SEGNP_FAULT T_SEGNPFLT /* segment not present */ 66 #define BUS_STK_FAULT T_STKFLT /* stack segment */ 67 #define BUS_SEGM_FAULT T_RESERVED /* segment protection base */ 68 69 /* Trap's coming from user mode */ 70 #define T_USER 0x100 71