| 1 | /* |
| 2 | * IDENTIFICATION: |
| 3 | * stub generated Tue Apr 9 11:33:40 2019 |
| 4 | * with a MiG generated by bootstrap_cmds-96.20.2.200.4 |
| 5 | * OPTIONS: |
| 6 | * KernelUser |
| 7 | */ |
| 8 | #define __MIG_check__Reply__exc_subsystem__ 1 |
| 9 | |
| 10 | #include "exc.h" |
| 11 | |
| 12 | |
| 13 | #ifndef mig_internal |
| 14 | #define mig_internal static __inline__ |
| 15 | #endif /* mig_internal */ |
| 16 | |
| 17 | #ifndef mig_external |
| 18 | #define mig_external |
| 19 | #endif /* mig_external */ |
| 20 | |
| 21 | #if !defined(__MigTypeCheck) && defined(TypeCheck) |
| 22 | #define __MigTypeCheck TypeCheck /* Legacy setting */ |
| 23 | #endif /* !defined(__MigTypeCheck) */ |
| 24 | |
| 25 | #if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) |
| 26 | #define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ |
| 27 | #endif /* !defined(__MigKernelSpecificCode) */ |
| 28 | |
| 29 | #ifndef LimitCheck |
| 30 | #define LimitCheck 0 |
| 31 | #endif /* LimitCheck */ |
| 32 | |
| 33 | #ifndef min |
| 34 | #define min(a,b) ( ((a) < (b))? (a): (b) ) |
| 35 | #endif /* min */ |
| 36 | |
| 37 | #if !defined(_WALIGN_) |
| 38 | #define _WALIGN_(x) (((x) + 3) & ~3) |
| 39 | #endif /* !defined(_WALIGN_) */ |
| 40 | |
| 41 | #if !defined(_WALIGNSZ_) |
| 42 | #define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) |
| 43 | #endif /* !defined(_WALIGNSZ_) */ |
| 44 | |
| 45 | #ifndef UseStaticTemplates |
| 46 | #define UseStaticTemplates 0 |
| 47 | #endif /* UseStaticTemplates */ |
| 48 | |
| 49 | #ifndef __MachMsgErrorWithTimeout |
| 50 | #define __MachMsgErrorWithTimeout(_R_) { \ |
| 51 | switch (_R_) { \ |
| 52 | case MACH_SEND_INVALID_DATA: \ |
| 53 | case MACH_SEND_INVALID_DEST: \ |
| 54 | case MACH_SEND_INVALID_HEADER: \ |
| 55 | mig_put_reply_port(InP->Head.msgh_reply_port); \ |
| 56 | break; \ |
| 57 | case MACH_SEND_TIMED_OUT: \ |
| 58 | case MACH_RCV_TIMED_OUT: \ |
| 59 | default: \ |
| 60 | mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ |
| 61 | } \ |
| 62 | } |
| 63 | #endif /* __MachMsgErrorWithTimeout */ |
| 64 | |
| 65 | #ifndef __MachMsgErrorWithoutTimeout |
| 66 | #define __MachMsgErrorWithoutTimeout(_R_) { \ |
| 67 | switch (_R_) { \ |
| 68 | case MACH_SEND_INVALID_DATA: \ |
| 69 | case MACH_SEND_INVALID_DEST: \ |
| 70 | case MACH_SEND_INVALID_HEADER: \ |
| 71 | mig_put_reply_port(InP->Head.msgh_reply_port); \ |
| 72 | break; \ |
| 73 | default: \ |
| 74 | mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ |
| 75 | } \ |
| 76 | } |
| 77 | #endif /* __MachMsgErrorWithoutTimeout */ |
| 78 | |
| 79 | #ifndef __DeclareSendRpc |
| 80 | #define __DeclareSendRpc(_NUM_, _NAME_) |
| 81 | #endif /* __DeclareSendRpc */ |
| 82 | |
| 83 | #ifndef __BeforeSendRpc |
| 84 | #define __BeforeSendRpc(_NUM_, _NAME_) |
| 85 | #endif /* __BeforeSendRpc */ |
| 86 | |
| 87 | #ifndef __AfterSendRpc |
| 88 | #define __AfterSendRpc(_NUM_, _NAME_) |
| 89 | #endif /* __AfterSendRpc */ |
| 90 | |
| 91 | #ifndef __DeclareSendSimple |
| 92 | #define __DeclareSendSimple(_NUM_, _NAME_) |
| 93 | #endif /* __DeclareSendSimple */ |
| 94 | |
| 95 | #ifndef __BeforeSendSimple |
| 96 | #define __BeforeSendSimple(_NUM_, _NAME_) |
| 97 | #endif /* __BeforeSendSimple */ |
| 98 | |
| 99 | #ifndef __AfterSendSimple |
| 100 | #define __AfterSendSimple(_NUM_, _NAME_) |
| 101 | #endif /* __AfterSendSimple */ |
| 102 | |
| 103 | #define msgh_request_port msgh_remote_port |
| 104 | #define msgh_reply_port msgh_local_port |
| 105 | |
| 106 | |
| 107 | |
| 108 | #if ( __MigTypeCheck ) |
| 109 | #if __MIG_check__Reply__exc_subsystem__ |
| 110 | #if !defined(__MIG_check__Reply__exception_raise_t__defined) |
| 111 | #define __MIG_check__Reply__exception_raise_t__defined |
| 112 | |
| 113 | mig_internal kern_return_t __MIG_check__Reply__exception_raise_t(__Reply__exception_raise_t *Out0P) |
| 114 | { |
| 115 | |
| 116 | typedef __Reply__exception_raise_t __Reply __attribute__((unused)); |
| 117 | if (Out0P->Head.msgh_id != 2501) { |
| 118 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
| 119 | { return MIG_SERVER_DIED; } |
| 120 | else |
| 121 | { return MIG_REPLY_MISMATCH; } |
| 122 | } |
| 123 | |
| 124 | #if __MigTypeCheck |
| 125 | if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
| 126 | (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply))) |
| 127 | { return MIG_TYPE_ERROR ; } |
| 128 | #endif /* __MigTypeCheck */ |
| 129 | |
| 130 | { |
| 131 | return Out0P->RetCode; |
| 132 | } |
| 133 | } |
| 134 | #endif /* !defined(__MIG_check__Reply__exception_raise_t__defined) */ |
| 135 | #endif /* __MIG_check__Reply__exc_subsystem__ */ |
| 136 | #endif /* ( __MigTypeCheck ) */ |
| 137 | |
| 138 | |
| 139 | /* Routine exception_raise */ |
| 140 | mig_external kern_return_t exception_raise |
| 141 | ( |
| 142 | mach_port_t exception_port, |
| 143 | mach_port_t thread, |
| 144 | mach_port_t task, |
| 145 | exception_type_t exception, |
| 146 | exception_data_t code, |
| 147 | mach_msg_type_number_t codeCnt |
| 148 | ) |
| 149 | { |
| 150 | |
| 151 | #ifdef __MigPackStructs |
| 152 | #pragma pack(4) |
| 153 | #endif |
| 154 | typedef struct { |
| 155 | mach_msg_header_t Head; |
| 156 | /* start of the kernel processed data */ |
| 157 | mach_msg_body_t msgh_body; |
| 158 | mach_msg_port_descriptor_t thread; |
| 159 | mach_msg_port_descriptor_t task; |
| 160 | /* end of the kernel processed data */ |
| 161 | NDR_record_t NDR; |
| 162 | exception_type_t exception; |
| 163 | mach_msg_type_number_t codeCnt; |
| 164 | integer_t code[2]; |
| 165 | } Request __attribute__((unused)); |
| 166 | #ifdef __MigPackStructs |
| 167 | #pragma pack() |
| 168 | #endif |
| 169 | |
| 170 | #ifdef __MigPackStructs |
| 171 | #pragma pack(4) |
| 172 | #endif |
| 173 | typedef struct { |
| 174 | mach_msg_header_t Head; |
| 175 | NDR_record_t NDR; |
| 176 | kern_return_t RetCode; |
| 177 | mach_msg_trailer_t trailer; |
| 178 | } Reply __attribute__((unused)); |
| 179 | #ifdef __MigPackStructs |
| 180 | #pragma pack() |
| 181 | #endif |
| 182 | |
| 183 | #ifdef __MigPackStructs |
| 184 | #pragma pack(4) |
| 185 | #endif |
| 186 | typedef struct { |
| 187 | mach_msg_header_t Head; |
| 188 | NDR_record_t NDR; |
| 189 | kern_return_t RetCode; |
| 190 | } __Reply __attribute__((unused)); |
| 191 | #ifdef __MigPackStructs |
| 192 | #pragma pack() |
| 193 | #endif |
| 194 | /* |
| 195 | * typedef struct { |
| 196 | * mach_msg_header_t Head; |
| 197 | * NDR_record_t NDR; |
| 198 | * kern_return_t RetCode; |
| 199 | * } mig_reply_error_t; |
| 200 | */ |
| 201 | |
| 202 | union { |
| 203 | Request In; |
| 204 | Reply Out; |
| 205 | } Mess; |
| 206 | |
| 207 | Request *InP = &Mess.In; |
| 208 | Reply *Out0P = &Mess.Out; |
| 209 | |
| 210 | mach_msg_return_t msg_result; |
| 211 | unsigned int msgh_size; |
| 212 | |
| 213 | #ifdef __MIG_check__Reply__exception_raise_t__defined |
| 214 | kern_return_t check_result; |
| 215 | #endif /* __MIG_check__Reply__exception_raise_t__defined */ |
| 216 | |
| 217 | __DeclareSendRpc(2401, "exception_raise" ) |
| 218 | |
| 219 | #if UseStaticTemplates |
| 220 | const static mach_msg_port_descriptor_t threadTemplate = { |
| 221 | /* name = */ MACH_PORT_NULL, |
| 222 | /* pad1 = */ 0, |
| 223 | /* pad2 = */ 0, |
| 224 | /* disp = */ 19, |
| 225 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
| 226 | }; |
| 227 | #endif /* UseStaticTemplates */ |
| 228 | |
| 229 | #if UseStaticTemplates |
| 230 | const static mach_msg_port_descriptor_t taskTemplate = { |
| 231 | /* name = */ MACH_PORT_NULL, |
| 232 | /* pad1 = */ 0, |
| 233 | /* pad2 = */ 0, |
| 234 | /* disp = */ 19, |
| 235 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
| 236 | }; |
| 237 | #endif /* UseStaticTemplates */ |
| 238 | |
| 239 | InP->msgh_body.msgh_descriptor_count = 2; |
| 240 | #if UseStaticTemplates |
| 241 | InP->thread = threadTemplate; |
| 242 | InP->thread.name = thread; |
| 243 | #else /* UseStaticTemplates */ |
| 244 | InP->thread.name = thread; |
| 245 | InP->thread.disposition = 19; |
| 246 | InP->thread.type = MACH_MSG_PORT_DESCRIPTOR; |
| 247 | #endif /* UseStaticTemplates */ |
| 248 | |
| 249 | #if UseStaticTemplates |
| 250 | InP->task = taskTemplate; |
| 251 | InP->task.name = task; |
| 252 | #else /* UseStaticTemplates */ |
| 253 | InP->task.name = task; |
| 254 | InP->task.disposition = 19; |
| 255 | InP->task.type = MACH_MSG_PORT_DESCRIPTOR; |
| 256 | #endif /* UseStaticTemplates */ |
| 257 | |
| 258 | InP->NDR = NDR_record; |
| 259 | |
| 260 | InP->exception = exception; |
| 261 | |
| 262 | if (codeCnt > 2) { |
| 263 | { return MIG_ARRAY_TOO_LARGE; } |
| 264 | } |
| 265 | (void)memcpy((char *) InP->code, (const char *) code, 4 * codeCnt); |
| 266 | |
| 267 | InP->codeCnt = codeCnt; |
| 268 | |
| 269 | msgh_size = (mach_msg_size_t)(sizeof(Request) - 8) + ((4 * codeCnt)); |
| 270 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
| 271 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
| 272 | /* msgh_size passed as argument */ |
| 273 | InP->Head.msgh_request_port = exception_port; |
| 274 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
| 275 | InP->Head.msgh_id = 2401; |
| 276 | InP->Head.msgh_reserved = 0; |
| 277 | |
| 278 | __BeforeSendRpc(2401, "exception_raise" ) |
| 279 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
| 280 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, msgh_size, (mach_msg_size_t)sizeof(Reply)); |
| 281 | #else |
| 282 | 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); |
| 283 | #endif /* __MigKernelSpecificCode */ |
| 284 | __AfterSendRpc(2401, "exception_raise" ) |
| 285 | if (msg_result != MACH_MSG_SUCCESS) { |
| 286 | __MachMsgErrorWithoutTimeout(msg_result); |
| 287 | { return msg_result; } |
| 288 | } |
| 289 | |
| 290 | |
| 291 | #if defined(__MIG_check__Reply__exception_raise_t__defined) |
| 292 | check_result = __MIG_check__Reply__exception_raise_t((__Reply__exception_raise_t *)Out0P); |
| 293 | if (check_result != MACH_MSG_SUCCESS) |
| 294 | { return check_result; } |
| 295 | #endif /* defined(__MIG_check__Reply__exception_raise_t__defined) */ |
| 296 | |
| 297 | return KERN_SUCCESS; |
| 298 | } |
| 299 | |
| 300 | #if ( __MigTypeCheck ) |
| 301 | #if __MIG_check__Reply__exc_subsystem__ |
| 302 | #if !defined(__MIG_check__Reply__exception_raise_state_t__defined) |
| 303 | #define __MIG_check__Reply__exception_raise_state_t__defined |
| 304 | |
| 305 | mig_internal kern_return_t __MIG_check__Reply__exception_raise_state_t(__Reply__exception_raise_state_t *Out0P) |
| 306 | { |
| 307 | |
| 308 | typedef __Reply__exception_raise_state_t __Reply __attribute__((unused)); |
| 309 | #if __MigTypeCheck |
| 310 | unsigned int msgh_size; |
| 311 | #endif /* __MigTypeCheck */ |
| 312 | |
| 313 | if (Out0P->Head.msgh_id != 2502) { |
| 314 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
| 315 | { return MIG_SERVER_DIED; } |
| 316 | else |
| 317 | { return MIG_REPLY_MISMATCH; } |
| 318 | } |
| 319 | |
| 320 | #if __MigTypeCheck |
| 321 | msgh_size = Out0P->Head.msgh_size; |
| 322 | |
| 323 | if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
| 324 | ((msgh_size > (mach_msg_size_t)sizeof(__Reply) || msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 2456)) && |
| 325 | (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
| 326 | Out0P->RetCode == KERN_SUCCESS))) |
| 327 | { return MIG_TYPE_ERROR ; } |
| 328 | #endif /* __MigTypeCheck */ |
| 329 | |
| 330 | if (Out0P->RetCode != KERN_SUCCESS) { |
| 331 | return ((mig_reply_error_t *)Out0P)->RetCode; |
| 332 | } |
| 333 | |
| 334 | #if __MigTypeCheck |
| 335 | if ( Out0P->new_stateCnt > 614 ) |
| 336 | return MIG_TYPE_ERROR; |
| 337 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 2456)) / 4< Out0P->new_stateCnt) || |
| 338 | (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 2456) + Out0P->new_stateCnt * 4)) |
| 339 | { return MIG_TYPE_ERROR ; } |
| 340 | #endif /* __MigTypeCheck */ |
| 341 | |
| 342 | return MACH_MSG_SUCCESS; |
| 343 | } |
| 344 | #endif /* !defined(__MIG_check__Reply__exception_raise_state_t__defined) */ |
| 345 | #endif /* __MIG_check__Reply__exc_subsystem__ */ |
| 346 | #endif /* ( __MigTypeCheck ) */ |
| 347 | |
| 348 | |
| 349 | /* Routine exception_raise_state */ |
| 350 | mig_external kern_return_t exception_raise_state |
| 351 | ( |
| 352 | mach_port_t exception_port, |
| 353 | exception_type_t exception, |
| 354 | const exception_data_t code, |
| 355 | mach_msg_type_number_t codeCnt, |
| 356 | int *flavor, |
| 357 | const thread_state_t old_state, |
| 358 | mach_msg_type_number_t old_stateCnt, |
| 359 | thread_state_t new_state, |
| 360 | mach_msg_type_number_t *new_stateCnt |
| 361 | ) |
| 362 | { |
| 363 | |
| 364 | #ifdef __MigPackStructs |
| 365 | #pragma pack(4) |
| 366 | #endif |
| 367 | typedef struct { |
| 368 | mach_msg_header_t Head; |
| 369 | NDR_record_t NDR; |
| 370 | exception_type_t exception; |
| 371 | mach_msg_type_number_t codeCnt; |
| 372 | integer_t code[2]; |
| 373 | int flavor; |
| 374 | mach_msg_type_number_t old_stateCnt; |
| 375 | natural_t old_state[614]; |
| 376 | } Request __attribute__((unused)); |
| 377 | #ifdef __MigPackStructs |
| 378 | #pragma pack() |
| 379 | #endif |
| 380 | |
| 381 | #ifdef __MigPackStructs |
| 382 | #pragma pack(4) |
| 383 | #endif |
| 384 | typedef struct { |
| 385 | mach_msg_header_t Head; |
| 386 | NDR_record_t NDR; |
| 387 | kern_return_t RetCode; |
| 388 | int flavor; |
| 389 | mach_msg_type_number_t new_stateCnt; |
| 390 | natural_t new_state[614]; |
| 391 | mach_msg_trailer_t trailer; |
| 392 | } Reply __attribute__((unused)); |
| 393 | #ifdef __MigPackStructs |
| 394 | #pragma pack() |
| 395 | #endif |
| 396 | |
| 397 | #ifdef __MigPackStructs |
| 398 | #pragma pack(4) |
| 399 | #endif |
| 400 | typedef struct { |
| 401 | mach_msg_header_t Head; |
| 402 | NDR_record_t NDR; |
| 403 | kern_return_t RetCode; |
| 404 | int flavor; |
| 405 | mach_msg_type_number_t new_stateCnt; |
| 406 | natural_t new_state[614]; |
| 407 | } __Reply __attribute__((unused)); |
| 408 | #ifdef __MigPackStructs |
| 409 | #pragma pack() |
| 410 | #endif |
| 411 | /* |
| 412 | * typedef struct { |
| 413 | * mach_msg_header_t Head; |
| 414 | * NDR_record_t NDR; |
| 415 | * kern_return_t RetCode; |
| 416 | * } mig_reply_error_t; |
| 417 | */ |
| 418 | |
| 419 | union exception_raise_stateMessU { |
| 420 | Request In; |
| 421 | Reply Out; |
| 422 | } *Mess = (union exception_raise_stateMessU *) mig_user_allocate(sizeof(*Mess)); |
| 423 | |
| 424 | Request *InP = &Mess->In; |
| 425 | Reply *Out0P = &Mess->Out; |
| 426 | |
| 427 | mach_msg_return_t msg_result; |
| 428 | unsigned int msgh_size; |
| 429 | unsigned int msgh_size_delta; |
| 430 | |
| 431 | |
| 432 | #ifdef __MIG_check__Reply__exception_raise_state_t__defined |
| 433 | kern_return_t check_result; |
| 434 | #endif /* __MIG_check__Reply__exception_raise_state_t__defined */ |
| 435 | |
| 436 | __DeclareSendRpc(2402, "exception_raise_state" ) |
| 437 | |
| 438 | InP->NDR = NDR_record; |
| 439 | |
| 440 | InP->exception = exception; |
| 441 | |
| 442 | if (codeCnt > 2) { |
| 443 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; } |
| 444 | } |
| 445 | (void)memcpy((char *) InP->code, (const char *) code, 4 * codeCnt); |
| 446 | |
| 447 | InP->codeCnt = codeCnt; |
| 448 | |
| 449 | msgh_size_delta = (4 * codeCnt); |
| 450 | msgh_size = (mach_msg_size_t)(sizeof(Request) - 2464) + msgh_size_delta; |
| 451 | InP = (Request *) ((pointer_t) InP + msgh_size_delta - 8); |
| 452 | |
| 453 | InP->flavor = *flavor; |
| 454 | |
| 455 | if (old_stateCnt > 614) { |
| 456 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; } |
| 457 | } |
| 458 | (void)memcpy((char *) InP->old_state, (const char *) old_state, 4 * old_stateCnt); |
| 459 | |
| 460 | InP->old_stateCnt = old_stateCnt; |
| 461 | |
| 462 | msgh_size += (4 * old_stateCnt); |
| 463 | InP = &Mess->In; |
| 464 | InP->Head.msgh_bits = |
| 465 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
| 466 | /* msgh_size passed as argument */ |
| 467 | InP->Head.msgh_request_port = exception_port; |
| 468 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
| 469 | InP->Head.msgh_id = 2402; |
| 470 | InP->Head.msgh_reserved = 0; |
| 471 | |
| 472 | __BeforeSendRpc(2402, "exception_raise_state" ) |
| 473 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
| 474 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, msgh_size, (mach_msg_size_t)sizeof(Reply)); |
| 475 | #else |
| 476 | 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); |
| 477 | #endif /* __MigKernelSpecificCode */ |
| 478 | __AfterSendRpc(2402, "exception_raise_state" ) |
| 479 | if (msg_result != MACH_MSG_SUCCESS) { |
| 480 | __MachMsgErrorWithoutTimeout(msg_result); |
| 481 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return msg_result; } |
| 482 | } |
| 483 | |
| 484 | |
| 485 | #if defined(__MIG_check__Reply__exception_raise_state_t__defined) |
| 486 | check_result = __MIG_check__Reply__exception_raise_state_t((__Reply__exception_raise_state_t *)Out0P); |
| 487 | if (check_result != MACH_MSG_SUCCESS) |
| 488 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return check_result; } |
| 489 | #endif /* defined(__MIG_check__Reply__exception_raise_state_t__defined) */ |
| 490 | |
| 491 | *flavor = Out0P->flavor; |
| 492 | |
| 493 | if (Out0P->new_stateCnt > 614) { |
| 494 | (void)memcpy((char *) new_state, (const char *) Out0P->new_state, 4 * 614); |
| 495 | *new_stateCnt = Out0P->new_stateCnt; |
| 496 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; } |
| 497 | } |
| 498 | (void)memcpy((char *) new_state, (const char *) Out0P->new_state, 4 * Out0P->new_stateCnt); |
| 499 | |
| 500 | *new_stateCnt = Out0P->new_stateCnt; |
| 501 | |
| 502 | { mig_user_deallocate((char *) Mess, sizeof(*Mess)); return KERN_SUCCESS; } |
| 503 | } |
| 504 | |
| 505 | #if ( __MigTypeCheck ) |
| 506 | #if __MIG_check__Reply__exc_subsystem__ |
| 507 | #if !defined(__MIG_check__Reply__exception_raise_state_identity_t__defined) |
| 508 | #define __MIG_check__Reply__exception_raise_state_identity_t__defined |
| 509 | |
| 510 | mig_internal kern_return_t __MIG_check__Reply__exception_raise_state_identity_t(__Reply__exception_raise_state_identity_t *Out0P) |
| 511 | { |
| 512 | |
| 513 | typedef __Reply__exception_raise_state_identity_t __Reply __attribute__((unused)); |
| 514 | #if __MigTypeCheck |
| 515 | unsigned int msgh_size; |
| 516 | #endif /* __MigTypeCheck */ |
| 517 | |
| 518 | if (Out0P->Head.msgh_id != 2503) { |
| 519 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
| 520 | { return MIG_SERVER_DIED; } |
| 521 | else |
| 522 | { return MIG_REPLY_MISMATCH; } |
| 523 | } |
| 524 | |
| 525 | #if __MigTypeCheck |
| 526 | msgh_size = Out0P->Head.msgh_size; |
| 527 | |
| 528 | if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
| 529 | ((msgh_size > (mach_msg_size_t)sizeof(__Reply) || msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 2456)) && |
| 530 | (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || |
| 531 | Out0P->RetCode == KERN_SUCCESS))) |
| 532 | { return MIG_TYPE_ERROR ; } |
| 533 | #endif /* __MigTypeCheck */ |
| 534 | |
| 535 | if (Out0P->RetCode != KERN_SUCCESS) { |
| 536 | return ((mig_reply_error_t *)Out0P)->RetCode; |
| 537 | } |
| 538 | |
| 539 | #if __MigTypeCheck |
| 540 | if ( Out0P->new_stateCnt > 614 ) |
| 541 | return MIG_TYPE_ERROR; |
| 542 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 2456)) / 4< Out0P->new_stateCnt) || |
| 543 | (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 2456) + Out0P->new_stateCnt * 4)) |
| 544 | { return MIG_TYPE_ERROR ; } |
| 545 | #endif /* __MigTypeCheck */ |
| 546 | |
| 547 | return MACH_MSG_SUCCESS; |
| 548 | } |
| 549 | #endif /* !defined(__MIG_check__Reply__exception_raise_state_identity_t__defined) */ |
| 550 | #endif /* __MIG_check__Reply__exc_subsystem__ */ |
| 551 | #endif /* ( __MigTypeCheck ) */ |
| 552 | |
| 553 | |
| 554 | /* Routine exception_raise_state_identity */ |
| 555 | mig_external kern_return_t exception_raise_state_identity |
| 556 | ( |
| 557 | mach_port_t exception_port, |
| 558 | mach_port_t thread, |
| 559 | mach_port_t task, |
| 560 | exception_type_t exception, |
| 561 | exception_data_t code, |
| 562 | mach_msg_type_number_t codeCnt, |
| 563 | int *flavor, |
| 564 | thread_state_t old_state, |
| 565 | mach_msg_type_number_t old_stateCnt, |
| 566 | thread_state_t new_state, |
| 567 | mach_msg_type_number_t *new_stateCnt |
| 568 | ) |
| 569 | { |
| 570 | |
| 571 | #ifdef __MigPackStructs |
| 572 | #pragma pack(4) |
| 573 | #endif |
| 574 | typedef struct { |
| 575 | mach_msg_header_t Head; |
| 576 | /* start of the kernel processed data */ |
| 577 | mach_msg_body_t msgh_body; |
| 578 | mach_msg_port_descriptor_t thread; |
| 579 | mach_msg_port_descriptor_t task; |
| 580 | /* end of the kernel processed data */ |
| 581 | NDR_record_t NDR; |
| 582 | exception_type_t exception; |
| 583 | mach_msg_type_number_t codeCnt; |
| 584 | integer_t code[2]; |
| 585 | int flavor; |
| 586 | mach_msg_type_number_t old_stateCnt; |
| 587 | natural_t old_state[614]; |
| 588 | } Request __attribute__((unused)); |
| 589 | #ifdef __MigPackStructs |
| 590 | #pragma pack() |
| 591 | #endif |
| 592 | |
| 593 | #ifdef __MigPackStructs |
| 594 | #pragma pack(4) |
| 595 | #endif |
| 596 | typedef struct { |
| 597 | mach_msg_header_t Head; |
| 598 | NDR_record_t NDR; |
| 599 | kern_return_t RetCode; |
| 600 | int flavor; |
| 601 | mach_msg_type_number_t new_stateCnt; |
| 602 | natural_t new_state[614]; |
| 603 | mach_msg_trailer_t trailer; |
| 604 | } Reply __attribute__((unused)); |
| 605 | #ifdef __MigPackStructs |
| 606 | #pragma pack() |
| 607 | #endif |
| 608 | |
| 609 | #ifdef __MigPackStructs |
| 610 | #pragma pack(4) |
| 611 | #endif |
| 612 | typedef struct { |
| 613 | mach_msg_header_t Head; |
| 614 | NDR_record_t NDR; |
| 615 | kern_return_t RetCode; |
| 616 | int flavor; |
| 617 | mach_msg_type_number_t new_stateCnt; |
| 618 | natural_t new_state[614]; |
| 619 | } __Reply __attribute__((unused)); |
| 620 | #ifdef __MigPackStructs |
| 621 | #pragma pack() |
| 622 | #endif |
| 623 | /* |
| 624 | * typedef struct { |
| 625 | * mach_msg_header_t Head; |
| 626 | * NDR_record_t NDR; |
| 627 | * kern_return_t RetCode; |
| 628 | * } mig_reply_error_t; |
| 629 | */ |
| 630 | |
| 631 | union exception_raise_state_identityMessU { |
| 632 | Request In; |
| 633 | Reply Out; |
| 634 | } *Mess = (union exception_raise_state_identityMessU *) mig_user_allocate(sizeof(*Mess)); |
| 635 | |
| 636 | Request *InP = &Mess->In; |
| 637 | Reply *Out0P = &Mess->Out; |
| 638 | |
| 639 | mach_msg_return_t msg_result; |
| 640 | unsigned int msgh_size; |
| 641 | unsigned int msgh_size_delta; |
| 642 | |
| 643 | |
| 644 | #ifdef __MIG_check__Reply__exception_raise_state_identity_t__defined |
| 645 | kern_return_t check_result; |
| 646 | #endif /* __MIG_check__Reply__exception_raise_state_identity_t__defined */ |
| 647 | |
| 648 | __DeclareSendRpc(2403, "exception_raise_state_identity" ) |
| 649 | |
| 650 | #if UseStaticTemplates |
| 651 | const static mach_msg_port_descriptor_t threadTemplate = { |
| 652 | /* name = */ MACH_PORT_NULL, |
| 653 | /* pad1 = */ 0, |
| 654 | /* pad2 = */ 0, |
| 655 | /* disp = */ 19, |
| 656 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
| 657 | }; |
| 658 | #endif /* UseStaticTemplates */ |
| 659 | |
| 660 | #if UseStaticTemplates |
| 661 | const static mach_msg_port_descriptor_t taskTemplate = { |
| 662 | /* name = */ MACH_PORT_NULL, |
| 663 | /* pad1 = */ 0, |
| 664 | /* pad2 = */ 0, |
| 665 | /* disp = */ 19, |
| 666 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
| 667 | }; |
| 668 | #endif /* UseStaticTemplates */ |
| 669 | |
| 670 | InP->msgh_body.msgh_descriptor_count = 2; |
| 671 | #if UseStaticTemplates |
| 672 | InP->thread = threadTemplate; |
| 673 | InP->thread.name = thread; |
| 674 | #else /* UseStaticTemplates */ |
| 675 | InP->thread.name = thread; |
| 676 | InP->thread.disposition = 19; |
| 677 | InP->thread.type = MACH_MSG_PORT_DESCRIPTOR; |
| 678 | #endif /* UseStaticTemplates */ |
| 679 | |
| 680 | #if UseStaticTemplates |
| 681 | InP->task = taskTemplate; |
| 682 | InP->task.name = task; |
| 683 | #else /* UseStaticTemplates */ |
| 684 | InP->task.name = task; |
| 685 | InP->task.disposition = 19; |
| 686 | InP->task.type = MACH_MSG_PORT_DESCRIPTOR; |
| 687 | #endif /* UseStaticTemplates */ |
| 688 | |
| 689 | InP->NDR = NDR_record; |
| 690 | |
| 691 | InP->exception = exception; |
| 692 | |
| 693 | if (codeCnt > 2) { |
| 694 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; } |
| 695 | } |
| 696 | (void)memcpy((char *) InP->code, (const char *) code, 4 * codeCnt); |
| 697 | |
| 698 | InP->codeCnt = codeCnt; |
| 699 | |
| 700 | msgh_size_delta = (4 * codeCnt); |
| 701 | msgh_size = (mach_msg_size_t)(sizeof(Request) - 2464) + msgh_size_delta; |
| 702 | InP = (Request *) ((pointer_t) InP + msgh_size_delta - 8); |
| 703 | |
| 704 | InP->flavor = *flavor; |
| 705 | |
| 706 | if (old_stateCnt > 614) { |
| 707 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; } |
| 708 | } |
| 709 | (void)memcpy((char *) InP->old_state, (const char *) old_state, 4 * old_stateCnt); |
| 710 | |
| 711 | InP->old_stateCnt = old_stateCnt; |
| 712 | |
| 713 | msgh_size += (4 * old_stateCnt); |
| 714 | InP = &Mess->In; |
| 715 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
| 716 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
| 717 | /* msgh_size passed as argument */ |
| 718 | InP->Head.msgh_request_port = exception_port; |
| 719 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
| 720 | InP->Head.msgh_id = 2403; |
| 721 | InP->Head.msgh_reserved = 0; |
| 722 | |
| 723 | __BeforeSendRpc(2403, "exception_raise_state_identity" ) |
| 724 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
| 725 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, msgh_size, (mach_msg_size_t)sizeof(Reply)); |
| 726 | #else |
| 727 | 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); |
| 728 | #endif /* __MigKernelSpecificCode */ |
| 729 | __AfterSendRpc(2403, "exception_raise_state_identity" ) |
| 730 | if (msg_result != MACH_MSG_SUCCESS) { |
| 731 | __MachMsgErrorWithoutTimeout(msg_result); |
| 732 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return msg_result; } |
| 733 | } |
| 734 | |
| 735 | |
| 736 | #if defined(__MIG_check__Reply__exception_raise_state_identity_t__defined) |
| 737 | check_result = __MIG_check__Reply__exception_raise_state_identity_t((__Reply__exception_raise_state_identity_t *)Out0P); |
| 738 | if (check_result != MACH_MSG_SUCCESS) |
| 739 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return check_result; } |
| 740 | #endif /* defined(__MIG_check__Reply__exception_raise_state_identity_t__defined) */ |
| 741 | |
| 742 | *flavor = Out0P->flavor; |
| 743 | |
| 744 | if (Out0P->new_stateCnt > 614) { |
| 745 | (void)memcpy((char *) new_state, (const char *) Out0P->new_state, 4 * 614); |
| 746 | *new_stateCnt = Out0P->new_stateCnt; |
| 747 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; } |
| 748 | } |
| 749 | (void)memcpy((char *) new_state, (const char *) Out0P->new_state, 4 * Out0P->new_stateCnt); |
| 750 | |
| 751 | *new_stateCnt = Out0P->new_stateCnt; |
| 752 | |
| 753 | { mig_user_deallocate((char *) Mess, sizeof(*Mess)); return KERN_SUCCESS; } |
| 754 | } |
| 755 | |