1 | #ifndef _exc_server_ |
2 | #define _exc_server_ |
3 | |
4 | /* Module exc */ |
5 | |
6 | #include <string.h> |
7 | #include <mach/ndr.h> |
8 | #include <mach/boolean.h> |
9 | #include <mach/kern_return.h> |
10 | #include <mach/notify.h> |
11 | #include <mach/mach_types.h> |
12 | #include <mach/message.h> |
13 | #include <mach/mig_errors.h> |
14 | #include <mach/port.h> |
15 | |
16 | /* BEGIN MIG_STRNCPY_ZEROFILL CODE */ |
17 | |
18 | #if defined(__has_include) |
19 | #if __has_include(<mach/mig_strncpy_zerofill_support.h>) |
20 | #ifndef USING_MIG_STRNCPY_ZEROFILL |
21 | #define USING_MIG_STRNCPY_ZEROFILL |
22 | #endif |
23 | #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
24 | #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
25 | #ifdef __cplusplus |
26 | extern "C" { |
27 | #endif |
28 | extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); |
29 | #ifdef __cplusplus |
30 | } |
31 | #endif |
32 | #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ |
33 | #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */ |
34 | #endif /* __has_include */ |
35 | |
36 | /* END MIG_STRNCPY_ZEROFILL CODE */ |
37 | |
38 | |
39 | #ifdef AUTOTEST |
40 | #ifndef FUNCTION_PTR_T |
41 | #define FUNCTION_PTR_T |
42 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
43 | typedef struct { |
44 | char *name; |
45 | function_ptr_t function; |
46 | } function_table_entry; |
47 | typedef function_table_entry *function_table_t; |
48 | #endif /* FUNCTION_PTR_T */ |
49 | #endif /* AUTOTEST */ |
50 | |
51 | #ifndef exc_MSG_COUNT |
52 | #define exc_MSG_COUNT 3 |
53 | #endif /* exc_MSG_COUNT */ |
54 | |
55 | #include <mach/std_types.h> |
56 | #include <mach/mig.h> |
57 | #include <mach/mig.h> |
58 | #include <mach/mach_types.h> |
59 | |
60 | #ifdef __BeforeMigServerHeader |
61 | __BeforeMigServerHeader |
62 | #endif /* __BeforeMigServerHeader */ |
63 | |
64 | |
65 | /* Routine exception_raise */ |
66 | #ifdef mig_external |
67 | mig_external |
68 | #else |
69 | extern |
70 | #endif /* mig_external */ |
71 | kern_return_t catch_exception_raise |
72 | ( |
73 | mach_port_t exception_port, |
74 | mach_port_t thread, |
75 | mach_port_t task, |
76 | exception_type_t exception, |
77 | exception_data_t code, |
78 | mach_msg_type_number_t codeCnt |
79 | ); |
80 | |
81 | /* Routine exception_raise_state */ |
82 | #ifdef mig_external |
83 | mig_external |
84 | #else |
85 | extern |
86 | #endif /* mig_external */ |
87 | kern_return_t catch_exception_raise_state |
88 | ( |
89 | mach_port_t exception_port, |
90 | exception_type_t exception, |
91 | const exception_data_t code, |
92 | mach_msg_type_number_t codeCnt, |
93 | int *flavor, |
94 | const thread_state_t old_state, |
95 | mach_msg_type_number_t old_stateCnt, |
96 | thread_state_t new_state, |
97 | mach_msg_type_number_t *new_stateCnt |
98 | ); |
99 | |
100 | /* Routine exception_raise_state_identity */ |
101 | #ifdef mig_external |
102 | mig_external |
103 | #else |
104 | extern |
105 | #endif /* mig_external */ |
106 | kern_return_t catch_exception_raise_state_identity |
107 | ( |
108 | mach_port_t exception_port, |
109 | mach_port_t thread, |
110 | mach_port_t task, |
111 | exception_type_t exception, |
112 | exception_data_t code, |
113 | mach_msg_type_number_t codeCnt, |
114 | int *flavor, |
115 | thread_state_t old_state, |
116 | mach_msg_type_number_t old_stateCnt, |
117 | thread_state_t new_state, |
118 | mach_msg_type_number_t *new_stateCnt |
119 | ); |
120 | |
121 | #ifdef mig_external |
122 | mig_external |
123 | #else |
124 | extern |
125 | #endif /* mig_external */ |
126 | boolean_t exc_server( |
127 | mach_msg_header_t *InHeadP, |
128 | mach_msg_header_t *OutHeadP); |
129 | |
130 | #ifdef mig_external |
131 | mig_external |
132 | #else |
133 | extern |
134 | #endif /* mig_external */ |
135 | mig_routine_t exc_server_routine( |
136 | mach_msg_header_t *InHeadP); |
137 | |
138 | |
139 | /* Description of this subsystem, for use in direct RPC */ |
140 | extern const struct catch_exc_subsystem { |
141 | mig_server_routine_t server; /* Server routine */ |
142 | mach_msg_id_t start; /* Min routine number */ |
143 | mach_msg_id_t end; /* Max routine number + 1 */ |
144 | unsigned int maxsize; /* Max msg size */ |
145 | vm_address_t reserved; /* Reserved */ |
146 | struct routine_descriptor /*Array of routine descriptors */ |
147 | routine[3]; |
148 | } catch_exc_subsystem; |
149 | |
150 | /* typedefs for all requests */ |
151 | |
152 | #ifndef __Request__exc_subsystem__defined |
153 | #define __Request__exc_subsystem__defined |
154 | |
155 | #ifdef __MigPackStructs |
156 | #pragma pack(4) |
157 | #endif |
158 | typedef struct { |
159 | mach_msg_header_t Head; |
160 | /* start of the kernel processed data */ |
161 | mach_msg_body_t msgh_body; |
162 | mach_msg_port_descriptor_t thread; |
163 | mach_msg_port_descriptor_t task; |
164 | /* end of the kernel processed data */ |
165 | NDR_record_t NDR; |
166 | exception_type_t exception; |
167 | mach_msg_type_number_t codeCnt; |
168 | integer_t code[2]; |
169 | } __Request__exception_raise_t __attribute__((unused)); |
170 | #ifdef __MigPackStructs |
171 | #pragma pack() |
172 | #endif |
173 | |
174 | #ifdef __MigPackStructs |
175 | #pragma pack(4) |
176 | #endif |
177 | typedef struct { |
178 | mach_msg_header_t Head; |
179 | NDR_record_t NDR; |
180 | exception_type_t exception; |
181 | mach_msg_type_number_t codeCnt; |
182 | integer_t code[2]; |
183 | int flavor; |
184 | mach_msg_type_number_t old_stateCnt; |
185 | natural_t old_state[614]; |
186 | } __Request__exception_raise_state_t __attribute__((unused)); |
187 | #ifdef __MigPackStructs |
188 | #pragma pack() |
189 | #endif |
190 | |
191 | #ifdef __MigPackStructs |
192 | #pragma pack(4) |
193 | #endif |
194 | typedef struct { |
195 | mach_msg_header_t Head; |
196 | /* start of the kernel processed data */ |
197 | mach_msg_body_t msgh_body; |
198 | mach_msg_port_descriptor_t thread; |
199 | mach_msg_port_descriptor_t task; |
200 | /* end of the kernel processed data */ |
201 | NDR_record_t NDR; |
202 | exception_type_t exception; |
203 | mach_msg_type_number_t codeCnt; |
204 | integer_t code[2]; |
205 | int flavor; |
206 | mach_msg_type_number_t old_stateCnt; |
207 | natural_t old_state[614]; |
208 | } __Request__exception_raise_state_identity_t __attribute__((unused)); |
209 | #ifdef __MigPackStructs |
210 | #pragma pack() |
211 | #endif |
212 | #endif /* !__Request__exc_subsystem__defined */ |
213 | |
214 | |
215 | /* union of all requests */ |
216 | |
217 | #ifndef __RequestUnion__catch_exc_subsystem__defined |
218 | #define __RequestUnion__catch_exc_subsystem__defined |
219 | union __RequestUnion__catch_exc_subsystem { |
220 | __Request__exception_raise_t Request_exception_raise; |
221 | __Request__exception_raise_state_t Request_exception_raise_state; |
222 | __Request__exception_raise_state_identity_t Request_exception_raise_state_identity; |
223 | }; |
224 | #endif /* __RequestUnion__catch_exc_subsystem__defined */ |
225 | /* typedefs for all replies */ |
226 | |
227 | #ifndef __Reply__exc_subsystem__defined |
228 | #define __Reply__exc_subsystem__defined |
229 | |
230 | #ifdef __MigPackStructs |
231 | #pragma pack(4) |
232 | #endif |
233 | typedef struct { |
234 | mach_msg_header_t Head; |
235 | NDR_record_t NDR; |
236 | kern_return_t RetCode; |
237 | } __Reply__exception_raise_t __attribute__((unused)); |
238 | #ifdef __MigPackStructs |
239 | #pragma pack() |
240 | #endif |
241 | |
242 | #ifdef __MigPackStructs |
243 | #pragma pack(4) |
244 | #endif |
245 | typedef struct { |
246 | mach_msg_header_t Head; |
247 | NDR_record_t NDR; |
248 | kern_return_t RetCode; |
249 | int flavor; |
250 | mach_msg_type_number_t new_stateCnt; |
251 | natural_t new_state[614]; |
252 | } __Reply__exception_raise_state_t __attribute__((unused)); |
253 | #ifdef __MigPackStructs |
254 | #pragma pack() |
255 | #endif |
256 | |
257 | #ifdef __MigPackStructs |
258 | #pragma pack(4) |
259 | #endif |
260 | typedef struct { |
261 | mach_msg_header_t Head; |
262 | NDR_record_t NDR; |
263 | kern_return_t RetCode; |
264 | int flavor; |
265 | mach_msg_type_number_t new_stateCnt; |
266 | natural_t new_state[614]; |
267 | } __Reply__exception_raise_state_identity_t __attribute__((unused)); |
268 | #ifdef __MigPackStructs |
269 | #pragma pack() |
270 | #endif |
271 | #endif /* !__Reply__exc_subsystem__defined */ |
272 | |
273 | |
274 | /* union of all replies */ |
275 | |
276 | #ifndef __ReplyUnion__catch_exc_subsystem__defined |
277 | #define __ReplyUnion__catch_exc_subsystem__defined |
278 | union __ReplyUnion__catch_exc_subsystem { |
279 | __Reply__exception_raise_t Reply_exception_raise; |
280 | __Reply__exception_raise_state_t Reply_exception_raise_state; |
281 | __Reply__exception_raise_state_identity_t Reply_exception_raise_state_identity; |
282 | }; |
283 | #endif /* __RequestUnion__catch_exc_subsystem__defined */ |
284 | |
285 | #ifndef subsystem_to_name_map_exc |
286 | #define subsystem_to_name_map_exc \ |
287 | { "exception_raise", 2401 },\ |
288 | { "exception_raise_state", 2402 },\ |
289 | { "exception_raise_state_identity", 2403 } |
290 | #endif |
291 | |
292 | #ifdef __AfterMigServerHeader |
293 | __AfterMigServerHeader |
294 | #endif /* __AfterMigServerHeader */ |
295 | |
296 | #endif /* _exc_server_ */ |
297 | |