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