]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/exception_types.h
xnu-344.21.73.tar.gz
[apple/xnu.git] / osfmk / mach / exception_types.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
13 * file.
14 *
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.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * @OSF_COPYRIGHT@
27 */
28 /*
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
31 * All Rights Reserved.
32 *
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.
38 *
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.
42 *
43 * Carnegie Mellon requests users of this software to return to
44 *
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
49 *
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
52 */
53 /*
54 */
55
56 #ifndef _MACH_EXCEPTION_TYPES_H_
57 #define _MACH_EXCEPTION_TYPES_H_
58
59 #include <mach/machine/exception.h>
60
61 /*
62 * Machine-independent exception definitions.
63 */
64
65
66 #define EXC_BAD_ACCESS 1 /* Could not access memory */
67 /* Code contains kern_return_t describing error. */
68 /* Subcode contains bad memory address. */
69
70 #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */
71 /* Illegal or undefined instruction or operand */
72
73 #define EXC_ARITHMETIC 3 /* Arithmetic exception */
74 /* Exact nature of exception is in code field */
75
76 #define EXC_EMULATION 4 /* Emulation instruction */
77 /* Emulation support instruction encountered */
78 /* Details in code and subcode fields */
79
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) */
84
85 #define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */
86 /* Details in code field. */
87
88 #define EXC_SYSCALL 7 /* System calls. */
89
90 #define EXC_MACH_SYSCALL 8 /* Mach system calls. */
91
92 #define EXC_RPC_ALERT 9 /* RPC alert */
93
94 /*
95 * Machine-independent exception behaviors
96 */
97
98 # define EXCEPTION_DEFAULT 1
99 /* Send a catch_exception_raise message including the identity.
100 */
101
102 # define EXCEPTION_STATE 2
103 /* Send a catch_exception_raise_state message including the
104 * thread state.
105 */
106
107 # define EXCEPTION_STATE_IDENTITY 3
108 /* Send a catch_exception_raise_state_identity message including
109 * the thread identity and state.
110 */
111
112 /*
113 * Masks for exception definitions, above
114 * bit zero is unused, therefore 1 word = 31 exception types
115 */
116
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)
126
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 | \
133 EXC_MASK_SYSCALL | \
134 EXC_MASK_MACH_SYSCALL | \
135 EXC_MASK_RPC_ALERT | \
136 EXC_MASK_MACHINE)
137
138
139 #define FIRST_EXCEPTION 1 /* ZERO is illegal */
140
141 /*
142 * Machine independent codes for EXC_SOFTWARE
143 * Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix)
144 * 0x10000 - 0x10002 in use for unix signals
145 */
146 #define EXC_SOFT_SIGNAL 0x10003 /* Unix signal exceptions */
147
148 #ifndef ASSEMBLER
149 #include <mach/port.h>
150 #include <mach/thread_status.h>
151 #include <mach/machine/vm_types.h>
152 /*
153 * Exported types
154 */
155
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;
165
166 #endif /* ASSEMBLER */
167 #endif /* _MACH_EXCEPTION_TYPES_H_ */