1/*
2 * IDENTIFICATION:
3 * stub generated by bootstrap_cmds-133
4 * OPTIONS:
5 * KernelUser
6 */
7#define __MIG_check__Reply__mach_exc_subsystem__ 1
8
9#include "mach_exc.h"
10
11/* TODO: #include <mach/mach.h> */
12#ifdef __cplusplus
13extern "C" {
14#endif /* __cplusplus */
15extern void mach_msg_destroy(mach_msg_header_t *);
16#ifdef __cplusplus
17}
18#endif /* __cplusplus */
19
20#ifndef mig_internal
21#define mig_internal static __inline__
22#endif /* mig_internal */
23
24#ifndef mig_external
25#define mig_external
26#endif /* mig_external */
27
28#if !defined(__MigTypeCheck) && defined(TypeCheck)
29#define __MigTypeCheck TypeCheck /* Legacy setting */
30#endif /* !defined(__MigTypeCheck) */
31
32#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
33#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */
34#endif /* !defined(__MigKernelSpecificCode) */
35
36#ifndef LimitCheck
37#define LimitCheck 0
38#endif /* LimitCheck */
39
40#ifndef min
41#define min(a,b) ( ((a) < (b))? (a): (b) )
42#endif /* min */
43
44#if !defined(_WALIGN_)
45#define _WALIGN_(x) (((x) + 3) & ~3)
46#endif /* !defined(_WALIGN_) */
47
48#if !defined(_WALIGNSZ_)
49#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
50#endif /* !defined(_WALIGNSZ_) */
51
52#ifndef UseStaticTemplates
53#define UseStaticTemplates 0
54#endif /* UseStaticTemplates */
55
56#ifndef MIG_SERVER_ROUTINE
57#define MIG_SERVER_ROUTINE
58#endif
59
60#ifndef __MachMsgErrorWithTimeout
61#define __MachMsgErrorWithTimeout(_R_) { \
62 switch (_R_) { \
63 case MACH_SEND_INVALID_DATA: \
64 case MACH_SEND_INVALID_DEST: \
65 case MACH_SEND_INVALID_HEADER: \
66 mig_put_reply_port(InP->Head.msgh_reply_port); \
67 break; \
68 case MACH_SEND_TIMED_OUT: \
69 case MACH_RCV_TIMED_OUT: \
70 default: \
71 mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
72 } \
73}
74#endif /* __MachMsgErrorWithTimeout */
75
76#ifndef __MachMsgErrorWithoutTimeout
77#define __MachMsgErrorWithoutTimeout(_R_) { \
78 switch (_R_) { \
79 case MACH_SEND_INVALID_DATA: \
80 case MACH_SEND_INVALID_DEST: \
81 case MACH_SEND_INVALID_HEADER: \
82 mig_put_reply_port(InP->Head.msgh_reply_port); \
83 break; \
84 default: \
85 mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
86 } \
87}
88#endif /* __MachMsgErrorWithoutTimeout */
89
90#ifndef __DeclareSendRpc
91#define __DeclareSendRpc(_NUM_, _NAME_)
92#endif /* __DeclareSendRpc */
93
94#ifndef __BeforeSendRpc
95#define __BeforeSendRpc(_NUM_, _NAME_)
96#endif /* __BeforeSendRpc */
97
98#ifndef __AfterSendRpc
99#define __AfterSendRpc(_NUM_, _NAME_)
100#endif /* __AfterSendRpc */
101
102#ifndef __DeclareSendSimple
103#define __DeclareSendSimple(_NUM_, _NAME_)
104#endif /* __DeclareSendSimple */
105
106#ifndef __BeforeSendSimple
107#define __BeforeSendSimple(_NUM_, _NAME_)
108#endif /* __BeforeSendSimple */
109
110#ifndef __AfterSendSimple
111#define __AfterSendSimple(_NUM_, _NAME_)
112#endif /* __AfterSendSimple */
113
114#define msgh_request_port msgh_remote_port
115#define msgh_reply_port msgh_local_port
116
117
118
119#if ( __MigTypeCheck )
120#if __MIG_check__Reply__mach_exc_subsystem__
121#if !defined(__MIG_check__Reply__mach_exception_raise_t__defined)
122#define __MIG_check__Reply__mach_exception_raise_t__defined
123
124mig_internal kern_return_t __MIG_check__Reply__mach_exception_raise_t(__Reply__mach_exception_raise_t *Out0P)
125{
126
127 typedef __Reply__mach_exception_raise_t __Reply __attribute__((unused));
128 if (Out0P->Head.msgh_id != 2505) {
129 if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
130 { return MIG_SERVER_DIED; }
131 else
132 { return MIG_REPLY_MISMATCH; }
133 }
134
135#if __MigTypeCheck
136 if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
137 (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply)))
138 { return MIG_TYPE_ERROR ; }
139#endif /* __MigTypeCheck */
140
141#if __MigTypeCheck
142 if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) {
143 return MIG_TYPE_ERROR;
144 }
145#endif /* __MigTypeCheck */
146 {
147 return Out0P->RetCode;
148 }
149}
150#endif /* !defined(__MIG_check__Reply__mach_exception_raise_t__defined) */
151#endif /* __MIG_check__Reply__mach_exc_subsystem__ */
152#endif /* ( __MigTypeCheck ) */
153
154
155/* Routine mach_exception_raise */
156mig_external kern_return_t mach_exception_raise
157(
158 mach_port_t exception_port,
159 mach_port_t thread,
160 mach_port_t task,
161 exception_type_t exception,
162 mach_exception_data_t code,
163 mach_msg_type_number_t codeCnt
164)
165{
166
167#ifdef __MigPackStructs
168#pragma pack(push, 4)
169#endif
170 typedef struct {
171 mach_msg_header_t Head;
172 /* start of the kernel processed data */
173 mach_msg_body_t msgh_body;
174 mach_msg_port_descriptor_t thread;
175 mach_msg_port_descriptor_t task;
176 /* end of the kernel processed data */
177 NDR_record_t NDR;
178 exception_type_t exception;
179 mach_msg_type_number_t codeCnt;
180 int64_t code[2];
181 } Request __attribute__((unused));
182#ifdef __MigPackStructs
183#pragma pack(pop)
184#endif
185
186#ifdef __MigPackStructs
187#pragma pack(push, 4)
188#endif
189 typedef struct {
190 mach_msg_header_t Head;
191 NDR_record_t NDR;
192 kern_return_t RetCode;
193 mach_msg_trailer_t trailer;
194 } Reply __attribute__((unused));
195#ifdef __MigPackStructs
196#pragma pack(pop)
197#endif
198
199#ifdef __MigPackStructs
200#pragma pack(push, 4)
201#endif
202 typedef struct {
203 mach_msg_header_t Head;
204 NDR_record_t NDR;
205 kern_return_t RetCode;
206 } __Reply __attribute__((unused));
207#ifdef __MigPackStructs
208#pragma pack(pop)
209#endif
210 /*
211 * typedef struct {
212 * mach_msg_header_t Head;
213 * NDR_record_t NDR;
214 * kern_return_t RetCode;
215 * } mig_reply_error_t;
216 */
217
218 union {
219 Request In;
220 Reply Out;
221 } Mess;
222
223 Request *InP = &Mess.In;
224 Reply *Out0P = &Mess.Out;
225
226 mach_msg_return_t msg_result;
227 unsigned int msgh_size;
228
229#ifdef __MIG_check__Reply__mach_exception_raise_t__defined
230 kern_return_t check_result;
231#endif /* __MIG_check__Reply__mach_exception_raise_t__defined */
232
233 __DeclareSendRpc(2405, "mach_exception_raise")
234
235#if UseStaticTemplates
236 const static mach_msg_port_descriptor_t threadTemplate = {
237 /* name = */ MACH_PORT_NULL,
238 /* pad1 = */ 0,
239 /* pad2 = */ 0,
240 /* disp = */ 19,
241 /* type = */ MACH_MSG_PORT_DESCRIPTOR,
242 };
243#endif /* UseStaticTemplates */
244
245#if UseStaticTemplates
246 const static mach_msg_port_descriptor_t taskTemplate = {
247 /* name = */ MACH_PORT_NULL,
248 /* pad1 = */ 0,
249 /* pad2 = */ 0,
250 /* disp = */ 19,
251 /* type = */ MACH_MSG_PORT_DESCRIPTOR,
252 };
253#endif /* UseStaticTemplates */
254
255 InP->msgh_body.msgh_descriptor_count = 2;
256#if UseStaticTemplates
257 InP->thread = threadTemplate;
258 InP->thread.name = thread;
259#else /* UseStaticTemplates */
260 InP->thread.name = thread;
261 InP->thread.disposition = 19;
262 InP->thread.type = MACH_MSG_PORT_DESCRIPTOR;
263#endif /* UseStaticTemplates */
264
265#if UseStaticTemplates
266 InP->task = taskTemplate;
267 InP->task.name = task;
268#else /* UseStaticTemplates */
269 InP->task.name = task;
270 InP->task.disposition = 19;
271 InP->task.type = MACH_MSG_PORT_DESCRIPTOR;
272#endif /* UseStaticTemplates */
273
274 InP->NDR = NDR_record;
275
276 InP->exception = exception;
277
278 if (codeCnt > 2) {
279 { return MIG_ARRAY_TOO_LARGE; }
280 }
281 (void)memcpy(dst: (char *) InP->code, src: (const char *) code, n: 8 * codeCnt);
282
283 InP->codeCnt = codeCnt;
284
285 msgh_size = (mach_msg_size_t)(sizeof(Request) - 16) + ((8 * codeCnt));
286 InP->Head.msgh_reply_port = mig_get_reply_port();
287 InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX|
288 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
289 /* msgh_size passed as argument */
290 InP->Head.msgh_request_port = exception_port;
291 InP->Head.msgh_id = 2405;
292 InP->Head.msgh_reserved = 0;
293
294 __BeforeSendRpc(2405, "mach_exception_raise")
295#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
296 msg_result = mach_msg_rpc_from_kernel(msg: &InP->Head, send_size: msgh_size, rcv_size: (mach_msg_size_t)sizeof(Reply));
297#else
298 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
299#endif /* __MigKernelSpecificCode */
300 __AfterSendRpc(2405, "mach_exception_raise")
301 if (msg_result != MACH_MSG_SUCCESS) {
302 __MachMsgErrorWithoutTimeout(msg_result);
303 }
304 if (msg_result != MACH_MSG_SUCCESS) {
305 { return msg_result; }
306 }
307
308
309#if defined(__MIG_check__Reply__mach_exception_raise_t__defined)
310 check_result = __MIG_check__Reply__mach_exception_raise_t(Out0P: (__Reply__mach_exception_raise_t *)Out0P);
311 if (check_result != MACH_MSG_SUCCESS) {
312#if __MigKernelSpecificCode
313 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
314#endif /* __MigKernelSpecificCode */
315 { return check_result; }
316 }
317#endif /* defined(__MIG_check__Reply__mach_exception_raise_t__defined) */
318
319 return KERN_SUCCESS;
320}
321
322#if ( __MigTypeCheck )
323#if __MIG_check__Reply__mach_exc_subsystem__
324#if !defined(__MIG_check__Reply__mach_exception_raise_state_t__defined)
325#define __MIG_check__Reply__mach_exception_raise_state_t__defined
326
327mig_internal kern_return_t __MIG_check__Reply__mach_exception_raise_state_t(__Reply__mach_exception_raise_state_t *Out0P)
328{
329
330 typedef __Reply__mach_exception_raise_state_t __Reply __attribute__((unused));
331#if __MigTypeCheck
332 unsigned int msgh_size;
333#endif /* __MigTypeCheck */
334
335 if (Out0P->Head.msgh_id != 2506) {
336 if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
337 { return MIG_SERVER_DIED; }
338 else
339 { return MIG_REPLY_MISMATCH; }
340 }
341
342#if __MigTypeCheck
343 msgh_size = Out0P->Head.msgh_size;
344
345 if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
346 ((msgh_size > (mach_msg_size_t)sizeof(__Reply) || msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 5184)) &&
347 (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
348 Out0P->RetCode == KERN_SUCCESS)))
349 { return MIG_TYPE_ERROR ; }
350#endif /* __MigTypeCheck */
351
352#if __MigTypeCheck
353 if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) {
354 return MIG_TYPE_ERROR;
355 }
356#endif /* __MigTypeCheck */
357 if (Out0P->RetCode != KERN_SUCCESS) {
358 return ((mig_reply_error_t *)Out0P)->RetCode;
359 }
360
361#if __MigTypeCheck
362 if ( Out0P->new_stateCnt > 1296 )
363 return MIG_TYPE_ERROR;
364 if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 5184)) / 4< Out0P->new_stateCnt) ||
365 (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 5184) + Out0P->new_stateCnt * 4))
366 { return MIG_TYPE_ERROR ; }
367#endif /* __MigTypeCheck */
368
369 return MACH_MSG_SUCCESS;
370}
371#endif /* !defined(__MIG_check__Reply__mach_exception_raise_state_t__defined) */
372#endif /* __MIG_check__Reply__mach_exc_subsystem__ */
373#endif /* ( __MigTypeCheck ) */
374
375
376/* Routine mach_exception_raise_state */
377mig_external kern_return_t mach_exception_raise_state
378(
379 mach_port_t exception_port,
380 exception_type_t exception,
381 const mach_exception_data_t code,
382 mach_msg_type_number_t codeCnt,
383 int *flavor,
384 const thread_state_t old_state,
385 mach_msg_type_number_t old_stateCnt,
386 thread_state_t new_state,
387 mach_msg_type_number_t *new_stateCnt
388)
389{
390
391#ifdef __MigPackStructs
392#pragma pack(push, 4)
393#endif
394 typedef struct {
395 mach_msg_header_t Head;
396 NDR_record_t NDR;
397 exception_type_t exception;
398 mach_msg_type_number_t codeCnt;
399 int64_t code[2];
400 int flavor;
401 mach_msg_type_number_t old_stateCnt;
402 natural_t old_state[1296];
403 } Request __attribute__((unused));
404#ifdef __MigPackStructs
405#pragma pack(pop)
406#endif
407
408#ifdef __MigPackStructs
409#pragma pack(push, 4)
410#endif
411 typedef struct {
412 mach_msg_header_t Head;
413 NDR_record_t NDR;
414 kern_return_t RetCode;
415 int flavor;
416 mach_msg_type_number_t new_stateCnt;
417 natural_t new_state[1296];
418 mach_msg_trailer_t trailer;
419 } Reply __attribute__((unused));
420#ifdef __MigPackStructs
421#pragma pack(pop)
422#endif
423
424#ifdef __MigPackStructs
425#pragma pack(push, 4)
426#endif
427 typedef struct {
428 mach_msg_header_t Head;
429 NDR_record_t NDR;
430 kern_return_t RetCode;
431 int flavor;
432 mach_msg_type_number_t new_stateCnt;
433 natural_t new_state[1296];
434 } __Reply __attribute__((unused));
435#ifdef __MigPackStructs
436#pragma pack(pop)
437#endif
438 /*
439 * typedef struct {
440 * mach_msg_header_t Head;
441 * NDR_record_t NDR;
442 * kern_return_t RetCode;
443 * } mig_reply_error_t;
444 */
445
446 union mach_exception_raise_stateMessU {
447 Request In;
448 Reply Out;
449 } *Mess = (union mach_exception_raise_stateMessU *) mig_user_allocate(size: sizeof(*Mess));
450
451 Request *InP = &Mess->In;
452 Reply *Out0P = &Mess->Out;
453
454 mach_msg_return_t msg_result;
455 unsigned int msgh_size;
456 unsigned int msgh_size_delta;
457
458
459#ifdef __MIG_check__Reply__mach_exception_raise_state_t__defined
460 kern_return_t check_result;
461#endif /* __MIG_check__Reply__mach_exception_raise_state_t__defined */
462
463 __DeclareSendRpc(2406, "mach_exception_raise_state")
464
465 InP->NDR = NDR_record;
466
467 InP->exception = exception;
468
469 if (codeCnt > 2) {
470 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; }
471 }
472 (void)memcpy(dst: (char *) InP->code, src: (const char *) code, n: 8 * codeCnt);
473
474 InP->codeCnt = codeCnt;
475
476 msgh_size_delta = (8 * codeCnt);
477 msgh_size = (mach_msg_size_t)(sizeof(Request) - 5200) + msgh_size_delta;
478 InP = (Request *) ((pointer_t) InP + msgh_size_delta - 16);
479
480 InP->flavor = *flavor;
481
482 if (old_stateCnt > 1296) {
483 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; }
484 }
485 (void)memcpy(dst: (char *) InP->old_state, src: (const char *) old_state, n: 4 * old_stateCnt);
486
487 InP->old_stateCnt = old_stateCnt;
488
489 msgh_size += (4 * old_stateCnt);
490 InP = &Mess->In;
491 InP->Head.msgh_reply_port = mig_get_reply_port();
492 InP->Head.msgh_bits =
493 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
494 /* msgh_size passed as argument */
495 InP->Head.msgh_request_port = exception_port;
496 InP->Head.msgh_id = 2406;
497 InP->Head.msgh_reserved = 0;
498
499 __BeforeSendRpc(2406, "mach_exception_raise_state")
500#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
501 msg_result = mach_msg_rpc_from_kernel(msg: &InP->Head, send_size: msgh_size, rcv_size: (mach_msg_size_t)sizeof(Reply));
502#else
503 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
504#endif /* __MigKernelSpecificCode */
505 __AfterSendRpc(2406, "mach_exception_raise_state")
506 if (msg_result != MACH_MSG_SUCCESS) {
507 __MachMsgErrorWithoutTimeout(msg_result);
508 }
509 if (msg_result != MACH_MSG_SUCCESS) {
510 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return msg_result; }
511 }
512
513
514#if defined(__MIG_check__Reply__mach_exception_raise_state_t__defined)
515 check_result = __MIG_check__Reply__mach_exception_raise_state_t(Out0P: (__Reply__mach_exception_raise_state_t *)Out0P);
516 if (check_result != MACH_MSG_SUCCESS) {
517#if __MigKernelSpecificCode
518 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
519#endif /* __MigKernelSpecificCode */
520 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return check_result; }
521 }
522#endif /* defined(__MIG_check__Reply__mach_exception_raise_state_t__defined) */
523
524 *flavor = Out0P->flavor;
525
526 if (Out0P->new_stateCnt > 1296) {
527 (void)memcpy(dst: (char *) new_state, src: (const char *) Out0P->new_state, n: 4 * 1296);
528 *new_stateCnt = Out0P->new_stateCnt;
529 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; }
530 }
531 (void)memcpy(dst: (char *) new_state, src: (const char *) Out0P->new_state, n: 4 * Out0P->new_stateCnt);
532
533 *new_stateCnt = Out0P->new_stateCnt;
534
535 { mig_user_deallocate(data: (char *) Mess, size: sizeof(*Mess)); return KERN_SUCCESS; }
536}
537
538#if ( __MigTypeCheck )
539#if __MIG_check__Reply__mach_exc_subsystem__
540#if !defined(__MIG_check__Reply__mach_exception_raise_state_identity_t__defined)
541#define __MIG_check__Reply__mach_exception_raise_state_identity_t__defined
542
543mig_internal kern_return_t __MIG_check__Reply__mach_exception_raise_state_identity_t(__Reply__mach_exception_raise_state_identity_t *Out0P)
544{
545
546 typedef __Reply__mach_exception_raise_state_identity_t __Reply __attribute__((unused));
547#if __MigTypeCheck
548 unsigned int msgh_size;
549#endif /* __MigTypeCheck */
550
551 if (Out0P->Head.msgh_id != 2507) {
552 if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
553 { return MIG_SERVER_DIED; }
554 else
555 { return MIG_REPLY_MISMATCH; }
556 }
557
558#if __MigTypeCheck
559 msgh_size = Out0P->Head.msgh_size;
560
561 if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
562 ((msgh_size > (mach_msg_size_t)sizeof(__Reply) || msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 5184)) &&
563 (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
564 Out0P->RetCode == KERN_SUCCESS)))
565 { return MIG_TYPE_ERROR ; }
566#endif /* __MigTypeCheck */
567
568#if __MigTypeCheck
569 if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) {
570 return MIG_TYPE_ERROR;
571 }
572#endif /* __MigTypeCheck */
573 if (Out0P->RetCode != KERN_SUCCESS) {
574 return ((mig_reply_error_t *)Out0P)->RetCode;
575 }
576
577#if __MigTypeCheck
578 if ( Out0P->new_stateCnt > 1296 )
579 return MIG_TYPE_ERROR;
580 if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 5184)) / 4< Out0P->new_stateCnt) ||
581 (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 5184) + Out0P->new_stateCnt * 4))
582 { return MIG_TYPE_ERROR ; }
583#endif /* __MigTypeCheck */
584
585 return MACH_MSG_SUCCESS;
586}
587#endif /* !defined(__MIG_check__Reply__mach_exception_raise_state_identity_t__defined) */
588#endif /* __MIG_check__Reply__mach_exc_subsystem__ */
589#endif /* ( __MigTypeCheck ) */
590
591
592/* Routine mach_exception_raise_state_identity */
593mig_external kern_return_t mach_exception_raise_state_identity
594(
595 mach_port_t exception_port,
596 mach_port_t thread,
597 mach_port_t task,
598 exception_type_t exception,
599 mach_exception_data_t code,
600 mach_msg_type_number_t codeCnt,
601 int *flavor,
602 thread_state_t old_state,
603 mach_msg_type_number_t old_stateCnt,
604 thread_state_t new_state,
605 mach_msg_type_number_t *new_stateCnt
606)
607{
608
609#ifdef __MigPackStructs
610#pragma pack(push, 4)
611#endif
612 typedef struct {
613 mach_msg_header_t Head;
614 /* start of the kernel processed data */
615 mach_msg_body_t msgh_body;
616 mach_msg_port_descriptor_t thread;
617 mach_msg_port_descriptor_t task;
618 /* end of the kernel processed data */
619 NDR_record_t NDR;
620 exception_type_t exception;
621 mach_msg_type_number_t codeCnt;
622 int64_t code[2];
623 int flavor;
624 mach_msg_type_number_t old_stateCnt;
625 natural_t old_state[1296];
626 } Request __attribute__((unused));
627#ifdef __MigPackStructs
628#pragma pack(pop)
629#endif
630
631#ifdef __MigPackStructs
632#pragma pack(push, 4)
633#endif
634 typedef struct {
635 mach_msg_header_t Head;
636 NDR_record_t NDR;
637 kern_return_t RetCode;
638 int flavor;
639 mach_msg_type_number_t new_stateCnt;
640 natural_t new_state[1296];
641 mach_msg_trailer_t trailer;
642 } Reply __attribute__((unused));
643#ifdef __MigPackStructs
644#pragma pack(pop)
645#endif
646
647#ifdef __MigPackStructs
648#pragma pack(push, 4)
649#endif
650 typedef struct {
651 mach_msg_header_t Head;
652 NDR_record_t NDR;
653 kern_return_t RetCode;
654 int flavor;
655 mach_msg_type_number_t new_stateCnt;
656 natural_t new_state[1296];
657 } __Reply __attribute__((unused));
658#ifdef __MigPackStructs
659#pragma pack(pop)
660#endif
661 /*
662 * typedef struct {
663 * mach_msg_header_t Head;
664 * NDR_record_t NDR;
665 * kern_return_t RetCode;
666 * } mig_reply_error_t;
667 */
668
669 union mach_exception_raise_state_identityMessU {
670 Request In;
671 Reply Out;
672 } *Mess = (union mach_exception_raise_state_identityMessU *) mig_user_allocate(size: sizeof(*Mess));
673
674 Request *InP = &Mess->In;
675 Reply *Out0P = &Mess->Out;
676
677 mach_msg_return_t msg_result;
678 unsigned int msgh_size;
679 unsigned int msgh_size_delta;
680
681
682#ifdef __MIG_check__Reply__mach_exception_raise_state_identity_t__defined
683 kern_return_t check_result;
684#endif /* __MIG_check__Reply__mach_exception_raise_state_identity_t__defined */
685
686 __DeclareSendRpc(2407, "mach_exception_raise_state_identity")
687
688#if UseStaticTemplates
689 const static mach_msg_port_descriptor_t threadTemplate = {
690 /* name = */ MACH_PORT_NULL,
691 /* pad1 = */ 0,
692 /* pad2 = */ 0,
693 /* disp = */ 19,
694 /* type = */ MACH_MSG_PORT_DESCRIPTOR,
695 };
696#endif /* UseStaticTemplates */
697
698#if UseStaticTemplates
699 const static mach_msg_port_descriptor_t taskTemplate = {
700 /* name = */ MACH_PORT_NULL,
701 /* pad1 = */ 0,
702 /* pad2 = */ 0,
703 /* disp = */ 19,
704 /* type = */ MACH_MSG_PORT_DESCRIPTOR,
705 };
706#endif /* UseStaticTemplates */
707
708 InP->msgh_body.msgh_descriptor_count = 2;
709#if UseStaticTemplates
710 InP->thread = threadTemplate;
711 InP->thread.name = thread;
712#else /* UseStaticTemplates */
713 InP->thread.name = thread;
714 InP->thread.disposition = 19;
715 InP->thread.type = MACH_MSG_PORT_DESCRIPTOR;
716#endif /* UseStaticTemplates */
717
718#if UseStaticTemplates
719 InP->task = taskTemplate;
720 InP->task.name = task;
721#else /* UseStaticTemplates */
722 InP->task.name = task;
723 InP->task.disposition = 19;
724 InP->task.type = MACH_MSG_PORT_DESCRIPTOR;
725#endif /* UseStaticTemplates */
726
727 InP->NDR = NDR_record;
728
729 InP->exception = exception;
730
731 if (codeCnt > 2) {
732 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; }
733 }
734 (void)memcpy(dst: (char *) InP->code, src: (const char *) code, n: 8 * codeCnt);
735
736 InP->codeCnt = codeCnt;
737
738 msgh_size_delta = (8 * codeCnt);
739 msgh_size = (mach_msg_size_t)(sizeof(Request) - 5200) + msgh_size_delta;
740 InP = (Request *) ((pointer_t) InP + msgh_size_delta - 16);
741
742 InP->flavor = *flavor;
743
744 if (old_stateCnt > 1296) {
745 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; }
746 }
747 (void)memcpy(dst: (char *) InP->old_state, src: (const char *) old_state, n: 4 * old_stateCnt);
748
749 InP->old_stateCnt = old_stateCnt;
750
751 msgh_size += (4 * old_stateCnt);
752 InP = &Mess->In;
753 InP->Head.msgh_reply_port = mig_get_reply_port();
754 InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX|
755 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
756 /* msgh_size passed as argument */
757 InP->Head.msgh_request_port = exception_port;
758 InP->Head.msgh_id = 2407;
759 InP->Head.msgh_reserved = 0;
760
761 __BeforeSendRpc(2407, "mach_exception_raise_state_identity")
762#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
763 msg_result = mach_msg_rpc_from_kernel(msg: &InP->Head, send_size: msgh_size, rcv_size: (mach_msg_size_t)sizeof(Reply));
764#else
765 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
766#endif /* __MigKernelSpecificCode */
767 __AfterSendRpc(2407, "mach_exception_raise_state_identity")
768 if (msg_result != MACH_MSG_SUCCESS) {
769 __MachMsgErrorWithoutTimeout(msg_result);
770 }
771 if (msg_result != MACH_MSG_SUCCESS) {
772 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return msg_result; }
773 }
774
775
776#if defined(__MIG_check__Reply__mach_exception_raise_state_identity_t__defined)
777 check_result = __MIG_check__Reply__mach_exception_raise_state_identity_t(Out0P: (__Reply__mach_exception_raise_state_identity_t *)Out0P);
778 if (check_result != MACH_MSG_SUCCESS) {
779#if __MigKernelSpecificCode
780 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
781#endif /* __MigKernelSpecificCode */
782 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return check_result; }
783 }
784#endif /* defined(__MIG_check__Reply__mach_exception_raise_state_identity_t__defined) */
785
786 *flavor = Out0P->flavor;
787
788 if (Out0P->new_stateCnt > 1296) {
789 (void)memcpy(dst: (char *) new_state, src: (const char *) Out0P->new_state, n: 4 * 1296);
790 *new_stateCnt = Out0P->new_stateCnt;
791 { mig_user_deallocate(data: (char *) Mess, size: (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; }
792 }
793 (void)memcpy(dst: (char *) new_state, src: (const char *) Out0P->new_state, n: 4 * Out0P->new_stateCnt);
794
795 *new_stateCnt = Out0P->new_stateCnt;
796
797 { mig_user_deallocate(data: (char *) Mess, size: sizeof(*Mess)); return KERN_SUCCESS; }
798}
799
800#if ( __MigTypeCheck )
801#if __MIG_check__Reply__mach_exc_subsystem__
802#if !defined(__MIG_check__Reply__mach_exception_raise_identity_protected_t__defined)
803#define __MIG_check__Reply__mach_exception_raise_identity_protected_t__defined
804
805mig_internal kern_return_t __MIG_check__Reply__mach_exception_raise_identity_protected_t(__Reply__mach_exception_raise_identity_protected_t *Out0P)
806{
807
808 typedef __Reply__mach_exception_raise_identity_protected_t __Reply __attribute__((unused));
809 if (Out0P->Head.msgh_id != 2508) {
810 if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
811 { return MIG_SERVER_DIED; }
812 else
813 { return MIG_REPLY_MISMATCH; }
814 }
815
816#if __MigTypeCheck
817 if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
818 (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply)))
819 { return MIG_TYPE_ERROR ; }
820#endif /* __MigTypeCheck */
821
822#if __MigTypeCheck
823 if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) {
824 return MIG_TYPE_ERROR;
825 }
826#endif /* __MigTypeCheck */
827 {
828 return Out0P->RetCode;
829 }
830}
831#endif /* !defined(__MIG_check__Reply__mach_exception_raise_identity_protected_t__defined) */
832#endif /* __MIG_check__Reply__mach_exc_subsystem__ */
833#endif /* ( __MigTypeCheck ) */
834
835
836/* Routine mach_exception_raise_identity_protected */
837mig_external kern_return_t mach_exception_raise_identity_protected
838(
839 mach_port_t exception_port,
840 uint64_t thread_id,
841 mach_port_t task_id_token_t,
842 exception_type_t exception,
843 mach_exception_data_t code,
844 mach_msg_type_number_t codeCnt
845)
846{
847
848#ifdef __MigPackStructs
849#pragma pack(push, 4)
850#endif
851 typedef struct {
852 mach_msg_header_t Head;
853 /* start of the kernel processed data */
854 mach_msg_body_t msgh_body;
855 mach_msg_port_descriptor_t task_id_token_t;
856 /* end of the kernel processed data */
857 NDR_record_t NDR;
858 uint64_t thread_id;
859 exception_type_t exception;
860 mach_msg_type_number_t codeCnt;
861 int64_t code[2];
862 } Request __attribute__((unused));
863#ifdef __MigPackStructs
864#pragma pack(pop)
865#endif
866
867#ifdef __MigPackStructs
868#pragma pack(push, 4)
869#endif
870 typedef struct {
871 mach_msg_header_t Head;
872 NDR_record_t NDR;
873 kern_return_t RetCode;
874 mach_msg_trailer_t trailer;
875 } Reply __attribute__((unused));
876#ifdef __MigPackStructs
877#pragma pack(pop)
878#endif
879
880#ifdef __MigPackStructs
881#pragma pack(push, 4)
882#endif
883 typedef struct {
884 mach_msg_header_t Head;
885 NDR_record_t NDR;
886 kern_return_t RetCode;
887 } __Reply __attribute__((unused));
888#ifdef __MigPackStructs
889#pragma pack(pop)
890#endif
891 /*
892 * typedef struct {
893 * mach_msg_header_t Head;
894 * NDR_record_t NDR;
895 * kern_return_t RetCode;
896 * } mig_reply_error_t;
897 */
898
899 union {
900 Request In;
901 Reply Out;
902 } Mess;
903
904 Request *InP = &Mess.In;
905 Reply *Out0P = &Mess.Out;
906
907 mach_msg_return_t msg_result;
908 unsigned int msgh_size;
909
910#ifdef __MIG_check__Reply__mach_exception_raise_identity_protected_t__defined
911 kern_return_t check_result;
912#endif /* __MIG_check__Reply__mach_exception_raise_identity_protected_t__defined */
913
914 __DeclareSendRpc(2408, "mach_exception_raise_identity_protected")
915
916#if UseStaticTemplates
917 const static mach_msg_port_descriptor_t task_id_token_tTemplate = {
918 /* name = */ MACH_PORT_NULL,
919 /* pad1 = */ 0,
920 /* pad2 = */ 0,
921 /* disp = */ 19,
922 /* type = */ MACH_MSG_PORT_DESCRIPTOR,
923 };
924#endif /* UseStaticTemplates */
925
926 InP->msgh_body.msgh_descriptor_count = 1;
927#if UseStaticTemplates
928 InP->task_id_token_t = task_id_token_tTemplate;
929 InP->task_id_token_t.name = task_id_token_t;
930#else /* UseStaticTemplates */
931 InP->task_id_token_t.name = task_id_token_t;
932 InP->task_id_token_t.disposition = 19;
933 InP->task_id_token_t.type = MACH_MSG_PORT_DESCRIPTOR;
934#endif /* UseStaticTemplates */
935
936 InP->NDR = NDR_record;
937
938 InP->thread_id = thread_id;
939
940 InP->exception = exception;
941
942 if (codeCnt > 2) {
943 { return MIG_ARRAY_TOO_LARGE; }
944 }
945 (void)memcpy(dst: (char *) InP->code, src: (const char *) code, n: 8 * codeCnt);
946
947 InP->codeCnt = codeCnt;
948
949 msgh_size = (mach_msg_size_t)(sizeof(Request) - 16) + ((8 * codeCnt));
950 InP->Head.msgh_reply_port = mig_get_reply_port();
951 InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX|
952 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
953 /* msgh_size passed as argument */
954 InP->Head.msgh_request_port = exception_port;
955 InP->Head.msgh_id = 2408;
956 InP->Head.msgh_reserved = 0;
957
958 __BeforeSendRpc(2408, "mach_exception_raise_identity_protected")
959#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
960 msg_result = mach_msg_rpc_from_kernel(msg: &InP->Head, send_size: msgh_size, rcv_size: (mach_msg_size_t)sizeof(Reply));
961#else
962 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
963#endif /* __MigKernelSpecificCode */
964 __AfterSendRpc(2408, "mach_exception_raise_identity_protected")
965 if (msg_result != MACH_MSG_SUCCESS) {
966 __MachMsgErrorWithoutTimeout(msg_result);
967 }
968 if (msg_result != MACH_MSG_SUCCESS) {
969 { return msg_result; }
970 }
971
972
973#if defined(__MIG_check__Reply__mach_exception_raise_identity_protected_t__defined)
974 check_result = __MIG_check__Reply__mach_exception_raise_identity_protected_t(Out0P: (__Reply__mach_exception_raise_identity_protected_t *)Out0P);
975 if (check_result != MACH_MSG_SUCCESS) {
976#if __MigKernelSpecificCode
977 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
978#endif /* __MigKernelSpecificCode */
979 { return check_result; }
980 }
981#endif /* defined(__MIG_check__Reply__mach_exception_raise_identity_protected_t__defined) */
982
983 return KERN_SUCCESS;
984}
985
986#if ( __MigTypeCheck )
987#if __MIG_check__Reply__mach_exc_subsystem__
988#if !defined(__MIG_check__Reply__mach_exception_raise_backtrace_t__defined)
989#define __MIG_check__Reply__mach_exception_raise_backtrace_t__defined
990
991mig_internal kern_return_t __MIG_check__Reply__mach_exception_raise_backtrace_t(__Reply__mach_exception_raise_backtrace_t *Out0P)
992{
993
994 typedef __Reply__mach_exception_raise_backtrace_t __Reply __attribute__((unused));
995 if (Out0P->Head.msgh_id != 2509) {
996 if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
997 { return MIG_SERVER_DIED; }
998 else
999 { return MIG_REPLY_MISMATCH; }
1000 }
1001
1002#if __MigTypeCheck
1003 if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
1004 (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply)))
1005 { return MIG_TYPE_ERROR ; }
1006#endif /* __MigTypeCheck */
1007
1008#if __MigTypeCheck
1009 if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) {
1010 return MIG_TYPE_ERROR;
1011 }
1012#endif /* __MigTypeCheck */
1013 {
1014 return Out0P->RetCode;
1015 }
1016}
1017#endif /* !defined(__MIG_check__Reply__mach_exception_raise_backtrace_t__defined) */
1018#endif /* __MIG_check__Reply__mach_exc_subsystem__ */
1019#endif /* ( __MigTypeCheck ) */
1020
1021
1022/* Routine mach_exception_raise_backtrace */
1023mig_external kern_return_t mach_exception_raise_backtrace
1024(
1025 mach_port_t exception_port,
1026 mach_port_t kcdata_object_t,
1027 exception_type_t exception,
1028 mach_exception_data_t code,
1029 mach_msg_type_number_t codeCnt
1030)
1031{
1032
1033#ifdef __MigPackStructs
1034#pragma pack(push, 4)
1035#endif
1036 typedef struct {
1037 mach_msg_header_t Head;
1038 /* start of the kernel processed data */
1039 mach_msg_body_t msgh_body;
1040 mach_msg_port_descriptor_t kcdata_object_t;
1041 /* end of the kernel processed data */
1042 NDR_record_t NDR;
1043 exception_type_t exception;
1044 mach_msg_type_number_t codeCnt;
1045 int64_t code[2];
1046 } Request __attribute__((unused));
1047#ifdef __MigPackStructs
1048#pragma pack(pop)
1049#endif
1050
1051#ifdef __MigPackStructs
1052#pragma pack(push, 4)
1053#endif
1054 typedef struct {
1055 mach_msg_header_t Head;
1056 NDR_record_t NDR;
1057 kern_return_t RetCode;
1058 mach_msg_trailer_t trailer;
1059 } Reply __attribute__((unused));
1060#ifdef __MigPackStructs
1061#pragma pack(pop)
1062#endif
1063
1064#ifdef __MigPackStructs
1065#pragma pack(push, 4)
1066#endif
1067 typedef struct {
1068 mach_msg_header_t Head;
1069 NDR_record_t NDR;
1070 kern_return_t RetCode;
1071 } __Reply __attribute__((unused));
1072#ifdef __MigPackStructs
1073#pragma pack(pop)
1074#endif
1075 /*
1076 * typedef struct {
1077 * mach_msg_header_t Head;
1078 * NDR_record_t NDR;
1079 * kern_return_t RetCode;
1080 * } mig_reply_error_t;
1081 */
1082
1083 union {
1084 Request In;
1085 Reply Out;
1086 } Mess;
1087
1088 Request *InP = &Mess.In;
1089 Reply *Out0P = &Mess.Out;
1090
1091 mach_msg_return_t msg_result;
1092 unsigned int msgh_size;
1093
1094#ifdef __MIG_check__Reply__mach_exception_raise_backtrace_t__defined
1095 kern_return_t check_result;
1096#endif /* __MIG_check__Reply__mach_exception_raise_backtrace_t__defined */
1097
1098 __DeclareSendRpc(2409, "mach_exception_raise_backtrace")
1099
1100#if UseStaticTemplates
1101 const static mach_msg_port_descriptor_t kcdata_object_tTemplate = {
1102 /* name = */ MACH_PORT_NULL,
1103 /* pad1 = */ 0,
1104 /* pad2 = */ 0,
1105 /* disp = */ 19,
1106 /* type = */ MACH_MSG_PORT_DESCRIPTOR,
1107 };
1108#endif /* UseStaticTemplates */
1109
1110 InP->msgh_body.msgh_descriptor_count = 1;
1111#if UseStaticTemplates
1112 InP->kcdata_object_t = kcdata_object_tTemplate;
1113 InP->kcdata_object_t.name = kcdata_object_t;
1114#else /* UseStaticTemplates */
1115 InP->kcdata_object_t.name = kcdata_object_t;
1116 InP->kcdata_object_t.disposition = 19;
1117 InP->kcdata_object_t.type = MACH_MSG_PORT_DESCRIPTOR;
1118#endif /* UseStaticTemplates */
1119
1120 InP->NDR = NDR_record;
1121
1122 InP->exception = exception;
1123
1124 if (codeCnt > 2) {
1125 { return MIG_ARRAY_TOO_LARGE; }
1126 }
1127 (void)memcpy(dst: (char *) InP->code, src: (const char *) code, n: 8 * codeCnt);
1128
1129 InP->codeCnt = codeCnt;
1130
1131 msgh_size = (mach_msg_size_t)(sizeof(Request) - 16) + ((8 * codeCnt));
1132 InP->Head.msgh_reply_port = mig_get_reply_port();
1133 InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX|
1134 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
1135 /* msgh_size passed as argument */
1136 InP->Head.msgh_request_port = exception_port;
1137 InP->Head.msgh_id = 2409;
1138 InP->Head.msgh_reserved = 0;
1139
1140 __BeforeSendRpc(2409, "mach_exception_raise_backtrace")
1141#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
1142 msg_result = mach_msg_rpc_from_kernel(msg: &InP->Head, send_size: msgh_size, rcv_size: (mach_msg_size_t)sizeof(Reply));
1143#else
1144 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
1145#endif /* __MigKernelSpecificCode */
1146 __AfterSendRpc(2409, "mach_exception_raise_backtrace")
1147 if (msg_result != MACH_MSG_SUCCESS) {
1148 __MachMsgErrorWithoutTimeout(msg_result);
1149 }
1150 if (msg_result != MACH_MSG_SUCCESS) {
1151 { return msg_result; }
1152 }
1153
1154
1155#if defined(__MIG_check__Reply__mach_exception_raise_backtrace_t__defined)
1156 check_result = __MIG_check__Reply__mach_exception_raise_backtrace_t(Out0P: (__Reply__mach_exception_raise_backtrace_t *)Out0P);
1157 if (check_result != MACH_MSG_SUCCESS) {
1158#if __MigKernelSpecificCode
1159 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
1160#endif /* __MigKernelSpecificCode */
1161 { return check_result; }
1162 }
1163#endif /* defined(__MIG_check__Reply__mach_exception_raise_backtrace_t__defined) */
1164
1165 return KERN_SUCCESS;
1166}
1167