]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/exception_types.h
xnu-792.tar.gz
[apple/xnu.git] / osfmk / mach / exception_types.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
e5568f75
A
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.
1c79356b 11 *
e5568f75
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
e5568f75
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * @OSF_COPYRIGHT@
24 */
25/*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
29 *
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.
35 *
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.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50/*
51 */
52
53#ifndef _MACH_EXCEPTION_TYPES_H_
54#define _MACH_EXCEPTION_TYPES_H_
55
56#include <mach/machine/exception.h>
57
58/*
59 * Machine-independent exception definitions.
60 */
61
1c79356b
A
62#define EXC_BAD_ACCESS 1 /* Could not access memory */
63 /* Code contains kern_return_t describing error. */
64 /* Subcode contains bad memory address. */
65
66#define EXC_BAD_INSTRUCTION 2 /* Instruction failed */
67 /* Illegal or undefined instruction or operand */
68
69#define EXC_ARITHMETIC 3 /* Arithmetic exception */
70 /* Exact nature of exception is in code field */
71
72#define EXC_EMULATION 4 /* Emulation instruction */
73 /* Emulation support instruction encountered */
74 /* Details in code and subcode fields */
75
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) */
80
81#define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */
82 /* Details in code field. */
83
84#define EXC_SYSCALL 7 /* System calls. */
85
86#define EXC_MACH_SYSCALL 8 /* Mach system calls. */
87
88#define EXC_RPC_ALERT 9 /* RPC alert */
89
90/*
91 * Machine-independent exception behaviors
92 */
93
94# define EXCEPTION_DEFAULT 1
95/* Send a catch_exception_raise message including the identity.
96 */
97
98# define EXCEPTION_STATE 2
99/* Send a catch_exception_raise_state message including the
100 * thread state.
101 */
102
103# define EXCEPTION_STATE_IDENTITY 3
104/* Send a catch_exception_raise_state_identity message including
105 * the thread identity and state.
106 */
107
108/*
109 * Masks for exception definitions, above
110 * bit zero is unused, therefore 1 word = 31 exception types
111 */
112
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)
122
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 | \
129 EXC_MASK_SYSCALL | \
130 EXC_MASK_MACH_SYSCALL | \
131 EXC_MASK_RPC_ALERT | \
132 EXC_MASK_MACHINE)
133
134
135#define FIRST_EXCEPTION 1 /* ZERO is illegal */
136
9bccf70c
A
137/*
138 * Machine independent codes for EXC_SOFTWARE
139 * Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix)
140 * 0x10000 - 0x10002 in use for unix signals
141 */
142#define EXC_SOFT_SIGNAL 0x10003 /* Unix signal exceptions */
143
1c79356b 144#ifndef ASSEMBLER
91447636 145
1c79356b
A
146#include <mach/port.h>
147#include <mach/thread_status.h>
148#include <mach/machine/vm_types.h>
149/*
150 * Exported types
151 */
152
153typedef int exception_type_t;
154typedef integer_t exception_data_type_t;
155typedef int exception_behavior_t;
156typedef integer_t *exception_data_t;
157typedef unsigned int exception_mask_t;
158typedef exception_mask_t *exception_mask_array_t;
159typedef exception_behavior_t *exception_behavior_array_t;
160typedef thread_state_flavor_t *exception_flavor_array_t;
161typedef mach_port_t *exception_port_array_t;
162
163#endif /* ASSEMBLER */
91447636 164
1c79356b 165#endif /* _MACH_EXCEPTION_TYPES_H_ */