gitlab.com/Raven-IO/raven-delve@v1.22.4/pkg/proc/native/mach_exc_user_darwin.c (about)

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