No empty .Rs/.Re
[netbsd-mini2440.git] / sys / compat / mach / mach_exception.h
blob04a8fa9f1e18967a1f844d2765d042ca41c1993f
1 /* $NetBSD: mach_exception.h,v 1.7 2007/02/09 21:55:21 ad Exp $ */
3 /*-
4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Emmanuel Dreyfus
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _MACH_EXCEPTION_H_
33 #define _MACH_EXCEPTION_H_
35 /* really should be in mach_signal.h or siginfo.h */
36 #define MACH_BUS_ADRALN 1
38 #define MACH_SEGV_MAPERR 1
39 #define MACH_SEGV_ACCERR 2
41 #define MACH_TRAP_BRKPT 1
43 #define MACH_ILL_ILLOPC 1
44 #define MACH_ILL_ILLTRP 2
45 #define MACH_ILL_PRVOPC 3
47 #define MACH_EXC_BAD_ACCESS 1
48 #define MACH_EXC_BAD_INSTRUCTION 2
49 #define MACH_EXC_ARITHMETIC 3
50 #define MACH_EXC_EMULATION 4
51 #define MACH_EXC_SOFTWARE 5
52 #define MACH_EXC_BREAKPOINT 6
53 #define MACH_EXC_SYSCALL 7
54 #define MACH_EXC_MACH_SYSCALL 8
55 #define MACH_EXC_RPC_ALERT 9
56 #define MACH_EXC_MAX MACH_EXC_RPC_ALERT
58 #define MACH_EXC_MASK_BAD_ACCESS (1 << MACH_EXC_BAD_ACCESS)
59 #define MACH_EXC_MASK_BAD_INSTRUCTION (1 << MACH_EXC_BAD_INSTRUCTION)
60 #define MACH_EXC_MASK_ARITHMETIC (1 << MACH_EXC_ARITHMETIC)
61 #define MACH_EXC_MASK_EMULATION (1 << MACH_EXC_EMULATION)
62 #define MACH_EXC_MASK_SOFTWARE (1 << MACH_EXC_SOFTWARE)
63 #define MACH_EXC_MASK_BREAKPOINT (1 << MACH_EXC_BREAKPOINT)
64 #define MACH_EXC_MASK_SYSCALL (1 << MACH_EXC_SYSCALL)
65 #define MACH_EXC_MASK_MACH_SYSCALL (1 << MACH_EXC_MACH_SYSCALL)
66 #define MACH_EXC_MASK_RPC_ALERT (1 << MACH_EXC_RPC_ALERT)
69 * Exception codes. Values < 0x10000 are machine dependent, and
70 * are defined in sys/<arch>/include/mach_machdep.h.
72 #define MACH_EXC_UNIX_BAD_SYSCALL 0x10000 /* unused ? */
73 #define MACH_EXC_UNIX_BAD_PIPE 0x10001 /* unused ? */
74 #define MACH_EXC_UNIX_ABORT 0x10002 /* unused ? */
75 #define MACH_SOFT_SIGNAL 0x10003
77 /* Exception behaviors and associated messages Id */
79 #define MACH_EXCEPTION_DEFAULT 1
80 #define MACH_EXCEPTION_STATE 2
81 #define MACH_EXCEPTION_STATE_IDENTITY 3
83 #define MACH_EXC_RAISE_MSGID 2401
84 #define MACH_EXC_RAISE_STATE_MSGID 2402
85 #define MACH_EXC_RAISE_STATE_IDENTITY_MSGID 2403
87 /* exception_raise. The kernel is the client, not the server */
89 typedef struct {
90 mach_msg_header_t req_msgh;
91 mach_msg_body_t req_body;
92 mach_msg_port_descriptor_t req_thread;
93 mach_msg_port_descriptor_t req_task;
94 mach_ndr_record_t req_ndr;
95 mach_exception_type_t req_exc;
96 mach_msg_type_number_t req_codecount;
97 mach_integer_t req_code[2];
98 mach_msg_trailer_t req_trailer;
99 } mach_exception_raise_request_t;
101 typedef struct {
102 mach_msg_header_t rep_msgh;
103 mach_ndr_record_t rep_ndr;
104 mach_kern_return_t rep_retval;
105 } mach_exception_raise_reply_t;
107 /* exception_raise_state. The kernel is the client, not the server */
109 typedef struct {
110 mach_msg_header_t req_msgh;
111 mach_ndr_record_t req_ndr;
112 mach_exception_type_t req_exc;
113 mach_msg_type_number_t req_codecount;
114 mach_integer_t req_code[2];
115 int req_flavor;
116 mach_msg_type_number_t req_statecount;
117 mach_natural_t req_state[144];
118 mach_msg_trailer_t req_trailer;
119 } mach_exception_raise_state_request_t;
121 typedef struct {
122 mach_msg_header_t rep_msgh;
123 mach_ndr_record_t rep_ndr;
124 mach_kern_return_t rep_retval;
125 } mach_exception_raise_state_reply_t;
127 /* exception_raise_state_identity. The kernel is the client, not the server */
129 typedef struct {
130 mach_msg_header_t req_msgh;
131 mach_msg_body_t req_body;
132 mach_msg_port_descriptor_t req_thread;
133 mach_msg_port_descriptor_t req_task;
134 mach_ndr_record_t req_ndr;
135 mach_exception_type_t req_exc;
136 mach_msg_type_number_t req_codecount;
137 mach_integer_t req_code[2];
138 int req_flavor;
139 mach_msg_type_number_t req_statecount;
140 mach_natural_t req_state[144];
141 mach_msg_trailer_t req_trailer;
142 } mach_exception_raise_state_identity_request_t;
144 typedef struct {
145 mach_msg_header_t rep_msgh;
146 mach_ndr_record_t rep_ndr;
147 mach_kern_return_t rep_retval;
148 } mach_exception_raise_state_identity_reply_t;
150 struct mach_exc_info {
151 int mei_flavor;
152 int mei_behavior;
155 void mach_trapsignal(struct lwp *, struct ksiginfo *);
156 int mach_trapsignal1(struct lwp *, struct ksiginfo *);
157 int mach_exception(struct lwp *, int, int *);
159 #endif /* _MACH_EXCEPTION_H_ */