diff options
Diffstat (limited to 'boot.backup1/ourmachServer.c')
-rw-r--r-- | boot.backup1/ourmachServer.c | 4197 |
1 files changed, 4197 insertions, 0 deletions
diff --git a/boot.backup1/ourmachServer.c b/boot.backup1/ourmachServer.c new file mode 100644 index 00000000..6212e18e --- /dev/null +++ b/boot.backup1/ourmachServer.c @@ -0,0 +1,4197 @@ +/* Module mach */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#define EXPORT_BOOLEAN +#include <mach/boolean.h> +#include <mach/kern_return.h> +#include <mach/message.h> +#include <mach/mig_errors.h> +#include <mach/mig_support.h> + +#ifndef mig_internal +#define mig_internal static +#endif + +#ifndef mig_external +#define mig_external +#endif + +#ifndef TypeCheck +#define TypeCheck 1 +#endif + +#ifndef UseExternRCSId +#define UseExternRCSId 1 +#endif + +#define BAD_TYPECHECK(type, check) ({\ + union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\ + _t.t = *(type); _c.t = *(check); _t.w != _c.w; }) +#define msgh_request_port msgh_local_port +#define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits) +#define msgh_reply_port msgh_remote_port +#define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits) + +#include <mach/std_types.h> +#include <mach/mach_types.h> + +/* Routine task_create */ +mig_internal void _Xtask_create + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t inherit_memoryType; + boolean_t inherit_memory; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t child_taskType; + mach_port_t child_task; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_create + (mach_port_t target_task, boolean_t inherit_memory, mach_port_t *child_task, mach_msg_type_name_t *child_taskPoly); + + boolean_t msgh_simple; + auto const mach_msg_type_t inherit_memoryCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t child_taskType = { + /* msgt_name = */ -1, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + mach_msg_type_name_t child_taskPoly; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->inherit_memoryType, &inherit_memoryCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_create(In0P->Head.msgh_request_port, In0P->inherit_memory, &OutP->child_task, &child_taskPoly); + if (OutP->RetCode != KERN_SUCCESS) + return; + + msgh_simple = TRUE; + OutP->Head.msgh_size = 40; + + OutP->child_taskType = child_taskType; + + if (MACH_MSG_TYPE_PORT_ANY(child_taskPoly)) + msgh_simple = FALSE; + + OutP->child_taskType.msgt_name = child_taskPoly; + + if (!msgh_simple) + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; +} + +/* Routine task_terminate */ +mig_internal void _Xtask_terminate + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_terminate + (mach_port_t target_task); + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_terminate(In0P->Head.msgh_request_port); +} + +/* Routine task_get_emulation_vector */ +mig_internal void _Xtask_get_emulation_vector + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t vector_startType; + int vector_start; + mach_msg_type_long_t emulation_vectorType; + emulation_vector_t emulation_vector; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_get_emulation_vector + (mach_port_t task, int *vector_start, emulation_vector_t *emulation_vector, mach_msg_type_number_t *emulation_vectorCnt); + + auto const mach_msg_type_t vector_startType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_long_t emulation_vectorType = { + { + /* msgt_name = */ 0, + /* msgt_size = */ 0, + /* msgt_number = */ 0, + /* msgt_inline = */ FALSE, + /* msgt_longform = */ TRUE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }, + /* msgtl_name = */ 2, + /* msgtl_size = */ 32, + /* msgtl_number = */ 0, + }; + + mach_msg_type_number_t emulation_vectorCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_get_emulation_vector(In0P->Head.msgh_request_port, &OutP->vector_start, &OutP->emulation_vector, &emulation_vectorCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = 56; + + OutP->vector_startType = vector_startType; + + OutP->emulation_vectorType = emulation_vectorType; + + OutP->emulation_vectorType.msgtl_number = emulation_vectorCnt; +} + +/* Routine task_set_emulation_vector */ +mig_internal void _Xtask_set_emulation_vector + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t vector_startType; + int vector_start; + mach_msg_type_long_t emulation_vectorType; + emulation_vector_t emulation_vector; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_set_emulation_vector + (mach_port_t task, int vector_start, emulation_vector_t emulation_vector, mach_msg_type_number_t emulation_vectorCnt); + + auto const mach_msg_type_t vector_startCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 48) || + !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->vector_startType, &vector_startCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->emulation_vectorType.msgtl_header.msgt_inline != FALSE) || + (In0P->emulation_vectorType.msgtl_header.msgt_longform != TRUE) || + (In0P->emulation_vectorType.msgtl_name != 2) || + (In0P->emulation_vectorType.msgtl_size != 32)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_set_emulation_vector(In0P->Head.msgh_request_port, In0P->vector_start, In0P->emulation_vector, In0P->emulation_vectorType.msgtl_number); +} + +/* Routine task_threads */ +mig_internal void _Xtask_threads + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_long_t thread_listType; + thread_array_t thread_list; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_threads + (mach_port_t target_task, thread_array_t *thread_list, mach_msg_type_number_t *thread_listCnt); + + auto const mach_msg_type_long_t thread_listType = { + { + /* msgt_name = */ 0, + /* msgt_size = */ 0, + /* msgt_number = */ 0, + /* msgt_inline = */ FALSE, + /* msgt_longform = */ TRUE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }, + /* msgtl_name = */ 19, + /* msgtl_size = */ 32, + /* msgtl_number = */ 0, + }; + + mach_msg_type_number_t thread_listCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_threads(In0P->Head.msgh_request_port, &OutP->thread_list, &thread_listCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = 48; + + OutP->thread_listType = thread_listType; + + OutP->thread_listType.msgtl_number = thread_listCnt; +} + +/* Routine task_info */ +mig_internal void _Xtask_info + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t flavorType; + int flavor; + mach_msg_type_t task_info_outCntType; + mach_msg_type_number_t task_info_outCnt; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t task_info_outType; + natural_t task_info_out[1024]; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_info + (mach_port_t target_task, int flavor, task_info_t task_info_out, mach_msg_type_number_t *task_info_outCnt); + + auto const mach_msg_type_t flavorCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t task_info_outCntCheck = { + /* msgt_name = */ MACH_MSG_TYPE_INTEGER_32, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t task_info_outType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1024, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + mach_msg_type_number_t task_info_outCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->task_info_outCntType, &task_info_outCntCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + task_info_outCnt = 1024; + if (In0P->task_info_outCnt < task_info_outCnt) + task_info_outCnt = In0P->task_info_outCnt; + + OutP->RetCode = S_task_info(In0P->Head.msgh_request_port, In0P->flavor, OutP->task_info_out, &task_info_outCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->task_info_outType = task_info_outType; + + OutP->task_info_outType.msgt_number = task_info_outCnt; + OutP->Head.msgh_size = 36 + (4 * task_info_outCnt); +} + +/* Routine thread_terminate */ +mig_internal void _Xthread_terminate + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_terminate + (mach_port_t target_thread); + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_thread_terminate(In0P->Head.msgh_request_port); +} + +/* Routine thread_get_state */ +mig_internal void _Xthread_get_state + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t flavorType; + int flavor; + mach_msg_type_t old_stateCntType; + mach_msg_type_number_t old_stateCnt; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t old_stateType; + natural_t old_state[1024]; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_get_state + (mach_port_t target_thread, int flavor, thread_state_t old_state, mach_msg_type_number_t *old_stateCnt); + + auto const mach_msg_type_t flavorCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t old_stateCntCheck = { + /* msgt_name = */ MACH_MSG_TYPE_INTEGER_32, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t old_stateType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1024, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + mach_msg_type_number_t old_stateCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->old_stateCntType, &old_stateCntCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + old_stateCnt = 1024; + if (In0P->old_stateCnt < old_stateCnt) + old_stateCnt = In0P->old_stateCnt; + + OutP->RetCode = S_thread_get_state(In0P->Head.msgh_request_port, In0P->flavor, OutP->old_state, &old_stateCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->old_stateType = old_stateType; + + OutP->old_stateType.msgt_number = old_stateCnt; + OutP->Head.msgh_size = 36 + (4 * old_stateCnt); +} + +/* Routine thread_set_state */ +mig_internal void _Xthread_set_state + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t flavorType; + int flavor; + mach_msg_type_t new_stateType; + natural_t new_state[1024]; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_set_state + (mach_port_t target_thread, int flavor, thread_state_t new_state, mach_msg_type_number_t new_stateCnt); + + unsigned int msgh_size; + + auto const mach_msg_type_t flavorCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + msgh_size = In0P->Head.msgh_size; + if ((msgh_size < 36) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->new_stateType.msgt_inline != TRUE) || + (In0P->new_stateType.msgt_longform != FALSE) || + (In0P->new_stateType.msgt_name != 2) || + (In0P->new_stateType.msgt_size != 32)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (msgh_size != 36 + (4 * In0P->new_stateType.msgt_number)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_thread_set_state(In0P->Head.msgh_request_port, In0P->flavor, In0P->new_state, In0P->new_stateType.msgt_number); +} + +/* Routine thread_info */ +mig_internal void _Xthread_info + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t flavorType; + int flavor; + mach_msg_type_t thread_info_outCntType; + mach_msg_type_number_t thread_info_outCnt; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t thread_info_outType; + natural_t thread_info_out[1024]; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_info + (mach_port_t target_thread, int flavor, thread_info_t thread_info_out, mach_msg_type_number_t *thread_info_outCnt); + + auto const mach_msg_type_t flavorCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t thread_info_outCntCheck = { + /* msgt_name = */ MACH_MSG_TYPE_INTEGER_32, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t thread_info_outType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1024, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + mach_msg_type_number_t thread_info_outCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->thread_info_outCntType, &thread_info_outCntCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + thread_info_outCnt = 1024; + if (In0P->thread_info_outCnt < thread_info_outCnt) + thread_info_outCnt = In0P->thread_info_outCnt; + + OutP->RetCode = S_thread_info(In0P->Head.msgh_request_port, In0P->flavor, OutP->thread_info_out, &thread_info_outCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->thread_info_outType = thread_info_outType; + + OutP->thread_info_outType.msgt_number = thread_info_outCnt; + OutP->Head.msgh_size = 36 + (4 * thread_info_outCnt); +} + +/* Routine vm_allocate */ +mig_internal void _Xvm_allocate + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t addressType; + vm_address_t address; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t anywhereType; + boolean_t anywhere; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t addressType; + vm_address_t address; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_allocate + (mach_port_t target_task, vm_address_t *address, vm_size_t size, boolean_t anywhere); + + auto const mach_msg_type_t addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t anywhereCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t addressType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 48) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->anywhereType, &anywhereCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_allocate(In0P->Head.msgh_request_port, &In0P->address, In0P->size, In0P->anywhere); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_size = 40; + + OutP->addressType = addressType; + + OutP->address = In0P->address; +} + +/* Routine vm_deallocate */ +mig_internal void _Xvm_deallocate + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t addressType; + vm_address_t address; + mach_msg_type_t sizeType; + vm_size_t size; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_deallocate + (mach_port_t target_task, vm_address_t address, vm_size_t size); + + auto const mach_msg_type_t addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_deallocate(In0P->Head.msgh_request_port, In0P->address, In0P->size); +} + +/* Routine vm_protect */ +mig_internal void _Xvm_protect + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t addressType; + vm_address_t address; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t set_maximumType; + boolean_t set_maximum; + mach_msg_type_t new_protectionType; + vm_prot_t new_protection; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_protect + (mach_port_t target_task, vm_address_t address, vm_size_t size, boolean_t set_maximum, vm_prot_t new_protection); + + auto const mach_msg_type_t addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t set_maximumCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t new_protectionCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 56) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->set_maximumType, &set_maximumCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->new_protectionType, &new_protectionCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_protect(In0P->Head.msgh_request_port, In0P->address, In0P->size, In0P->set_maximum, In0P->new_protection); +} + +/* Routine vm_inherit */ +mig_internal void _Xvm_inherit + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t addressType; + vm_address_t address; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t new_inheritanceType; + vm_inherit_t new_inheritance; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_inherit + (mach_port_t target_task, vm_address_t address, vm_size_t size, vm_inherit_t new_inheritance); + + auto const mach_msg_type_t addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t new_inheritanceCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 48) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->new_inheritanceType, &new_inheritanceCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_inherit(In0P->Head.msgh_request_port, In0P->address, In0P->size, In0P->new_inheritance); +} + +/* Routine vm_read */ +mig_internal void _Xvm_read + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t addressType; + vm_address_t address; + mach_msg_type_t sizeType; + vm_size_t size; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_long_t dataType; + vm_offset_t data; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_read + (mach_port_t target_task, vm_address_t address, vm_size_t size, vm_offset_t *data, mach_msg_type_number_t *dataCnt); + + auto const mach_msg_type_t addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_long_t dataType = { + { + /* msgt_name = */ 0, + /* msgt_size = */ 0, + /* msgt_number = */ 0, + /* msgt_inline = */ FALSE, + /* msgt_longform = */ TRUE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }, + /* msgtl_name = */ 9, + /* msgtl_size = */ 8, + /* msgtl_number = */ 0, + }; + + mach_msg_type_number_t dataCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_read(In0P->Head.msgh_request_port, In0P->address, In0P->size, &OutP->data, &dataCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = 48; + + OutP->dataType = dataType; + + OutP->dataType.msgtl_number = dataCnt; +} + +/* Routine vm_write */ +mig_internal void _Xvm_write + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t addressType; + vm_address_t address; + mach_msg_type_long_t dataType; + vm_offset_t data; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_write + (mach_port_t target_task, vm_address_t address, vm_offset_t data, mach_msg_type_number_t dataCnt); + + auto const mach_msg_type_t addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 48) || + !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->dataType.msgtl_header.msgt_inline != FALSE) || + (In0P->dataType.msgtl_header.msgt_longform != TRUE) || + (In0P->dataType.msgtl_name != 9) || + (In0P->dataType.msgtl_size != 8)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_write(In0P->Head.msgh_request_port, In0P->address, In0P->data, In0P->dataType.msgtl_number); +} + +/* Routine vm_copy */ +mig_internal void _Xvm_copy + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t source_addressType; + vm_address_t source_address; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t dest_addressType; + vm_address_t dest_address; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_copy + (mach_port_t target_task, vm_address_t source_address, vm_size_t size, vm_address_t dest_address); + + auto const mach_msg_type_t source_addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t dest_addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 48) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->source_addressType, &source_addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->dest_addressType, &dest_addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_copy(In0P->Head.msgh_request_port, In0P->source_address, In0P->size, In0P->dest_address); +} + +/* Routine vm_region */ +mig_internal void _Xvm_region + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t addressType; + vm_address_t address; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t addressType; + vm_address_t address; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t protectionType; + vm_prot_t protection; + mach_msg_type_t max_protectionType; + vm_prot_t max_protection; + mach_msg_type_t inheritanceType; + vm_inherit_t inheritance; + mach_msg_type_t is_sharedType; + boolean_t is_shared; + mach_msg_type_t object_nameType; + mach_port_t object_name; + mach_msg_type_t offsetType; + vm_offset_t offset; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_region + (mach_port_t target_task, vm_address_t *address, vm_size_t *size, vm_prot_t *protection, vm_prot_t *max_protection, vm_inherit_t *inheritance, boolean_t *is_shared, mach_port_t *object_name, vm_offset_t *offset); + + auto const mach_msg_type_t addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t addressType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t protectionType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t max_protectionType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t inheritanceType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t is_sharedType = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t object_nameType = { + /* msgt_name = */ 17, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t offsetType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_region(In0P->Head.msgh_request_port, &In0P->address, &OutP->size, &OutP->protection, &OutP->max_protection, &OutP->inheritance, &OutP->is_shared, &OutP->object_name, &OutP->offset); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = 96; + + OutP->addressType = addressType; + + OutP->address = In0P->address; + + OutP->sizeType = sizeType; + + OutP->protectionType = protectionType; + + OutP->max_protectionType = max_protectionType; + + OutP->inheritanceType = inheritanceType; + + OutP->is_sharedType = is_sharedType; + + OutP->object_nameType = object_nameType; + + OutP->offsetType = offsetType; +} + +/* Routine vm_statistics */ +mig_internal void _Xvm_statistics + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t vm_statsType; + vm_statistics_data_t vm_stats; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_statistics + (mach_port_t target_task, vm_statistics_data_t *vm_stats); + + auto const mach_msg_type_t vm_statsType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 13, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_statistics(In0P->Head.msgh_request_port, &OutP->vm_stats); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_size = 88; + + OutP->vm_statsType = vm_statsType; +} + +/* Routine mach_ports_register */ +mig_internal void _Xmach_ports_register + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_long_t init_port_setType; + mach_port_array_t init_port_set; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_mach_ports_register + (mach_port_t target_task, mach_port_array_t init_port_set, mach_msg_type_number_t init_port_setCnt); + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->init_port_setType.msgtl_header.msgt_inline != FALSE) || + (In0P->init_port_setType.msgtl_header.msgt_longform != TRUE) || + (In0P->init_port_setType.msgtl_name != 17) || + (In0P->init_port_setType.msgtl_size != 32)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_mach_ports_register(In0P->Head.msgh_request_port, In0P->init_port_set, In0P->init_port_setType.msgtl_number); +} + +/* Routine mach_ports_lookup */ +mig_internal void _Xmach_ports_lookup + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_long_t init_port_setType; + mach_port_array_t init_port_set; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_mach_ports_lookup + (mach_port_t target_task, mach_port_array_t *init_port_set, mach_msg_type_number_t *init_port_setCnt); + + auto const mach_msg_type_long_t init_port_setType = { + { + /* msgt_name = */ 0, + /* msgt_size = */ 0, + /* msgt_number = */ 0, + /* msgt_inline = */ FALSE, + /* msgt_longform = */ TRUE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }, + /* msgtl_name = */ 19, + /* msgtl_size = */ 32, + /* msgtl_number = */ 0, + }; + + mach_msg_type_number_t init_port_setCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_mach_ports_lookup(In0P->Head.msgh_request_port, &OutP->init_port_set, &init_port_setCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = 48; + + OutP->init_port_setType = init_port_setType; + + OutP->init_port_setType.msgtl_number = init_port_setCnt; +} + +/* SimpleRoutine memory_object_data_provided */ +mig_internal void _Xmemory_object_data_provided + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t offsetType; + vm_offset_t offset; + mach_msg_type_long_t dataType; + vm_offset_t data; + mach_msg_type_t lock_valueType; + vm_prot_t lock_value; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_data_provided + (mach_port_t memory_control, vm_offset_t offset, vm_offset_t data, mach_msg_type_number_t dataCnt, vm_prot_t lock_value); + + auto const mach_msg_type_t offsetCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t lock_valueCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 56) || + !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->dataType.msgtl_header.msgt_inline != FALSE) || + (In0P->dataType.msgtl_header.msgt_longform != TRUE) || + (In0P->dataType.msgtl_name != 9) || + (In0P->dataType.msgtl_size != 8)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->lock_valueType, &lock_valueCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_data_provided(In0P->Head.msgh_request_port, In0P->offset, In0P->data, In0P->dataType.msgtl_number, In0P->lock_value); +} + +/* SimpleRoutine memory_object_data_unavailable */ +mig_internal void _Xmemory_object_data_unavailable + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t offsetType; + vm_offset_t offset; + mach_msg_type_t sizeType; + vm_size_t size; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_data_unavailable + (mach_port_t memory_control, vm_offset_t offset, vm_size_t size); + + auto const mach_msg_type_t offsetCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_data_unavailable(In0P->Head.msgh_request_port, In0P->offset, In0P->size); +} + +/* Routine memory_object_get_attributes */ +mig_internal void _Xmemory_object_get_attributes + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t object_readyType; + boolean_t object_ready; + mach_msg_type_t may_cacheType; + boolean_t may_cache; + mach_msg_type_t copy_strategyType; + memory_object_copy_strategy_t copy_strategy; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_get_attributes + (mach_port_t memory_control, boolean_t *object_ready, boolean_t *may_cache, memory_object_copy_strategy_t *copy_strategy); + + auto const mach_msg_type_t object_readyType = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t may_cacheType = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t copy_strategyType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_get_attributes(In0P->Head.msgh_request_port, &OutP->object_ready, &OutP->may_cache, &OutP->copy_strategy); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_size = 56; + + OutP->object_readyType = object_readyType; + + OutP->may_cacheType = may_cacheType; + + OutP->copy_strategyType = copy_strategyType; +} + +/* Routine vm_set_default_memory_manager */ +mig_internal void _Xvm_set_default_memory_manager + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t default_managerType; + mach_port_t default_manager; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t default_managerType; + mach_port_t default_manager; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_set_default_memory_manager + (mach_port_t host_priv, mach_port_t *default_manager); + + auto const mach_msg_type_t default_managerCheck = { + /* msgt_name = */ 17, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t default_managerType = { + /* msgt_name = */ 19, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->default_managerType, &default_managerCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_set_default_memory_manager(In0P->Head.msgh_request_port, &In0P->default_manager); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = 40; + + OutP->default_managerType = default_managerType; + + OutP->default_manager = In0P->default_manager; +} + +/* SimpleRoutine xxx_memory_object_lock_request */ +mig_internal void _Xxxx_memory_object_lock_request + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t offsetType; + vm_offset_t offset; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t should_cleanType; + boolean_t should_clean; + mach_msg_type_t should_flushType; + boolean_t should_flush; + mach_msg_type_t lock_valueType; + vm_prot_t lock_value; + mach_msg_type_t reply_toType; + mach_port_t reply_to; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_memory_object_lock_request + (mach_port_t memory_control, vm_offset_t offset, vm_size_t size, boolean_t should_clean, boolean_t should_flush, vm_prot_t lock_value, mach_port_t reply_to, mach_msg_type_name_t reply_toPoly); + +#if TypeCheck + boolean_t msgh_simple; +#endif /* TypeCheck */ + + auto const mach_msg_type_t offsetCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t should_cleanCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t should_flushCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t lock_valueCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); + if ((In0P->Head.msgh_size != 72)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->should_cleanType, &should_cleanCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->should_flushType, &should_flushCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->lock_valueType, &lock_valueCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->reply_toType.msgt_inline != TRUE) || + (In0P->reply_toType.msgt_longform != FALSE) || + (MACH_MSG_TYPE_PORT_ANY(In0P->reply_toType.msgt_name) && msgh_simple) || + (In0P->reply_toType.msgt_number != 1) || + (In0P->reply_toType.msgt_size != 32)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_xxx_memory_object_lock_request(In0P->Head.msgh_request_port, In0P->offset, In0P->size, In0P->should_clean, In0P->should_flush, In0P->lock_value, In0P->reply_to, In0P->reply_toType.msgt_name); +} + +/* SimpleRoutine memory_object_lock_request */ +mig_internal void _Xmemory_object_lock_request + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t offsetType; + vm_offset_t offset; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t should_returnType; + memory_object_return_t should_return; + mach_msg_type_t should_flushType; + boolean_t should_flush; + mach_msg_type_t lock_valueType; + vm_prot_t lock_value; + mach_msg_type_t reply_toType; + mach_port_t reply_to; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_lock_request + (mach_port_t memory_control, vm_offset_t offset, vm_size_t size, memory_object_return_t should_return, boolean_t should_flush, vm_prot_t lock_value, mach_port_t reply_to, mach_msg_type_name_t reply_toPoly); + +#if TypeCheck + boolean_t msgh_simple; +#endif /* TypeCheck */ + + auto const mach_msg_type_t offsetCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t should_returnCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t should_flushCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t lock_valueCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); + if ((In0P->Head.msgh_size != 72)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->should_returnType, &should_returnCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->should_flushType, &should_flushCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->lock_valueType, &lock_valueCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->reply_toType.msgt_inline != TRUE) || + (In0P->reply_toType.msgt_longform != FALSE) || + (MACH_MSG_TYPE_PORT_ANY(In0P->reply_toType.msgt_name) && msgh_simple) || + (In0P->reply_toType.msgt_number != 1) || + (In0P->reply_toType.msgt_size != 32)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_lock_request(In0P->Head.msgh_request_port, In0P->offset, In0P->size, In0P->should_return, In0P->should_flush, In0P->lock_value, In0P->reply_to, In0P->reply_toType.msgt_name); +} + +/* Routine xxx_task_get_emulation_vector */ +mig_internal void _Xxxx_task_get_emulation_vector + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t vector_startType; + int vector_start; + mach_msg_type_long_t emulation_vectorType; + vm_offset_t emulation_vector[1024]; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_task_get_emulation_vector + (mach_port_t task, int *vector_start, emulation_vector_t emulation_vector, mach_msg_type_number_t *emulation_vectorCnt); + + auto const mach_msg_type_t vector_startType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_long_t emulation_vectorType = { + { + /* msgt_name = */ 0, + /* msgt_size = */ 0, + /* msgt_number = */ 0, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ TRUE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }, + /* msgtl_name = */ 2, + /* msgtl_size = */ 32, + /* msgtl_number = */ 1024, + }; + + mach_msg_type_number_t emulation_vectorCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + emulation_vectorCnt = 1024; + + OutP->RetCode = S_xxx_task_get_emulation_vector(In0P->Head.msgh_request_port, &OutP->vector_start, OutP->emulation_vector, &emulation_vectorCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->vector_startType = vector_startType; + + OutP->emulation_vectorType = emulation_vectorType; + + OutP->emulation_vectorType.msgtl_number = emulation_vectorCnt; + OutP->Head.msgh_size = 52 + (4 * emulation_vectorCnt); +} + +/* Routine xxx_task_set_emulation_vector */ +mig_internal void _Xxxx_task_set_emulation_vector + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t vector_startType; + int vector_start; + mach_msg_type_long_t emulation_vectorType; + vm_offset_t emulation_vector[1024]; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_task_set_emulation_vector + (mach_port_t task, int vector_start, emulation_vector_t emulation_vector, mach_msg_type_number_t emulation_vectorCnt); + + unsigned int msgh_size; + + auto const mach_msg_type_t vector_startCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + msgh_size = In0P->Head.msgh_size; + if ((msgh_size < 44) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->vector_startType, &vector_startCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->emulation_vectorType.msgtl_header.msgt_inline != TRUE) || + (In0P->emulation_vectorType.msgtl_header.msgt_longform != TRUE) || + (In0P->emulation_vectorType.msgtl_name != 2) || + (In0P->emulation_vectorType.msgtl_size != 32)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (msgh_size != 44 + (4 * In0P->emulation_vectorType.msgtl_number)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_xxx_task_set_emulation_vector(In0P->Head.msgh_request_port, In0P->vector_start, In0P->emulation_vector, In0P->emulation_vectorType.msgtl_number); +} + +/* Routine xxx_host_info */ +mig_internal void _Xxxx_host_info + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t infoType; + machine_info_data_t info; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_host_info + (mach_port_t target_task, machine_info_data_t *info); + + auto const mach_msg_type_t infoType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 5, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_xxx_host_info(In0P->Head.msgh_request_port, &OutP->info); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_size = 56; + + OutP->infoType = infoType; +} + +/* Routine xxx_slot_info */ +mig_internal void _Xxxx_slot_info + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t slotType; + int slot; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t infoType; + machine_slot_data_t info; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_slot_info + (mach_port_t target_task, int slot, machine_slot_data_t *info); + + auto const mach_msg_type_t slotCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t infoType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 8, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->slotType, &slotCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_xxx_slot_info(In0P->Head.msgh_request_port, In0P->slot, &OutP->info); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_size = 68; + + OutP->infoType = infoType; +} + +/* Routine xxx_cpu_control */ +mig_internal void _Xxxx_cpu_control + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t cpuType; + int cpu; + mach_msg_type_t runningType; + boolean_t running; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_cpu_control + (mach_port_t target_task, int cpu, boolean_t running); + + auto const mach_msg_type_t cpuCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t runningCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->cpuType, &cpuCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->runningType, &runningCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_xxx_cpu_control(In0P->Head.msgh_request_port, In0P->cpu, In0P->running); +} + +/* Routine task_suspend */ +mig_internal void _Xtask_suspend + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_suspend + (mach_port_t target_task); + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_suspend(In0P->Head.msgh_request_port); +} + +/* Routine task_resume */ +mig_internal void _Xtask_resume + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_resume + (mach_port_t target_task); + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_resume(In0P->Head.msgh_request_port); +} + +/* Routine task_get_special_port */ +mig_internal void _Xtask_get_special_port + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t which_portType; + int which_port; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t special_portType; + mach_port_t special_port; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_get_special_port + (mach_port_t task, int which_port, mach_port_t *special_port, mach_msg_type_name_t *special_portPoly); + + boolean_t msgh_simple; + auto const mach_msg_type_t which_portCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t special_portType = { + /* msgt_name = */ -1, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + mach_msg_type_name_t special_portPoly; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->which_portType, &which_portCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_get_special_port(In0P->Head.msgh_request_port, In0P->which_port, &OutP->special_port, &special_portPoly); + if (OutP->RetCode != KERN_SUCCESS) + return; + + msgh_simple = TRUE; + OutP->Head.msgh_size = 40; + + OutP->special_portType = special_portType; + + if (MACH_MSG_TYPE_PORT_ANY(special_portPoly)) + msgh_simple = FALSE; + + OutP->special_portType.msgt_name = special_portPoly; + + if (!msgh_simple) + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; +} + +/* Routine task_set_special_port */ +mig_internal void _Xtask_set_special_port + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t which_portType; + int which_port; + mach_msg_type_t special_portType; + mach_port_t special_port; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_set_special_port + (mach_port_t task, int which_port, mach_port_t special_port); + + auto const mach_msg_type_t which_portCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t special_portCheck = { + /* msgt_name = */ 17, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->which_portType, &which_portCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->special_portType, &special_portCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_set_special_port(In0P->Head.msgh_request_port, In0P->which_port, In0P->special_port); +} + +/* Routine xxx_task_info */ +mig_internal void _Xxxx_task_info + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t flavorType; + int flavor; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_long_t task_info_outType; + natural_t task_info_out[1024]; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_task_info + (mach_port_t target_task, int flavor, task_info_t task_info_out, mach_msg_type_number_t *task_info_outCnt); + + auto const mach_msg_type_t flavorCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_long_t task_info_outType = { + { + /* msgt_name = */ 0, + /* msgt_size = */ 0, + /* msgt_number = */ 0, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ TRUE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }, + /* msgtl_name = */ 2, + /* msgtl_size = */ 32, + /* msgtl_number = */ 1024, + }; + + mach_msg_type_number_t task_info_outCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + task_info_outCnt = 1024; + + OutP->RetCode = S_xxx_task_info(In0P->Head.msgh_request_port, In0P->flavor, OutP->task_info_out, &task_info_outCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->task_info_outType = task_info_outType; + + OutP->task_info_outType.msgtl_number = task_info_outCnt; + OutP->Head.msgh_size = 44 + (4 * task_info_outCnt); +} + +/* Routine thread_create */ +mig_internal void _Xthread_create + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t child_threadType; + mach_port_t child_thread; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_create + (mach_port_t parent_task, mach_port_t *child_thread, mach_msg_type_name_t *child_threadPoly); + + boolean_t msgh_simple; + auto const mach_msg_type_t child_threadType = { + /* msgt_name = */ -1, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + mach_msg_type_name_t child_threadPoly; + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_thread_create(In0P->Head.msgh_request_port, &OutP->child_thread, &child_threadPoly); + if (OutP->RetCode != KERN_SUCCESS) + return; + + msgh_simple = TRUE; + OutP->Head.msgh_size = 40; + + OutP->child_threadType = child_threadType; + + if (MACH_MSG_TYPE_PORT_ANY(child_threadPoly)) + msgh_simple = FALSE; + + OutP->child_threadType.msgt_name = child_threadPoly; + + if (!msgh_simple) + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; +} + +/* Routine thread_suspend */ +mig_internal void _Xthread_suspend + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_suspend + (mach_port_t target_thread); + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_thread_suspend(In0P->Head.msgh_request_port); +} + +/* Routine thread_resume */ +mig_internal void _Xthread_resume + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_resume + (mach_port_t target_thread); + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_thread_resume(In0P->Head.msgh_request_port); +} + +/* Routine thread_abort */ +mig_internal void _Xthread_abort + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_abort + (mach_port_t target_thread); + +#if TypeCheck + if ((In0P->Head.msgh_size != 24) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_thread_abort(In0P->Head.msgh_request_port); +} + +/* Routine xxx_thread_get_state */ +mig_internal void _Xxxx_thread_get_state + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t flavorType; + int flavor; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_long_t old_stateType; + natural_t old_state[1024]; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_thread_get_state + (mach_port_t target_thread, int flavor, thread_state_t old_state, mach_msg_type_number_t *old_stateCnt); + + auto const mach_msg_type_t flavorCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_long_t old_stateType = { + { + /* msgt_name = */ 0, + /* msgt_size = */ 0, + /* msgt_number = */ 0, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ TRUE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }, + /* msgtl_name = */ 2, + /* msgtl_size = */ 32, + /* msgtl_number = */ 1024, + }; + + mach_msg_type_number_t old_stateCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + old_stateCnt = 1024; + + OutP->RetCode = S_xxx_thread_get_state(In0P->Head.msgh_request_port, In0P->flavor, OutP->old_state, &old_stateCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->old_stateType = old_stateType; + + OutP->old_stateType.msgtl_number = old_stateCnt; + OutP->Head.msgh_size = 44 + (4 * old_stateCnt); +} + +/* Routine xxx_thread_set_state */ +mig_internal void _Xxxx_thread_set_state + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t flavorType; + int flavor; + mach_msg_type_long_t new_stateType; + natural_t new_state[1024]; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_thread_set_state + (mach_port_t target_thread, int flavor, thread_state_t new_state, mach_msg_type_number_t new_stateCnt); + + unsigned int msgh_size; + + auto const mach_msg_type_t flavorCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + msgh_size = In0P->Head.msgh_size; + if ((msgh_size < 44) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->new_stateType.msgtl_header.msgt_inline != TRUE) || + (In0P->new_stateType.msgtl_header.msgt_longform != TRUE) || + (In0P->new_stateType.msgtl_name != 2) || + (In0P->new_stateType.msgtl_size != 32)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (msgh_size != 44 + (4 * In0P->new_stateType.msgtl_number)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_xxx_thread_set_state(In0P->Head.msgh_request_port, In0P->flavor, In0P->new_state, In0P->new_stateType.msgtl_number); +} + +/* Routine thread_get_special_port */ +mig_internal void _Xthread_get_special_port + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t which_portType; + int which_port; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t special_portType; + mach_port_t special_port; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_get_special_port + (mach_port_t thread, int which_port, mach_port_t *special_port, mach_msg_type_name_t *special_portPoly); + + boolean_t msgh_simple; + auto const mach_msg_type_t which_portCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t special_portType = { + /* msgt_name = */ -1, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + mach_msg_type_name_t special_portPoly; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->which_portType, &which_portCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_thread_get_special_port(In0P->Head.msgh_request_port, In0P->which_port, &OutP->special_port, &special_portPoly); + if (OutP->RetCode != KERN_SUCCESS) + return; + + msgh_simple = TRUE; + OutP->Head.msgh_size = 40; + + OutP->special_portType = special_portType; + + if (MACH_MSG_TYPE_PORT_ANY(special_portPoly)) + msgh_simple = FALSE; + + OutP->special_portType.msgt_name = special_portPoly; + + if (!msgh_simple) + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; +} + +/* Routine thread_set_special_port */ +mig_internal void _Xthread_set_special_port + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t which_portType; + int which_port; + mach_msg_type_t special_portType; + mach_port_t special_port; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_thread_set_special_port + (mach_port_t thread, int which_port, mach_port_t special_port); + + auto const mach_msg_type_t which_portCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t special_portCheck = { + /* msgt_name = */ 17, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->which_portType, &which_portCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->special_portType, &special_portCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_thread_set_special_port(In0P->Head.msgh_request_port, In0P->which_port, In0P->special_port); +} + +/* Routine xxx_thread_info */ +mig_internal void _Xxxx_thread_info + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t flavorType; + int flavor; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_long_t thread_info_outType; + natural_t thread_info_out[1024]; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_xxx_thread_info + (mach_port_t target_thread, int flavor, thread_info_t thread_info_out, mach_msg_type_number_t *thread_info_outCnt); + + auto const mach_msg_type_t flavorCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_long_t thread_info_outType = { + { + /* msgt_name = */ 0, + /* msgt_size = */ 0, + /* msgt_number = */ 0, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ TRUE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }, + /* msgtl_name = */ 2, + /* msgtl_size = */ 32, + /* msgtl_number = */ 1024, + }; + + mach_msg_type_number_t thread_info_outCnt; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + thread_info_outCnt = 1024; + + OutP->RetCode = S_xxx_thread_info(In0P->Head.msgh_request_port, In0P->flavor, OutP->thread_info_out, &thread_info_outCnt); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->thread_info_outType = thread_info_outType; + + OutP->thread_info_outType.msgtl_number = thread_info_outCnt; + OutP->Head.msgh_size = 44 + (4 * thread_info_outCnt); +} + +/* Routine task_set_emulation */ +mig_internal void _Xtask_set_emulation + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t routine_entry_ptType; + vm_address_t routine_entry_pt; + mach_msg_type_t routine_numberType; + int routine_number; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_set_emulation + (mach_port_t target_port, vm_address_t routine_entry_pt, int routine_number); + + auto const mach_msg_type_t routine_entry_ptCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t routine_numberCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->routine_entry_ptType, &routine_entry_ptCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->routine_numberType, &routine_numberCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_set_emulation(In0P->Head.msgh_request_port, In0P->routine_entry_pt, In0P->routine_number); +} + +/* Routine task_ras_control */ +mig_internal void _Xtask_ras_control + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t basepcType; + vm_address_t basepc; + mach_msg_type_t boundspcType; + vm_address_t boundspc; + mach_msg_type_t flavorType; + int flavor; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_task_ras_control + (mach_port_t target_task, vm_address_t basepc, vm_address_t boundspc, int flavor); + + auto const mach_msg_type_t basepcCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t boundspcCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t flavorCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 48) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->basepcType, &basepcCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->boundspcType, &boundspcCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_task_ras_control(In0P->Head.msgh_request_port, In0P->basepc, In0P->boundspc, In0P->flavor); +} + +/* Routine vm_map */ +mig_internal void _Xvm_map + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t addressType; + vm_address_t address; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t maskType; + vm_address_t mask; + mach_msg_type_t anywhereType; + boolean_t anywhere; + mach_msg_type_t memory_objectType; + mach_port_t memory_object; + mach_msg_type_t offsetType; + vm_offset_t offset; + mach_msg_type_t copyType; + boolean_t copy; + mach_msg_type_t cur_protectionType; + vm_prot_t cur_protection; + mach_msg_type_t max_protectionType; + vm_prot_t max_protection; + mach_msg_type_t inheritanceType; + vm_inherit_t inheritance; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t addressType; + vm_address_t address; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_map + (mach_port_t target_task, vm_address_t *address, vm_size_t size, vm_address_t mask, boolean_t anywhere, mach_port_t memory_object, vm_offset_t offset, boolean_t copy, vm_prot_t cur_protection, vm_prot_t max_protection, vm_inherit_t inheritance); + + auto const mach_msg_type_t addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t maskCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t anywhereCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t memory_objectCheck = { + /* msgt_name = */ 17, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t offsetCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t copyCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t cur_protectionCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t max_protectionCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t inheritanceCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t addressType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 104) || + !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->maskType, &maskCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->anywhereType, &anywhereCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->memory_objectType, &memory_objectCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->copyType, ©Check)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->cur_protectionType, &cur_protectionCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->max_protectionType, &max_protectionCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->inheritanceType, &inheritanceCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_map(In0P->Head.msgh_request_port, &In0P->address, In0P->size, In0P->mask, In0P->anywhere, In0P->memory_object, In0P->offset, In0P->copy, In0P->cur_protection, In0P->max_protection, In0P->inheritance); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_size = 40; + + OutP->addressType = addressType; + + OutP->address = In0P->address; +} + +/* SimpleRoutine memory_object_data_error */ +mig_internal void _Xmemory_object_data_error + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t offsetType; + vm_offset_t offset; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t error_valueType; + kern_return_t error_value; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_data_error + (mach_port_t memory_control, vm_offset_t offset, vm_size_t size, kern_return_t error_value); + + auto const mach_msg_type_t offsetCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t error_valueCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 48) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->error_valueType, &error_valueCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_data_error(In0P->Head.msgh_request_port, In0P->offset, In0P->size, In0P->error_value); +} + +/* SimpleRoutine memory_object_set_attributes */ +mig_internal void _Xmemory_object_set_attributes + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t object_readyType; + boolean_t object_ready; + mach_msg_type_t may_cacheType; + boolean_t may_cache; + mach_msg_type_t copy_strategyType; + memory_object_copy_strategy_t copy_strategy; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_set_attributes + (mach_port_t memory_control, boolean_t object_ready, boolean_t may_cache, memory_object_copy_strategy_t copy_strategy); + + auto const mach_msg_type_t object_readyCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t may_cacheCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t copy_strategyCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 48) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->object_readyType, &object_readyCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->may_cacheType, &may_cacheCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->copy_strategyType, ©_strategyCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_set_attributes(In0P->Head.msgh_request_port, In0P->object_ready, In0P->may_cache, In0P->copy_strategy); +} + +/* SimpleRoutine memory_object_destroy */ +mig_internal void _Xmemory_object_destroy + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t reasonType; + kern_return_t reason; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_destroy + (mach_port_t memory_control, kern_return_t reason); + + auto const mach_msg_type_t reasonCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 32) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->reasonType, &reasonCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_destroy(In0P->Head.msgh_request_port, In0P->reason); +} + +/* SimpleRoutine memory_object_data_supply */ +mig_internal void _Xmemory_object_data_supply + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t offsetType; + vm_offset_t offset; + mach_msg_type_long_t dataType; + vm_offset_t data; + mach_msg_type_t lock_valueType; + vm_prot_t lock_value; + mach_msg_type_t preciousType; + boolean_t precious; + mach_msg_type_t reply_toType; + mach_port_t reply_to; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_data_supply + (mach_port_t memory_control, vm_offset_t offset, vm_offset_t data, mach_msg_type_number_t dataCnt, vm_prot_t lock_value, boolean_t precious, mach_port_t reply_to, mach_msg_type_name_t reply_toPoly); + + auto const mach_msg_type_t offsetCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t lock_valueCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t preciousCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 72) || + !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->dataType.msgtl_header.msgt_inline != FALSE) || + (In0P->dataType.msgtl_header.msgt_longform != TRUE) || + (In0P->dataType.msgtl_name != 9) || + (In0P->dataType.msgtl_size != 8)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->lock_valueType, &lock_valueCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->preciousType, &preciousCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->reply_toType.msgt_inline != TRUE) || + (In0P->reply_toType.msgt_longform != FALSE) || + (In0P->reply_toType.msgt_number != 1) || + (In0P->reply_toType.msgt_size != 32)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_data_supply(In0P->Head.msgh_request_port, In0P->offset, In0P->data, In0P->dataType.msgtl_number, In0P->lock_value, In0P->precious, In0P->reply_to, In0P->reply_toType.msgt_name); +} + +/* SimpleRoutine memory_object_ready */ +mig_internal void _Xmemory_object_ready + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t may_cacheType; + boolean_t may_cache; + mach_msg_type_t copy_strategyType; + memory_object_copy_strategy_t copy_strategy; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_ready + (mach_port_t memory_control, boolean_t may_cache, memory_object_copy_strategy_t copy_strategy); + + auto const mach_msg_type_t may_cacheCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t copy_strategyCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 40) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->may_cacheType, &may_cacheCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->copy_strategyType, ©_strategyCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_ready(In0P->Head.msgh_request_port, In0P->may_cache, In0P->copy_strategy); +} + +/* SimpleRoutine memory_object_change_attributes */ +mig_internal void _Xmemory_object_change_attributes + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t may_cacheType; + boolean_t may_cache; + mach_msg_type_t copy_strategyType; + memory_object_copy_strategy_t copy_strategy; + mach_msg_type_t reply_toType; + mach_port_t reply_to; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_memory_object_change_attributes + (mach_port_t memory_control, boolean_t may_cache, memory_object_copy_strategy_t copy_strategy, mach_port_t reply_to, mach_msg_type_name_t reply_toPoly); + +#if TypeCheck + boolean_t msgh_simple; +#endif /* TypeCheck */ + + auto const mach_msg_type_t may_cacheCheck = { + /* msgt_name = */ 0, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t copy_strategyCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); + if ((In0P->Head.msgh_size != 48)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->may_cacheType, &may_cacheCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->copy_strategyType, ©_strategyCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if ((In0P->reply_toType.msgt_inline != TRUE) || + (In0P->reply_toType.msgt_longform != FALSE) || + (MACH_MSG_TYPE_PORT_ANY(In0P->reply_toType.msgt_name) && msgh_simple) || + (In0P->reply_toType.msgt_number != 1) || + (In0P->reply_toType.msgt_size != 32)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_memory_object_change_attributes(In0P->Head.msgh_request_port, In0P->may_cache, In0P->copy_strategy, In0P->reply_to, In0P->reply_toType.msgt_name); +} + +/* Routine vm_machine_attribute */ +mig_internal void _Xvm_machine_attribute + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t addressType; + vm_address_t address; + mach_msg_type_t sizeType; + vm_size_t size; + mach_msg_type_t attributeType; + vm_machine_attribute_t attribute; + mach_msg_type_t valueType; + vm_machine_attribute_val_t value; + } Request; + + typedef struct { + mach_msg_header_t Head; + mach_msg_type_t RetCodeType; + kern_return_t RetCode; + mach_msg_type_t valueType; + vm_machine_attribute_val_t value; + } Reply; + + register Request *In0P = (Request *) InHeadP; + register Reply *OutP = (Reply *) OutHeadP; + mig_external kern_return_t S_vm_machine_attribute + (mach_port_t target_task, vm_address_t address, vm_size_t size, vm_machine_attribute_t attribute, vm_machine_attribute_val_t *value); + + auto const mach_msg_type_t addressCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t sizeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t attributeCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t valueCheck = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + auto const mach_msg_type_t valueType = { + /* msgt_name = */ 2, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + +#if TypeCheck + if ((In0P->Head.msgh_size != 56) || + (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->attributeType, &attributeCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + +#if TypeCheck + if (BAD_TYPECHECK(&In0P->valueType, &valueCheck)) + { OutP->RetCode = MIG_BAD_ARGUMENTS; return; } +#endif /* TypeCheck */ + + OutP->RetCode = S_vm_machine_attribute(In0P->Head.msgh_request_port, In0P->address, In0P->size, In0P->attribute, &In0P->value); + if (OutP->RetCode != KERN_SUCCESS) + return; + + OutP->Head.msgh_size = 40; + + OutP->valueType = valueType; + + OutP->value = In0P->value; +} + +static mig_routine_t mach_server_routines[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + _Xtask_create, + _Xtask_terminate, + _Xtask_get_emulation_vector, + _Xtask_set_emulation_vector, + _Xtask_threads, + _Xtask_info, + 0, + 0, + 0, + _Xthread_terminate, + _Xthread_get_state, + _Xthread_set_state, + _Xthread_info, + 0, + _Xvm_allocate, + 0, + _Xvm_deallocate, + _Xvm_protect, + _Xvm_inherit, + _Xvm_read, + _Xvm_write, + _Xvm_copy, + _Xvm_region, + _Xvm_statistics, + 0, + 0, + _Xmach_ports_register, + _Xmach_ports_lookup, + 0, + 0, + 0, + _Xmemory_object_data_provided, + _Xmemory_object_data_unavailable, + _Xmemory_object_get_attributes, + _Xvm_set_default_memory_manager, + 0, + _Xxxx_memory_object_lock_request, + _Xmemory_object_lock_request, + _Xxxx_task_get_emulation_vector, + _Xxxx_task_set_emulation_vector, + _Xxxx_host_info, + _Xxxx_slot_info, + _Xxxx_cpu_control, + 0, + 0, + 0, + 0, + 0, + 0, + _Xtask_suspend, + _Xtask_resume, + _Xtask_get_special_port, + _Xtask_set_special_port, + _Xxxx_task_info, + _Xthread_create, + _Xthread_suspend, + _Xthread_resume, + _Xthread_abort, + _Xxxx_thread_get_state, + _Xxxx_thread_set_state, + _Xthread_get_special_port, + _Xthread_set_special_port, + _Xxxx_thread_info, + _Xtask_set_emulation, + _Xtask_ras_control, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + _Xvm_map, + _Xmemory_object_data_error, + _Xmemory_object_set_attributes, + _Xmemory_object_destroy, + _Xmemory_object_data_supply, + _Xmemory_object_ready, + _Xmemory_object_change_attributes, + 0, + 0, + 0, + _Xvm_machine_attribute, + 0, +}; + +mig_external boolean_t mach_server + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + register mach_msg_header_t *InP = InHeadP; + register mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP; + + auto const mach_msg_type_t RetCodeType = { + /* msgt_name = */ MACH_MSG_TYPE_INTEGER_32, + /* msgt_size = */ 32, + /* msgt_number = */ 1, + /* msgt_inline = */ TRUE, + /* msgt_longform = */ FALSE, + /* msgt_deallocate = */ FALSE, + /* msgt_unused = */ 0 + }; + + register mig_routine_t routine; + + OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0); + OutP->Head.msgh_size = sizeof *OutP; + OutP->Head.msgh_remote_port = InP->msgh_reply_port; + OutP->Head.msgh_local_port = MACH_PORT_NULL; + OutP->Head.msgh_seqno = 0; + OutP->Head.msgh_id = InP->msgh_id + 100; + + OutP->RetCodeType = RetCodeType; + + if ((InP->msgh_id > 2100) || (InP->msgh_id < 2000) || + ((routine = mach_server_routines[InP->msgh_id - 2000]) == 0)) { + OutP->RetCode = MIG_BAD_ID; + return FALSE; + } + (*routine) (InP, &OutP->Head); + return TRUE; +} + +mig_external mig_routine_t mach_server_routine + (const mach_msg_header_t *InHeadP) +{ + register int msgh_id; + + msgh_id = InHeadP->msgh_id - 2000; + + if ((msgh_id > 100) || (msgh_id < 0)) + return 0; + + return mach_server_routines[msgh_id]; +} + |