mach_excServer.c 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. /*
  2. * IDENTIFICATION:
  3. * stub generated Tue Apr 7 09:10:21 2020
  4. * with a MiG generated by bootstrap_cmds-116
  5. * OPTIONS:
  6. */
  7. /* Module mach_exc */
  8. #define __MIG_check__Request__mach_exc_subsystem__ 1
  9. #include <string.h>
  10. #include <mach/ndr.h>
  11. #include <mach/boolean.h>
  12. #include <mach/kern_return.h>
  13. #include <mach/notify.h>
  14. #include <mach/mach_types.h>
  15. #include <mach/message.h>
  16. #include <mach/mig_errors.h>
  17. #include <mach/port.h>
  18. /* BEGIN VOUCHER CODE */
  19. #ifndef KERNEL
  20. #if defined(__has_include)
  21. #if __has_include(<mach/mig_voucher_support.h>)
  22. #ifndef USING_VOUCHERS
  23. #define USING_VOUCHERS
  24. #endif
  25. #ifndef __VOUCHER_FORWARD_TYPE_DECLS__
  26. #define __VOUCHER_FORWARD_TYPE_DECLS__
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import));
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif // __VOUCHER_FORWARD_TYPE_DECLS__
  35. #endif // __has_include(<mach/mach_voucher_types.h>)
  36. #endif // __has_include
  37. #endif // !KERNEL
  38. /* END VOUCHER CODE */
  39. /* BEGIN MIG_STRNCPY_ZEROFILL CODE */
  40. #if defined(__has_include)
  41. #if __has_include(<mach/mig_strncpy_zerofill_support.h>)
  42. #ifndef USING_MIG_STRNCPY_ZEROFILL
  43. #define USING_MIG_STRNCPY_ZEROFILL
  44. #endif
  45. #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
  46. #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50. extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
  55. #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
  56. #endif /* __has_include */
  57. /* END MIG_STRNCPY_ZEROFILL CODE */
  58. #include <mach/std_types.h>
  59. #include <mach/mig.h>
  60. #include <mach/mig.h>
  61. #include <mach/mach_types.h>
  62. #ifndef mig_internal
  63. #define mig_internal static __inline__
  64. #endif /* mig_internal */
  65. #ifndef mig_external
  66. #define mig_external
  67. #endif /* mig_external */
  68. #if !defined(__MigTypeCheck) && defined(TypeCheck)
  69. #define __MigTypeCheck TypeCheck /* Legacy setting */
  70. #endif /* !defined(__MigTypeCheck) */
  71. #if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
  72. #define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */
  73. #endif /* !defined(__MigKernelSpecificCode) */
  74. #ifndef LimitCheck
  75. #define LimitCheck 0
  76. #endif /* LimitCheck */
  77. #ifndef min
  78. #define min(a,b) ( ((a) < (b))? (a): (b) )
  79. #endif /* min */
  80. #if !defined(_WALIGN_)
  81. #define _WALIGN_(x) (((x) + 3) & ~3)
  82. #endif /* !defined(_WALIGN_) */
  83. #if !defined(_WALIGNSZ_)
  84. #define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
  85. #endif /* !defined(_WALIGNSZ_) */
  86. #ifndef UseStaticTemplates
  87. #define UseStaticTemplates 0
  88. #endif /* UseStaticTemplates */
  89. #ifndef MIG_SERVER_ROUTINE
  90. #define MIG_SERVER_ROUTINE
  91. #endif
  92. #ifndef __DeclareRcvRpc
  93. #define __DeclareRcvRpc(_NUM_, _NAME_)
  94. #endif /* __DeclareRcvRpc */
  95. #ifndef __BeforeRcvRpc
  96. #define __BeforeRcvRpc(_NUM_, _NAME_)
  97. #endif /* __BeforeRcvRpc */
  98. #ifndef __AfterRcvRpc
  99. #define __AfterRcvRpc(_NUM_, _NAME_)
  100. #endif /* __AfterRcvRpc */
  101. #ifndef __DeclareRcvSimple
  102. #define __DeclareRcvSimple(_NUM_, _NAME_)
  103. #endif /* __DeclareRcvSimple */
  104. #ifndef __BeforeRcvSimple
  105. #define __BeforeRcvSimple(_NUM_, _NAME_)
  106. #endif /* __BeforeRcvSimple */
  107. #ifndef __AfterRcvSimple
  108. #define __AfterRcvSimple(_NUM_, _NAME_)
  109. #endif /* __AfterRcvSimple */
  110. #define novalue void
  111. #define msgh_request_port msgh_local_port
  112. #define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits)
  113. #define msgh_reply_port msgh_remote_port
  114. #define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits)
  115. #define MIG_RETURN_ERROR(X, code) {\
  116. ((mig_reply_error_t *)X)->RetCode = code;\
  117. ((mig_reply_error_t *)X)->NDR = NDR_record;\
  118. return;\
  119. }
  120. /* typedefs for all requests */
  121. #ifndef __Request__mach_exc_subsystem__defined
  122. #define __Request__mach_exc_subsystem__defined
  123. #ifdef __MigPackStructs
  124. #pragma pack(push, 4)
  125. #endif
  126. typedef struct {
  127. mach_msg_header_t Head;
  128. /* start of the kernel processed data */
  129. mach_msg_body_t msgh_body;
  130. mach_msg_port_descriptor_t thread;
  131. mach_msg_port_descriptor_t task;
  132. /* end of the kernel processed data */
  133. NDR_record_t NDR;
  134. exception_type_t exception;
  135. mach_msg_type_number_t codeCnt;
  136. int64_t code[2];
  137. } __Request__mach_exception_raise_t __attribute__((unused));
  138. #ifdef __MigPackStructs
  139. #pragma pack(pop)
  140. #endif
  141. #ifdef __MigPackStructs
  142. #pragma pack(push, 4)
  143. #endif
  144. typedef struct {
  145. mach_msg_header_t Head;
  146. NDR_record_t NDR;
  147. exception_type_t exception;
  148. mach_msg_type_number_t codeCnt;
  149. int64_t code[2];
  150. int flavor;
  151. mach_msg_type_number_t old_stateCnt;
  152. natural_t old_state[614];
  153. } __Request__mach_exception_raise_state_t __attribute__((unused));
  154. #ifdef __MigPackStructs
  155. #pragma pack(pop)
  156. #endif
  157. #ifdef __MigPackStructs
  158. #pragma pack(push, 4)
  159. #endif
  160. typedef struct {
  161. mach_msg_header_t Head;
  162. /* start of the kernel processed data */
  163. mach_msg_body_t msgh_body;
  164. mach_msg_port_descriptor_t thread;
  165. mach_msg_port_descriptor_t task;
  166. /* end of the kernel processed data */
  167. NDR_record_t NDR;
  168. exception_type_t exception;
  169. mach_msg_type_number_t codeCnt;
  170. int64_t code[2];
  171. int flavor;
  172. mach_msg_type_number_t old_stateCnt;
  173. natural_t old_state[614];
  174. } __Request__mach_exception_raise_state_identity_t __attribute__((unused));
  175. #ifdef __MigPackStructs
  176. #pragma pack(pop)
  177. #endif
  178. #endif /* !__Request__mach_exc_subsystem__defined */
  179. /* typedefs for all replies */
  180. #ifndef __Reply__mach_exc_subsystem__defined
  181. #define __Reply__mach_exc_subsystem__defined
  182. #ifdef __MigPackStructs
  183. #pragma pack(push, 4)
  184. #endif
  185. typedef struct {
  186. mach_msg_header_t Head;
  187. NDR_record_t NDR;
  188. kern_return_t RetCode;
  189. } __Reply__mach_exception_raise_t __attribute__((unused));
  190. #ifdef __MigPackStructs
  191. #pragma pack(pop)
  192. #endif
  193. #ifdef __MigPackStructs
  194. #pragma pack(push, 4)
  195. #endif
  196. typedef struct {
  197. mach_msg_header_t Head;
  198. NDR_record_t NDR;
  199. kern_return_t RetCode;
  200. int flavor;
  201. mach_msg_type_number_t new_stateCnt;
  202. natural_t new_state[614];
  203. } __Reply__mach_exception_raise_state_t __attribute__((unused));
  204. #ifdef __MigPackStructs
  205. #pragma pack(pop)
  206. #endif
  207. #ifdef __MigPackStructs
  208. #pragma pack(push, 4)
  209. #endif
  210. typedef struct {
  211. mach_msg_header_t Head;
  212. NDR_record_t NDR;
  213. kern_return_t RetCode;
  214. int flavor;
  215. mach_msg_type_number_t new_stateCnt;
  216. natural_t new_state[614];
  217. } __Reply__mach_exception_raise_state_identity_t __attribute__((unused));
  218. #ifdef __MigPackStructs
  219. #pragma pack(pop)
  220. #endif
  221. #endif /* !__Reply__mach_exc_subsystem__defined */
  222. /* union of all replies */
  223. #ifndef __ReplyUnion__catch_mach_exc_subsystem__defined
  224. #define __ReplyUnion__catch_mach_exc_subsystem__defined
  225. union __ReplyUnion__catch_mach_exc_subsystem {
  226. __Reply__mach_exception_raise_t Reply_mach_exception_raise;
  227. __Reply__mach_exception_raise_state_t Reply_mach_exception_raise_state;
  228. __Reply__mach_exception_raise_state_identity_t Reply_mach_exception_raise_state_identity;
  229. };
  230. #endif /* __ReplyUnion__catch_mach_exc_subsystem__defined */
  231. /* Forward Declarations */
  232. mig_internal novalue _Xmach_exception_raise
  233. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
  234. mig_internal novalue _Xmach_exception_raise_state
  235. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
  236. mig_internal novalue _Xmach_exception_raise_state_identity
  237. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP);
  238. #if ( __MigTypeCheck )
  239. #if __MIG_check__Request__mach_exc_subsystem__
  240. #if !defined(__MIG_check__Request__mach_exception_raise_t__defined)
  241. #define __MIG_check__Request__mach_exception_raise_t__defined
  242. mig_internal kern_return_t __MIG_check__Request__mach_exception_raise_t(__attribute__((__unused__)) __Request__mach_exception_raise_t *In0P)
  243. {
  244. typedef __Request__mach_exception_raise_t __Request;
  245. #if __MigTypeCheck
  246. unsigned int msgh_size;
  247. #endif /* __MigTypeCheck */
  248. #if __MigTypeCheck
  249. msgh_size = In0P->Head.msgh_size;
  250. if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
  251. (In0P->msgh_body.msgh_descriptor_count != 2) ||
  252. (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 16)) || (msgh_size > (mach_msg_size_t)sizeof(__Request)))
  253. return MIG_BAD_ARGUMENTS;
  254. #endif /* __MigTypeCheck */
  255. #if __MigTypeCheck
  256. if (In0P->thread.type != MACH_MSG_PORT_DESCRIPTOR ||
  257. In0P->thread.disposition != 17)
  258. return MIG_TYPE_ERROR;
  259. #endif /* __MigTypeCheck */
  260. #if __MigTypeCheck
  261. if (In0P->task.type != MACH_MSG_PORT_DESCRIPTOR ||
  262. In0P->task.disposition != 17)
  263. return MIG_TYPE_ERROR;
  264. #endif /* __MigTypeCheck */
  265. #if defined(__NDR_convert__int_rep__Request__mach_exception_raise_t__codeCnt__defined)
  266. if (In0P->NDR.int_rep != NDR_record.int_rep)
  267. __NDR_convert__int_rep__Request__mach_exception_raise_t__codeCnt(&In0P->codeCnt, In0P->NDR.int_rep);
  268. #endif /* __NDR_convert__int_rep__Request__mach_exception_raise_t__codeCnt__defined */
  269. #if __MigTypeCheck
  270. if ( In0P->codeCnt > 2 )
  271. return MIG_BAD_ARGUMENTS;
  272. if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 16)) / 8 < In0P->codeCnt) ||
  273. (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 16) + (8 * In0P->codeCnt)))
  274. return MIG_BAD_ARGUMENTS;
  275. #endif /* __MigTypeCheck */
  276. return MACH_MSG_SUCCESS;
  277. }
  278. #endif /* !defined(__MIG_check__Request__mach_exception_raise_t__defined) */
  279. #endif /* __MIG_check__Request__mach_exc_subsystem__ */
  280. #endif /* ( __MigTypeCheck ) */
  281. /* Routine mach_exception_raise */
  282. #ifdef mig_external
  283. mig_external
  284. #else
  285. extern
  286. #endif /* mig_external */
  287. MIG_SERVER_ROUTINE
  288. kern_return_t catch_mach_exception_raise
  289. (
  290. mach_port_t exception_port,
  291. mach_port_t thread,
  292. mach_port_t task,
  293. exception_type_t exception,
  294. mach_exception_data_t code,
  295. mach_msg_type_number_t codeCnt
  296. );
  297. /* Routine mach_exception_raise */
  298. mig_internal novalue _Xmach_exception_raise
  299. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
  300. {
  301. #ifdef __MigPackStructs
  302. #pragma pack(push, 4)
  303. #endif
  304. typedef struct {
  305. mach_msg_header_t Head;
  306. /* start of the kernel processed data */
  307. mach_msg_body_t msgh_body;
  308. mach_msg_port_descriptor_t thread;
  309. mach_msg_port_descriptor_t task;
  310. /* end of the kernel processed data */
  311. NDR_record_t NDR;
  312. exception_type_t exception;
  313. mach_msg_type_number_t codeCnt;
  314. int64_t code[2];
  315. mach_msg_trailer_t trailer;
  316. } Request __attribute__((unused));
  317. #ifdef __MigPackStructs
  318. #pragma pack(pop)
  319. #endif
  320. typedef __Request__mach_exception_raise_t __Request;
  321. typedef __Reply__mach_exception_raise_t Reply __attribute__((unused));
  322. /*
  323. * typedef struct {
  324. * mach_msg_header_t Head;
  325. * NDR_record_t NDR;
  326. * kern_return_t RetCode;
  327. * } mig_reply_error_t;
  328. */
  329. Request *In0P = (Request *) InHeadP;
  330. Reply *OutP = (Reply *) OutHeadP;
  331. #ifdef __MIG_check__Request__mach_exception_raise_t__defined
  332. kern_return_t check_result;
  333. #endif /* __MIG_check__Request__mach_exception_raise_t__defined */
  334. __DeclareRcvRpc(2405, "mach_exception_raise")
  335. __BeforeRcvRpc(2405, "mach_exception_raise")
  336. #if defined(__MIG_check__Request__mach_exception_raise_t__defined)
  337. check_result = __MIG_check__Request__mach_exception_raise_t((__Request *)In0P);
  338. if (check_result != MACH_MSG_SUCCESS)
  339. { MIG_RETURN_ERROR(OutP, check_result); }
  340. #endif /* defined(__MIG_check__Request__mach_exception_raise_t__defined) */
  341. OutP->RetCode = catch_mach_exception_raise(In0P->Head.msgh_request_port, In0P->thread.name, In0P->task.name, In0P->exception, In0P->code, In0P->codeCnt);
  342. OutP->NDR = NDR_record;
  343. __AfterRcvRpc(2405, "mach_exception_raise")
  344. }
  345. #if ( __MigTypeCheck )
  346. #if __MIG_check__Request__mach_exc_subsystem__
  347. #if !defined(__MIG_check__Request__mach_exception_raise_state_t__defined)
  348. #define __MIG_check__Request__mach_exception_raise_state_t__defined
  349. mig_internal kern_return_t __MIG_check__Request__mach_exception_raise_state_t(__attribute__((__unused__)) __Request__mach_exception_raise_state_t *In0P, __attribute__((__unused__)) __Request__mach_exception_raise_state_t **In1PP)
  350. {
  351. typedef __Request__mach_exception_raise_state_t __Request;
  352. __Request *In1P;
  353. #if __MigTypeCheck
  354. unsigned int msgh_size;
  355. #endif /* __MigTypeCheck */
  356. unsigned int msgh_size_delta;
  357. #if __MigTypeCheck
  358. msgh_size = In0P->Head.msgh_size;
  359. if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
  360. (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 2472)) || (msgh_size > (mach_msg_size_t)sizeof(__Request)))
  361. return MIG_BAD_ARGUMENTS;
  362. #endif /* __MigTypeCheck */
  363. #if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_t__codeCnt__defined)
  364. if (In0P->NDR.int_rep != NDR_record.int_rep)
  365. __NDR_convert__int_rep__Request__mach_exception_raise_state_t__codeCnt(&In0P->codeCnt, In0P->NDR.int_rep);
  366. #endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_t__codeCnt__defined */
  367. msgh_size_delta = (8 * In0P->codeCnt);
  368. #if __MigTypeCheck
  369. if ( In0P->codeCnt > 2 )
  370. return MIG_BAD_ARGUMENTS;
  371. if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 2472)) / 8 < In0P->codeCnt) ||
  372. (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 2472) + (8 * In0P->codeCnt)))
  373. return MIG_BAD_ARGUMENTS;
  374. msgh_size -= msgh_size_delta;
  375. #endif /* __MigTypeCheck */
  376. *In1PP = In1P = (__Request *) ((pointer_t) In0P + msgh_size_delta - 16);
  377. #if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_t__old_stateCnt__defined)
  378. if (In0P->NDR.int_rep != NDR_record.int_rep)
  379. __NDR_convert__int_rep__Request__mach_exception_raise_state_t__old_stateCnt(&In1P->old_stateCnt, In1P->NDR.int_rep);
  380. #endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_t__old_stateCnt__defined */
  381. #if __MigTypeCheck
  382. if ( In1P->old_stateCnt > 614 )
  383. return MIG_BAD_ARGUMENTS;
  384. if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 2472)) / 4 < In1P->old_stateCnt) ||
  385. (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 2472) + (4 * In1P->old_stateCnt)))
  386. return MIG_BAD_ARGUMENTS;
  387. #endif /* __MigTypeCheck */
  388. return MACH_MSG_SUCCESS;
  389. }
  390. #endif /* !defined(__MIG_check__Request__mach_exception_raise_state_t__defined) */
  391. #endif /* __MIG_check__Request__mach_exc_subsystem__ */
  392. #endif /* ( __MigTypeCheck ) */
  393. /* Routine mach_exception_raise_state */
  394. #ifdef mig_external
  395. mig_external
  396. #else
  397. extern
  398. #endif /* mig_external */
  399. MIG_SERVER_ROUTINE
  400. kern_return_t catch_mach_exception_raise_state
  401. (
  402. mach_port_t exception_port,
  403. exception_type_t exception,
  404. const mach_exception_data_t code,
  405. mach_msg_type_number_t codeCnt,
  406. int *flavor,
  407. const thread_state_t old_state,
  408. mach_msg_type_number_t old_stateCnt,
  409. thread_state_t new_state,
  410. mach_msg_type_number_t *new_stateCnt
  411. );
  412. /* Routine mach_exception_raise_state */
  413. mig_internal novalue _Xmach_exception_raise_state
  414. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
  415. {
  416. #ifdef __MigPackStructs
  417. #pragma pack(push, 4)
  418. #endif
  419. typedef struct {
  420. mach_msg_header_t Head;
  421. NDR_record_t NDR;
  422. exception_type_t exception;
  423. mach_msg_type_number_t codeCnt;
  424. int64_t code[2];
  425. int flavor;
  426. mach_msg_type_number_t old_stateCnt;
  427. natural_t old_state[614];
  428. mach_msg_trailer_t trailer;
  429. } Request __attribute__((unused));
  430. #ifdef __MigPackStructs
  431. #pragma pack(pop)
  432. #endif
  433. typedef __Request__mach_exception_raise_state_t __Request;
  434. typedef __Reply__mach_exception_raise_state_t Reply __attribute__((unused));
  435. /*
  436. * typedef struct {
  437. * mach_msg_header_t Head;
  438. * NDR_record_t NDR;
  439. * kern_return_t RetCode;
  440. * } mig_reply_error_t;
  441. */
  442. Request *In0P = (Request *) InHeadP;
  443. Request *In1P;
  444. Reply *OutP = (Reply *) OutHeadP;
  445. #ifdef __MIG_check__Request__mach_exception_raise_state_t__defined
  446. kern_return_t check_result;
  447. #endif /* __MIG_check__Request__mach_exception_raise_state_t__defined */
  448. __DeclareRcvRpc(2406, "mach_exception_raise_state")
  449. __BeforeRcvRpc(2406, "mach_exception_raise_state")
  450. #if defined(__MIG_check__Request__mach_exception_raise_state_t__defined)
  451. check_result = __MIG_check__Request__mach_exception_raise_state_t((__Request *)In0P, (__Request **)&In1P);
  452. if (check_result != MACH_MSG_SUCCESS)
  453. { MIG_RETURN_ERROR(OutP, check_result); }
  454. #endif /* defined(__MIG_check__Request__mach_exception_raise_state_t__defined) */
  455. OutP->new_stateCnt = 614;
  456. OutP->RetCode = catch_mach_exception_raise_state(In0P->Head.msgh_request_port, In0P->exception, In0P->code, In0P->codeCnt, &In1P->flavor, In1P->old_state, In1P->old_stateCnt, OutP->new_state, &OutP->new_stateCnt);
  457. if (OutP->RetCode != KERN_SUCCESS) {
  458. MIG_RETURN_ERROR(OutP, OutP->RetCode);
  459. }
  460. OutP->NDR = NDR_record;
  461. OutP->flavor = In1P->flavor;
  462. OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply) - 2456) + (((4 * OutP->new_stateCnt)));
  463. __AfterRcvRpc(2406, "mach_exception_raise_state")
  464. }
  465. #if ( __MigTypeCheck )
  466. #if __MIG_check__Request__mach_exc_subsystem__
  467. #if !defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined)
  468. #define __MIG_check__Request__mach_exception_raise_state_identity_t__defined
  469. mig_internal kern_return_t __MIG_check__Request__mach_exception_raise_state_identity_t(__attribute__((__unused__)) __Request__mach_exception_raise_state_identity_t *In0P, __attribute__((__unused__)) __Request__mach_exception_raise_state_identity_t **In1PP)
  470. {
  471. typedef __Request__mach_exception_raise_state_identity_t __Request;
  472. __Request *In1P;
  473. #if __MigTypeCheck
  474. unsigned int msgh_size;
  475. #endif /* __MigTypeCheck */
  476. unsigned int msgh_size_delta;
  477. #if __MigTypeCheck
  478. msgh_size = In0P->Head.msgh_size;
  479. if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
  480. (In0P->msgh_body.msgh_descriptor_count != 2) ||
  481. (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 2472)) || (msgh_size > (mach_msg_size_t)sizeof(__Request)))
  482. return MIG_BAD_ARGUMENTS;
  483. #endif /* __MigTypeCheck */
  484. #if __MigTypeCheck
  485. if (In0P->thread.type != MACH_MSG_PORT_DESCRIPTOR ||
  486. In0P->thread.disposition != 17)
  487. return MIG_TYPE_ERROR;
  488. #endif /* __MigTypeCheck */
  489. #if __MigTypeCheck
  490. if (In0P->task.type != MACH_MSG_PORT_DESCRIPTOR ||
  491. In0P->task.disposition != 17)
  492. return MIG_TYPE_ERROR;
  493. #endif /* __MigTypeCheck */
  494. #if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__codeCnt__defined)
  495. if (In0P->NDR.int_rep != NDR_record.int_rep)
  496. __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__codeCnt(&In0P->codeCnt, In0P->NDR.int_rep);
  497. #endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__codeCnt__defined */
  498. msgh_size_delta = (8 * In0P->codeCnt);
  499. #if __MigTypeCheck
  500. if ( In0P->codeCnt > 2 )
  501. return MIG_BAD_ARGUMENTS;
  502. if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 2472)) / 8 < In0P->codeCnt) ||
  503. (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 2472) + (8 * In0P->codeCnt)))
  504. return MIG_BAD_ARGUMENTS;
  505. msgh_size -= msgh_size_delta;
  506. #endif /* __MigTypeCheck */
  507. *In1PP = In1P = (__Request *) ((pointer_t) In0P + msgh_size_delta - 16);
  508. #if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__old_stateCnt__defined)
  509. if (In0P->NDR.int_rep != NDR_record.int_rep)
  510. __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__old_stateCnt(&In1P->old_stateCnt, In1P->NDR.int_rep);
  511. #endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__old_stateCnt__defined */
  512. #if __MigTypeCheck
  513. if ( In1P->old_stateCnt > 614 )
  514. return MIG_BAD_ARGUMENTS;
  515. if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 2472)) / 4 < In1P->old_stateCnt) ||
  516. (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 2472) + (4 * In1P->old_stateCnt)))
  517. return MIG_BAD_ARGUMENTS;
  518. #endif /* __MigTypeCheck */
  519. return MACH_MSG_SUCCESS;
  520. }
  521. #endif /* !defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) */
  522. #endif /* __MIG_check__Request__mach_exc_subsystem__ */
  523. #endif /* ( __MigTypeCheck ) */
  524. /* Routine mach_exception_raise_state_identity */
  525. #ifdef mig_external
  526. mig_external
  527. #else
  528. extern
  529. #endif /* mig_external */
  530. MIG_SERVER_ROUTINE
  531. kern_return_t catch_mach_exception_raise_state_identity
  532. (
  533. mach_port_t exception_port,
  534. mach_port_t thread,
  535. mach_port_t task,
  536. exception_type_t exception,
  537. mach_exception_data_t code,
  538. mach_msg_type_number_t codeCnt,
  539. int *flavor,
  540. thread_state_t old_state,
  541. mach_msg_type_number_t old_stateCnt,
  542. thread_state_t new_state,
  543. mach_msg_type_number_t *new_stateCnt
  544. );
  545. /* Routine mach_exception_raise_state_identity */
  546. mig_internal novalue _Xmach_exception_raise_state_identity
  547. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
  548. {
  549. #ifdef __MigPackStructs
  550. #pragma pack(push, 4)
  551. #endif
  552. typedef struct {
  553. mach_msg_header_t Head;
  554. /* start of the kernel processed data */
  555. mach_msg_body_t msgh_body;
  556. mach_msg_port_descriptor_t thread;
  557. mach_msg_port_descriptor_t task;
  558. /* end of the kernel processed data */
  559. NDR_record_t NDR;
  560. exception_type_t exception;
  561. mach_msg_type_number_t codeCnt;
  562. int64_t code[2];
  563. int flavor;
  564. mach_msg_type_number_t old_stateCnt;
  565. natural_t old_state[614];
  566. mach_msg_trailer_t trailer;
  567. } Request __attribute__((unused));
  568. #ifdef __MigPackStructs
  569. #pragma pack(pop)
  570. #endif
  571. typedef __Request__mach_exception_raise_state_identity_t __Request;
  572. typedef __Reply__mach_exception_raise_state_identity_t Reply __attribute__((unused));
  573. /*
  574. * typedef struct {
  575. * mach_msg_header_t Head;
  576. * NDR_record_t NDR;
  577. * kern_return_t RetCode;
  578. * } mig_reply_error_t;
  579. */
  580. Request *In0P = (Request *) InHeadP;
  581. Request *In1P;
  582. Reply *OutP = (Reply *) OutHeadP;
  583. #ifdef __MIG_check__Request__mach_exception_raise_state_identity_t__defined
  584. kern_return_t check_result;
  585. #endif /* __MIG_check__Request__mach_exception_raise_state_identity_t__defined */
  586. __DeclareRcvRpc(2407, "mach_exception_raise_state_identity")
  587. __BeforeRcvRpc(2407, "mach_exception_raise_state_identity")
  588. #if defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined)
  589. check_result = __MIG_check__Request__mach_exception_raise_state_identity_t((__Request *)In0P, (__Request **)&In1P);
  590. if (check_result != MACH_MSG_SUCCESS)
  591. { MIG_RETURN_ERROR(OutP, check_result); }
  592. #endif /* defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) */
  593. OutP->new_stateCnt = 614;
  594. OutP->RetCode = catch_mach_exception_raise_state_identity(In0P->Head.msgh_request_port, In0P->thread.name, In0P->task.name, In0P->exception, In0P->code, In0P->codeCnt, &In1P->flavor, In1P->old_state, In1P->old_stateCnt, OutP->new_state, &OutP->new_stateCnt);
  595. if (OutP->RetCode != KERN_SUCCESS) {
  596. MIG_RETURN_ERROR(OutP, OutP->RetCode);
  597. }
  598. OutP->NDR = NDR_record;
  599. OutP->flavor = In1P->flavor;
  600. OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply) - 2456) + (((4 * OutP->new_stateCnt)));
  601. __AfterRcvRpc(2407, "mach_exception_raise_state_identity")
  602. }
  603. #ifdef mig_external
  604. mig_external
  605. #else
  606. extern
  607. #endif /* mig_external */
  608. boolean_t mach_exc_server(
  609. mach_msg_header_t *InHeadP,
  610. mach_msg_header_t *OutHeadP);
  611. #ifdef mig_external
  612. mig_external
  613. #else
  614. extern
  615. #endif /* mig_external */
  616. mig_routine_t mach_exc_server_routine(
  617. mach_msg_header_t *InHeadP);
  618. /* Description of this subsystem, for use in direct RPC */
  619. const struct catch_mach_exc_subsystem {
  620. mig_server_routine_t server; /* Server routine */
  621. mach_msg_id_t start; /* Min routine number */
  622. mach_msg_id_t end; /* Max routine number + 1 */
  623. unsigned int maxsize; /* Max msg size */
  624. vm_address_t reserved; /* Reserved */
  625. struct routine_descriptor /*Array of routine descriptors */
  626. routine[3];
  627. } catch_mach_exc_subsystem = {
  628. mach_exc_server_routine,
  629. 2405,
  630. 2408,
  631. (mach_msg_size_t)sizeof(union __ReplyUnion__catch_mach_exc_subsystem),
  632. (vm_address_t)0,
  633. {
  634. { (mig_impl_routine_t) 0,
  635. (mig_stub_routine_t) _Xmach_exception_raise, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_exception_raise_t)},
  636. { (mig_impl_routine_t) 0,
  637. (mig_stub_routine_t) _Xmach_exception_raise_state, 9, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_exception_raise_state_t)},
  638. { (mig_impl_routine_t) 0,
  639. (mig_stub_routine_t) _Xmach_exception_raise_state_identity, 11, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_exception_raise_state_identity_t)},
  640. }
  641. };
  642. mig_external boolean_t mach_exc_server
  643. (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
  644. {
  645. /*
  646. * typedef struct {
  647. * mach_msg_header_t Head;
  648. * NDR_record_t NDR;
  649. * kern_return_t RetCode;
  650. * } mig_reply_error_t;
  651. */
  652. mig_routine_t routine;
  653. OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0);
  654. OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port;
  655. /* Minimal size: routine() will update it if different */
  656. OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t);
  657. OutHeadP->msgh_local_port = MACH_PORT_NULL;
  658. OutHeadP->msgh_id = InHeadP->msgh_id + 100;
  659. OutHeadP->msgh_reserved = 0;
  660. if ((InHeadP->msgh_id > 2407) || (InHeadP->msgh_id < 2405) ||
  661. ((routine = catch_mach_exc_subsystem.routine[InHeadP->msgh_id - 2405].stub_routine) == 0)) {
  662. ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
  663. ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
  664. return FALSE;
  665. }
  666. (*routine) (InHeadP, OutHeadP);
  667. return TRUE;
  668. }
  669. mig_external mig_routine_t mach_exc_server_routine
  670. (mach_msg_header_t *InHeadP)
  671. {
  672. int msgh_id;
  673. msgh_id = InHeadP->msgh_id - 2405;
  674. if ((msgh_id > 2) || (msgh_id < 0))
  675. return 0;
  676. return catch_mach_exc_subsystem.routine[msgh_id].stub_routine;
  677. }