1*5c2921b0SApple OSS Distributions /* 2*5c2921b0SApple OSS Distributions * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 3*5c2921b0SApple OSS Distributions * 4*5c2921b0SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*5c2921b0SApple OSS Distributions * 6*5c2921b0SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*5c2921b0SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*5c2921b0SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*5c2921b0SApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*5c2921b0SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*5c2921b0SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*5c2921b0SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*5c2921b0SApple OSS Distributions * terms of an Apple operating system software license agreement. 14*5c2921b0SApple OSS Distributions * 15*5c2921b0SApple OSS Distributions * Please obtain a copy of the License at 16*5c2921b0SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*5c2921b0SApple OSS Distributions * 18*5c2921b0SApple OSS Distributions * The Original Code and all software distributed under the License are 19*5c2921b0SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*5c2921b0SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*5c2921b0SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*5c2921b0SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*5c2921b0SApple OSS Distributions * Please see the License for the specific language governing rights and 24*5c2921b0SApple OSS Distributions * limitations under the License. 25*5c2921b0SApple OSS Distributions * 26*5c2921b0SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*5c2921b0SApple OSS Distributions */ 28*5c2921b0SApple OSS Distributions /* 29*5c2921b0SApple OSS Distributions * @OSF_COPYRIGHT@ 30*5c2921b0SApple OSS Distributions */ 31*5c2921b0SApple OSS Distributions /* 32*5c2921b0SApple OSS Distributions * Mach Operating System 33*5c2921b0SApple OSS Distributions * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University 34*5c2921b0SApple OSS Distributions * All Rights Reserved. 35*5c2921b0SApple OSS Distributions * 36*5c2921b0SApple OSS Distributions * Permission to use, copy, modify and distribute this software and its 37*5c2921b0SApple OSS Distributions * documentation is hereby granted, provided that both the copyright 38*5c2921b0SApple OSS Distributions * notice and this permission notice appear in all copies of the 39*5c2921b0SApple OSS Distributions * software, derivative works or modified versions, and any portions 40*5c2921b0SApple OSS Distributions * thereof, and that both notices appear in supporting documentation. 41*5c2921b0SApple OSS Distributions * 42*5c2921b0SApple OSS Distributions * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 43*5c2921b0SApple OSS Distributions * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 44*5c2921b0SApple OSS Distributions * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 45*5c2921b0SApple OSS Distributions * 46*5c2921b0SApple OSS Distributions * Carnegie Mellon requests users of this software to return to 47*5c2921b0SApple OSS Distributions * 48*5c2921b0SApple OSS Distributions * Software Distribution Coordinator or [email protected] 49*5c2921b0SApple OSS Distributions * School of Computer Science 50*5c2921b0SApple OSS Distributions * Carnegie Mellon University 51*5c2921b0SApple OSS Distributions * Pittsburgh PA 15213-3890 52*5c2921b0SApple OSS Distributions * 53*5c2921b0SApple OSS Distributions * any improvements or extensions that they make and grant Carnegie Mellon 54*5c2921b0SApple OSS Distributions * the rights to redistribute these changes. 55*5c2921b0SApple OSS Distributions */ 56*5c2921b0SApple OSS Distributions /* 57*5c2921b0SApple OSS Distributions */ 58*5c2921b0SApple OSS Distributions 59*5c2921b0SApple OSS Distributions #ifndef _MACH_EXCEPTION_TYPES_H_ 60*5c2921b0SApple OSS Distributions #define _MACH_EXCEPTION_TYPES_H_ 61*5c2921b0SApple OSS Distributions 62*5c2921b0SApple OSS Distributions #include <mach/machine/exception.h> 63*5c2921b0SApple OSS Distributions 64*5c2921b0SApple OSS Distributions /* 65*5c2921b0SApple OSS Distributions * Machine-independent exception definitions. 66*5c2921b0SApple OSS Distributions */ 67*5c2921b0SApple OSS Distributions 68*5c2921b0SApple OSS Distributions #define EXC_BAD_ACCESS 1 /* Could not access memory */ 69*5c2921b0SApple OSS Distributions /* Code contains kern_return_t describing error. */ 70*5c2921b0SApple OSS Distributions /* Subcode contains bad memory address. */ 71*5c2921b0SApple OSS Distributions 72*5c2921b0SApple OSS Distributions #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ 73*5c2921b0SApple OSS Distributions /* Illegal or undefined instruction or operand */ 74*5c2921b0SApple OSS Distributions 75*5c2921b0SApple OSS Distributions #define EXC_ARITHMETIC 3 /* Arithmetic exception */ 76*5c2921b0SApple OSS Distributions /* Exact nature of exception is in code field */ 77*5c2921b0SApple OSS Distributions 78*5c2921b0SApple OSS Distributions #define EXC_EMULATION 4 /* Emulation instruction */ 79*5c2921b0SApple OSS Distributions /* Emulation support instruction encountered */ 80*5c2921b0SApple OSS Distributions /* Details in code and subcode fields */ 81*5c2921b0SApple OSS Distributions 82*5c2921b0SApple OSS Distributions #define EXC_SOFTWARE 5 /* Software generated exception */ 83*5c2921b0SApple OSS Distributions /* Exact exception is in code field. */ 84*5c2921b0SApple OSS Distributions /* Codes 0 - 0xFFFF reserved to hardware */ 85*5c2921b0SApple OSS Distributions /* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) */ 86*5c2921b0SApple OSS Distributions 87*5c2921b0SApple OSS Distributions #define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */ 88*5c2921b0SApple OSS Distributions /* Details in code field. */ 89*5c2921b0SApple OSS Distributions 90*5c2921b0SApple OSS Distributions #define EXC_SYSCALL 7 /* System calls. */ 91*5c2921b0SApple OSS Distributions 92*5c2921b0SApple OSS Distributions #define EXC_MACH_SYSCALL 8 /* Mach system calls. */ 93*5c2921b0SApple OSS Distributions 94*5c2921b0SApple OSS Distributions #define EXC_RPC_ALERT 9 /* RPC alert */ 95*5c2921b0SApple OSS Distributions 96*5c2921b0SApple OSS Distributions #define EXC_CRASH 10 /* Abnormal process exit */ 97*5c2921b0SApple OSS Distributions 98*5c2921b0SApple OSS Distributions #define EXC_RESOURCE 11 /* Hit resource consumption limit */ 99*5c2921b0SApple OSS Distributions /* Exact resource is in code field. */ 100*5c2921b0SApple OSS Distributions 101*5c2921b0SApple OSS Distributions #define EXC_GUARD 12 /* Violated guarded resource protections */ 102*5c2921b0SApple OSS Distributions 103*5c2921b0SApple OSS Distributions #define EXC_CORPSE_NOTIFY 13 /* Abnormal process exited to corpse state */ 104*5c2921b0SApple OSS Distributions 105*5c2921b0SApple OSS Distributions 106*5c2921b0SApple OSS Distributions /* 107*5c2921b0SApple OSS Distributions * Machine-independent exception behaviors 108*5c2921b0SApple OSS Distributions */ 109*5c2921b0SApple OSS Distributions 110*5c2921b0SApple OSS Distributions #define EXCEPTION_DEFAULT 1 111*5c2921b0SApple OSS Distributions /* Send a catch_exception_raise message including the identity. 112*5c2921b0SApple OSS Distributions */ 113*5c2921b0SApple OSS Distributions 114*5c2921b0SApple OSS Distributions #define EXCEPTION_STATE 2 115*5c2921b0SApple OSS Distributions /* Send a catch_exception_raise_state message including the 116*5c2921b0SApple OSS Distributions * thread state. 117*5c2921b0SApple OSS Distributions */ 118*5c2921b0SApple OSS Distributions 119*5c2921b0SApple OSS Distributions #define EXCEPTION_STATE_IDENTITY 3 120*5c2921b0SApple OSS Distributions /* Send a catch_exception_raise_state_identity message including 121*5c2921b0SApple OSS Distributions * the thread identity and state. 122*5c2921b0SApple OSS Distributions */ 123*5c2921b0SApple OSS Distributions 124*5c2921b0SApple OSS Distributions #define EXCEPTION_IDENTITY_PROTECTED 4 125*5c2921b0SApple OSS Distributions /* Send a catch_exception_raise_identity_protected message including protected task 126*5c2921b0SApple OSS Distributions * and thread identity. 127*5c2921b0SApple OSS Distributions */ 128*5c2921b0SApple OSS Distributions 129*5c2921b0SApple OSS Distributions #define MACH_EXCEPTION_BACKTRACE_PREFERRED 0x20000000 130*5c2921b0SApple OSS Distributions /* Prefer sending a catch_exception_raice_backtrace message, if applicable */ 131*5c2921b0SApple OSS Distributions 132*5c2921b0SApple OSS Distributions #define MACH_EXCEPTION_ERRORS 0x40000000 133*5c2921b0SApple OSS Distributions /* include additional exception specific errors, not used yet. */ 134*5c2921b0SApple OSS Distributions 135*5c2921b0SApple OSS Distributions #define MACH_EXCEPTION_CODES 0x80000000 136*5c2921b0SApple OSS Distributions /* Send 64-bit code and subcode in the exception header */ 137*5c2921b0SApple OSS Distributions 138*5c2921b0SApple OSS Distributions #define MACH_EXCEPTION_MASK (MACH_EXCEPTION_CODES | \ 139*5c2921b0SApple OSS Distributions MACH_EXCEPTION_ERRORS | \ 140*5c2921b0SApple OSS Distributions MACH_EXCEPTION_BACKTRACE_PREFERRED) 141*5c2921b0SApple OSS Distributions /* 142*5c2921b0SApple OSS Distributions * Masks for exception definitions, above 143*5c2921b0SApple OSS Distributions * bit zero is unused, therefore 1 word = 31 exception types 144*5c2921b0SApple OSS Distributions */ 145*5c2921b0SApple OSS Distributions 146*5c2921b0SApple OSS Distributions #define EXC_MASK_BAD_ACCESS (1 << EXC_BAD_ACCESS) 147*5c2921b0SApple OSS Distributions #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) 148*5c2921b0SApple OSS Distributions #define EXC_MASK_ARITHMETIC (1 << EXC_ARITHMETIC) 149*5c2921b0SApple OSS Distributions #define EXC_MASK_EMULATION (1 << EXC_EMULATION) 150*5c2921b0SApple OSS Distributions #define EXC_MASK_SOFTWARE (1 << EXC_SOFTWARE) 151*5c2921b0SApple OSS Distributions #define EXC_MASK_BREAKPOINT (1 << EXC_BREAKPOINT) 152*5c2921b0SApple OSS Distributions #define EXC_MASK_SYSCALL (1 << EXC_SYSCALL) 153*5c2921b0SApple OSS Distributions #define EXC_MASK_MACH_SYSCALL (1 << EXC_MACH_SYSCALL) 154*5c2921b0SApple OSS Distributions #define EXC_MASK_RPC_ALERT (1 << EXC_RPC_ALERT) 155*5c2921b0SApple OSS Distributions #define EXC_MASK_CRASH (1 << EXC_CRASH) 156*5c2921b0SApple OSS Distributions #define EXC_MASK_RESOURCE (1 << EXC_RESOURCE) 157*5c2921b0SApple OSS Distributions #define EXC_MASK_GUARD (1 << EXC_GUARD) 158*5c2921b0SApple OSS Distributions #define EXC_MASK_CORPSE_NOTIFY (1 << EXC_CORPSE_NOTIFY) 159*5c2921b0SApple OSS Distributions 160*5c2921b0SApple OSS Distributions #define EXC_MASK_ALL (EXC_MASK_BAD_ACCESS | \ 161*5c2921b0SApple OSS Distributions EXC_MASK_BAD_INSTRUCTION | \ 162*5c2921b0SApple OSS Distributions EXC_MASK_ARITHMETIC | \ 163*5c2921b0SApple OSS Distributions EXC_MASK_EMULATION | \ 164*5c2921b0SApple OSS Distributions EXC_MASK_SOFTWARE | \ 165*5c2921b0SApple OSS Distributions EXC_MASK_BREAKPOINT | \ 166*5c2921b0SApple OSS Distributions EXC_MASK_SYSCALL | \ 167*5c2921b0SApple OSS Distributions EXC_MASK_MACH_SYSCALL | \ 168*5c2921b0SApple OSS Distributions EXC_MASK_RPC_ALERT | \ 169*5c2921b0SApple OSS Distributions EXC_MASK_RESOURCE | \ 170*5c2921b0SApple OSS Distributions EXC_MASK_GUARD | \ 171*5c2921b0SApple OSS Distributions EXC_MASK_MACHINE) 172*5c2921b0SApple OSS Distributions 173*5c2921b0SApple OSS Distributions #ifdef KERNEL_PRIVATE 174*5c2921b0SApple OSS Distributions #define EXC_MASK_VALID (EXC_MASK_ALL | EXC_MASK_CRASH | EXC_MASK_CORPSE_NOTIFY) 175*5c2921b0SApple OSS Distributions #endif /* KERNEL_PRIVATE */ 176*5c2921b0SApple OSS Distributions 177*5c2921b0SApple OSS Distributions #define FIRST_EXCEPTION 1 /* ZERO is illegal */ 178*5c2921b0SApple OSS Distributions 179*5c2921b0SApple OSS Distributions /* 180*5c2921b0SApple OSS Distributions * Machine independent codes for EXC_SOFTWARE 181*5c2921b0SApple OSS Distributions * Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) 182*5c2921b0SApple OSS Distributions * 0x10000 - 0x10002 in use for unix signals 183*5c2921b0SApple OSS Distributions * 0x20000 - 0x2FFFF reserved for MACF 184*5c2921b0SApple OSS Distributions */ 185*5c2921b0SApple OSS Distributions #define EXC_SOFT_SIGNAL 0x10003 /* Unix signal exceptions */ 186*5c2921b0SApple OSS Distributions 187*5c2921b0SApple OSS Distributions #define EXC_MACF_MIN 0x20000 /* MACF exceptions */ 188*5c2921b0SApple OSS Distributions #define EXC_MACF_MAX 0x2FFFF 189*5c2921b0SApple OSS Distributions 190*5c2921b0SApple OSS Distributions #ifndef ASSEMBLER 191*5c2921b0SApple OSS Distributions 192*5c2921b0SApple OSS Distributions #include <mach/port.h> 193*5c2921b0SApple OSS Distributions #include <mach/thread_status.h> 194*5c2921b0SApple OSS Distributions #include <mach/machine/vm_types.h> 195*5c2921b0SApple OSS Distributions #include <mach_debug/ipc_info.h> 196*5c2921b0SApple OSS Distributions /* 197*5c2921b0SApple OSS Distributions * Exported types 198*5c2921b0SApple OSS Distributions */ 199*5c2921b0SApple OSS Distributions 200*5c2921b0SApple OSS Distributions typedef int exception_type_t; 201*5c2921b0SApple OSS Distributions typedef integer_t exception_data_type_t; 202*5c2921b0SApple OSS Distributions typedef int64_t mach_exception_data_type_t; 203*5c2921b0SApple OSS Distributions typedef int exception_behavior_t; 204*5c2921b0SApple OSS Distributions typedef exception_data_type_t *exception_data_t; 205*5c2921b0SApple OSS Distributions typedef mach_exception_data_type_t *mach_exception_data_t; 206*5c2921b0SApple OSS Distributions typedef unsigned int exception_mask_t; 207*5c2921b0SApple OSS Distributions typedef exception_mask_t *exception_mask_array_t; 208*5c2921b0SApple OSS Distributions typedef exception_behavior_t *exception_behavior_array_t; 209*5c2921b0SApple OSS Distributions typedef thread_state_flavor_t *exception_flavor_array_t; 210*5c2921b0SApple OSS Distributions typedef mach_port_t *exception_port_array_t; 211*5c2921b0SApple OSS Distributions typedef ipc_info_port_t *exception_port_info_array_t; 212*5c2921b0SApple OSS Distributions typedef mach_exception_data_type_t mach_exception_code_t; 213*5c2921b0SApple OSS Distributions typedef mach_exception_data_type_t mach_exception_subcode_t; 214*5c2921b0SApple OSS Distributions 215*5c2921b0SApple OSS Distributions #endif /* ASSEMBLER */ 216*5c2921b0SApple OSS Distributions 217*5c2921b0SApple OSS Distributions #endif /* _MACH_EXCEPTION_TYPES_H_ */ 218