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.
63 #define EXC_BAD_ACCESS 1 /* Could not access memory */
64 /* Code contains kern_return_t describing error. */
65 /* Subcode contains bad memory address. */
67 #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */
68 /* Illegal or undefined instruction or operand */
70 #define EXC_ARITHMETIC 3 /* Arithmetic exception */
71 /* Exact nature of exception is in code field */
73 #define EXC_EMULATION 4 /* Emulation instruction */
74 /* Emulation support instruction encountered */
75 /* Details in code and subcode fields */
77 #define EXC_SOFTWARE 5 /* Software generated exception */
78 /* Exact exception is in code field. */
79 /* Codes 0 - 0xFFFF reserved to hardware */
80 /* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) */
82 #define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */
83 /* Details in code field. */
85 #define EXC_SYSCALL 7 /* System calls. */
87 #define EXC_MACH_SYSCALL 8 /* Mach system calls. */
89 #define EXC_RPC_ALERT 9 /* RPC alert */
92 * Machine-independent exception behaviors
95 # define EXCEPTION_DEFAULT 1
96 /* Send a catch_exception_raise message including the identity.
99 # define EXCEPTION_STATE 2
100 /* Send a catch_exception_raise_state message including the
104 # define EXCEPTION_STATE_IDENTITY 3
105 /* Send a catch_exception_raise_state_identity message including
106 * the thread identity and state.
110 * Masks for exception definitions, above
111 * bit zero is unused, therefore 1 word = 31 exception types
114 #define EXC_MASK_BAD_ACCESS (1 << EXC_BAD_ACCESS)
115 #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION)
116 #define EXC_MASK_ARITHMETIC (1 << EXC_ARITHMETIC)
117 #define EXC_MASK_EMULATION (1 << EXC_EMULATION)
118 #define EXC_MASK_SOFTWARE (1 << EXC_SOFTWARE)
119 #define EXC_MASK_BREAKPOINT (1 << EXC_BREAKPOINT)
120 #define EXC_MASK_SYSCALL (1 << EXC_SYSCALL)
121 #define EXC_MASK_MACH_SYSCALL (1 << EXC_MACH_SYSCALL)
122 #define EXC_MASK_RPC_ALERT (1 << EXC_RPC_ALERT)
124 #define EXC_MASK_ALL (EXC_MASK_BAD_ACCESS | \
125 EXC_MASK_BAD_INSTRUCTION | \
126 EXC_MASK_ARITHMETIC | \
127 EXC_MASK_EMULATION | \
128 EXC_MASK_SOFTWARE | \
129 EXC_MASK_BREAKPOINT | \
131 EXC_MASK_MACH_SYSCALL | \
132 EXC_MASK_RPC_ALERT | \
136 #define FIRST_EXCEPTION 1 /* ZERO is illegal */
139 #include <mach/port.h>
140 #include <mach/thread_status.h>
141 #include <mach/machine/vm_types.h>
146 typedef int exception_type_t
;
147 typedef integer_t exception_data_type_t
;
148 typedef int exception_behavior_t
;
149 typedef integer_t
*exception_data_t
;
150 typedef unsigned int exception_mask_t
;
151 typedef exception_mask_t
*exception_mask_array_t
;
152 typedef exception_behavior_t
*exception_behavior_array_t
;
153 typedef thread_state_flavor_t
*exception_flavor_array_t
;
154 typedef mach_port_t
*exception_port_array_t
;
156 #endif /* ASSEMBLER */
157 #endif /* _MACH_EXCEPTION_TYPES_H_ */