2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
31 * All Rights Reserved.
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
56 #ifndef _MACH_EXCEPTION_TYPES_H_
57 #define _MACH_EXCEPTION_TYPES_H_
59 #include <mach/machine/exception.h>
62 * Machine-independent exception definitions.
66 #define EXC_BAD_ACCESS 1 /* Could not access memory */
67 /* Code contains kern_return_t describing error. */
68 /* Subcode contains bad memory address. */
70 #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */
71 /* Illegal or undefined instruction or operand */
73 #define EXC_ARITHMETIC 3 /* Arithmetic exception */
74 /* Exact nature of exception is in code field */
76 #define EXC_EMULATION 4 /* Emulation instruction */
77 /* Emulation support instruction encountered */
78 /* Details in code and subcode fields */
80 #define EXC_SOFTWARE 5 /* Software generated exception */
81 /* Exact exception is in code field. */
82 /* Codes 0 - 0xFFFF reserved to hardware */
83 /* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) */
85 #define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */
86 /* Details in code field. */
88 #define EXC_SYSCALL 7 /* System calls. */
90 #define EXC_MACH_SYSCALL 8 /* Mach system calls. */
92 #define EXC_RPC_ALERT 9 /* RPC alert */
95 * Machine-independent exception behaviors
98 # define EXCEPTION_DEFAULT 1
99 /* Send a catch_exception_raise message including the identity.
102 # define EXCEPTION_STATE 2
103 /* Send a catch_exception_raise_state message including the
107 # define EXCEPTION_STATE_IDENTITY 3
108 /* Send a catch_exception_raise_state_identity message including
109 * the thread identity and state.
113 * Masks for exception definitions, above
114 * bit zero is unused, therefore 1 word = 31 exception types
117 #define EXC_MASK_BAD_ACCESS (1 << EXC_BAD_ACCESS)
118 #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION)
119 #define EXC_MASK_ARITHMETIC (1 << EXC_ARITHMETIC)
120 #define EXC_MASK_EMULATION (1 << EXC_EMULATION)
121 #define EXC_MASK_SOFTWARE (1 << EXC_SOFTWARE)
122 #define EXC_MASK_BREAKPOINT (1 << EXC_BREAKPOINT)
123 #define EXC_MASK_SYSCALL (1 << EXC_SYSCALL)
124 #define EXC_MASK_MACH_SYSCALL (1 << EXC_MACH_SYSCALL)
125 #define EXC_MASK_RPC_ALERT (1 << EXC_RPC_ALERT)
127 #define EXC_MASK_ALL (EXC_MASK_BAD_ACCESS | \
128 EXC_MASK_BAD_INSTRUCTION | \
129 EXC_MASK_ARITHMETIC | \
130 EXC_MASK_EMULATION | \
131 EXC_MASK_SOFTWARE | \
132 EXC_MASK_BREAKPOINT | \
134 EXC_MASK_MACH_SYSCALL | \
135 EXC_MASK_RPC_ALERT | \
139 #define FIRST_EXCEPTION 1 /* ZERO is illegal */
142 * Machine independent codes for EXC_SOFTWARE
143 * Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix)
144 * 0x10000 - 0x10002 in use for unix signals
146 #define EXC_SOFT_SIGNAL 0x10003 /* Unix signal exceptions */
149 #include <mach/port.h>
150 #include <mach/thread_status.h>
151 #include <mach/machine/vm_types.h>
156 typedef int exception_type_t
;
157 typedef integer_t exception_data_type_t
;
158 typedef int exception_behavior_t
;
159 typedef integer_t
*exception_data_t
;
160 typedef unsigned int exception_mask_t
;
161 typedef exception_mask_t
*exception_mask_array_t
;
162 typedef exception_behavior_t
*exception_behavior_array_t
;
163 typedef thread_state_flavor_t
*exception_flavor_array_t
;
164 typedef mach_port_t
*exception_port_array_t
;
166 #endif /* ASSEMBLER */
167 #endif /* _MACH_EXCEPTION_TYPES_H_ */