]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/exception_types.h
xnu-517.12.7.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
62
63#define EXC_BAD_ACCESS 1 /* Could not access memory */
64 /* Code contains kern_return_t describing error. */
65 /* Subcode contains bad memory address. */
66
67#define EXC_BAD_INSTRUCTION 2 /* Instruction failed */
68 /* Illegal or undefined instruction or operand */
69
70#define EXC_ARITHMETIC 3 /* Arithmetic exception */
71 /* Exact nature of exception is in code field */
72
73#define EXC_EMULATION 4 /* Emulation instruction */
74 /* Emulation support instruction encountered */
75 /* Details in code and subcode fields */
76
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) */
81
82#define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */
83 /* Details in code field. */
84
85#define EXC_SYSCALL 7 /* System calls. */
86
87#define EXC_MACH_SYSCALL 8 /* Mach system calls. */
88
89#define EXC_RPC_ALERT 9 /* RPC alert */
90
91/*
92 * Machine-independent exception behaviors
93 */
94
95# define EXCEPTION_DEFAULT 1
96/* Send a catch_exception_raise message including the identity.
97 */
98
99# define EXCEPTION_STATE 2
100/* Send a catch_exception_raise_state message including the
101 * thread state.
102 */
103
104# define EXCEPTION_STATE_IDENTITY 3
105/* Send a catch_exception_raise_state_identity message including
106 * the thread identity and state.
107 */
108
109/*
110 * Masks for exception definitions, above
111 * bit zero is unused, therefore 1 word = 31 exception types
112 */
113
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)
123
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 | \
130 EXC_MASK_SYSCALL | \
131 EXC_MASK_MACH_SYSCALL | \
132 EXC_MASK_RPC_ALERT | \
133 EXC_MASK_MACHINE)
134
135
136#define FIRST_EXCEPTION 1 /* ZERO is illegal */
137
9bccf70c
A
138/*
139 * Machine independent codes for EXC_SOFTWARE
140 * Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix)
141 * 0x10000 - 0x10002 in use for unix signals
142 */
143#define EXC_SOFT_SIGNAL 0x10003 /* Unix signal exceptions */
144
1c79356b
A
145#ifndef ASSEMBLER
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 */
164#endif /* _MACH_EXCEPTION_TYPES_H_ */