mach_excServer.c 25 KB

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