Bug Summary

File:obj-scan-build/kern/mach.server.c
Location:line 3793, column 2
Description:Assigned value is garbage or undefined

Annotated Source Code

1/* Module mach */
2
3#ifndef _GNU_SOURCE1
4#define _GNU_SOURCE1 1
5#endif
6
7#define EXPORT_BOOLEAN
8#include <mach/boolean.h>
9#include <mach/kern_return.h>
10#include <mach/message.h>
11#include <mach/mig_errors.h>
12#include <mach/mig_support.h>
13#include <ipc/ipc_port.h>
14
15#ifndef mig_internalstatic
16#define mig_internalstatic static
17#endif
18
19#ifndef mig_external
20#define mig_external
21#endif
22
23#ifndef mig_unlikely
24#define mig_unlikely(X)__builtin_expect (!! (X), 0) __builtin_expect (!! (X), 0)
25#endif
26
27#ifndef TypeCheck1
28#define TypeCheck1 1
29#endif
30
31#ifndef UseExternRCSId1
32#define UseExternRCSId1 1
33#endif
34
35#define BAD_TYPECHECK(type, check)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; }
)), 0)
mig_unlikely (({\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; }
)), 0)
36 union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; }
)), 0)
37 _t.t = *(type); _c.t = *(check);_t.w != _c.w; }))__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; }
)), 0)
38#define msgh_request_portmsgh_remote_port msgh_remote_port
39#define MACH_MSGH_BITS_REQUEST(bits)((bits) & 0x000000ff) MACH_MSGH_BITS_REMOTE(bits)((bits) & 0x000000ff)
40#define msgh_reply_portmsgh_local_port msgh_local_port
41#define MACH_MSGH_BITS_REPLY(bits)(((bits) & 0x0000ff00) >> 8) MACH_MSGH_BITS_LOCAL(bits)(((bits) & 0x0000ff00) >> 8)
42
43#include <mach/std_types.h>
44#include <kern/ipc_kobject.h>
45#include <kern/ipc_tt.h>
46#include <kern/ipc_host.h>
47#include <kern/task.h>
48#include <kern/thread.h>
49#include <kern/host.h>
50#include <kern/processor.h>
51#include <vm/vm_object.h>
52#include <vm/vm_map.h>
53#include <ipc/ipc_space.h>
54#include <mach/mach_types.h>
55
56/* Routine task_create */
57mig_internalstatic void _Xtask_create
58 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
59{
60 typedef struct {
61 mach_msg_header_t Head;
62 mach_msg_type_t inherit_memoryType;
63 boolean_t inherit_memory;
64 } Request;
65
66 typedef struct {
67 mach_msg_header_t Head;
68 mach_msg_type_t RetCodeType;
69 kern_return_t RetCode;
70 mach_msg_type_t child_taskType;
71 ipc_port_t child_task;
72 } Reply;
73
74 Request *In0P = (Request *) InHeadP;
75 Reply *OutP = (Reply *) OutHeadP;
76 mig_external kern_return_t task_create
77 (task_t target_task, boolean_t inherit_memory, task_t *child_task);
78
79 const mach_msg_type_t inherit_memoryCheck = {
80 /* msgt_name = */ 0,
81 /* msgt_size = */ 32,
82 /* msgt_number = */ 1,
83 /* msgt_inline = */ TRUE((boolean_t) 1),
84 /* msgt_longform = */ FALSE((boolean_t) 0),
85 /* msgt_deallocate = */ FALSE((boolean_t) 0),
86 /* msgt_unused = */ 0
87 };
88
89 const mach_msg_type_t child_taskType = {
90 /* msgt_name = */ 17,
91 /* msgt_size = */ 32,
92 /* msgt_number = */ 1,
93 /* msgt_inline = */ TRUE((boolean_t) 1),
94 /* msgt_longform = */ FALSE((boolean_t) 0),
95 /* msgt_deallocate = */ FALSE((boolean_t) 0),
96 /* msgt_unused = */ 0
97 };
98
99 task_t target_task;
100 task_t child_task;
101
102#if TypeCheck1
103 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
104 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
105 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
106#endif /* TypeCheck */
107
108#if TypeCheck1
109 if (BAD_TYPECHECK(&In0P->inherit_memoryType, &inherit_memoryCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->inherit_memoryType); _c.
t = *(&inherit_memoryCheck);_t.w != _c.w; })), 0)
)
110 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
111#endif /* TypeCheck */
112
113 target_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
114
115 OutP->RetCode = task_create(target_task, In0P->inherit_memory, &child_task);
116 task_deallocate(target_task);
117 if (OutP->RetCode != KERN_SUCCESS0)
118 return;
119
120 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
121 OutP->Head.msgh_size = 40;
122
123 OutP->child_taskType = child_taskType;
124
125 OutP->child_task = convert_task_to_port(child_task);
126}
127
128/* Default implementation of task_create */
129#ifdef MIG_EOPNOTSUPP
130kern_return_t __attribute__ ((weak))
131task_create
132(
133 task_t target_task,
134 boolean_t inherit_memory,
135 task_t *child_task
136) { return MIG_EOPNOTSUPP; }
137#endif /* MIG_EOPNOTSUPP */
138
139/* Routine task_terminate */
140mig_internalstatic void _Xtask_terminate
141 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
142{
143 typedef struct {
144 mach_msg_header_t Head;
145 } Request;
146
147 typedef struct {
148 mach_msg_header_t Head;
149 mach_msg_type_t RetCodeType;
150 kern_return_t RetCode;
151 } Reply;
152
153 Request *In0P = (Request *) InHeadP;
154 Reply *OutP = (Reply *) OutHeadP;
155 mig_external kern_return_t task_terminate
156 (task_t target_task);
157
158 task_t target_task;
159
160#if TypeCheck1
161 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
162 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
163 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
164#endif /* TypeCheck */
165
166 target_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
167
168 OutP->RetCode = task_terminate(target_task);
169 task_deallocate(target_task);
170}
171
172/* Default implementation of task_terminate */
173#ifdef MIG_EOPNOTSUPP
174kern_return_t __attribute__ ((weak))
175task_terminate
176(
177 task_t target_task
178) { return MIG_EOPNOTSUPP; }
179#endif /* MIG_EOPNOTSUPP */
180
181/* Routine task_get_emulation_vector */
182mig_internalstatic void _Xtask_get_emulation_vector
183 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
184{
185 typedef struct {
186 mach_msg_header_t Head;
187 } Request;
188
189 typedef struct {
190 mach_msg_header_t Head;
191 mach_msg_type_t RetCodeType;
192 kern_return_t RetCode;
193 mach_msg_type_t vector_startType;
194 int vector_start;
195 mach_msg_type_long_t emulation_vectorType;
196 emulation_vector_t emulation_vector;
197 } Reply;
198
199 Request *In0P = (Request *) InHeadP;
200 Reply *OutP = (Reply *) OutHeadP;
201 mig_external kern_return_t task_get_emulation_vector
202 (task_t task, int *vector_start, emulation_vector_t *emulation_vector, mach_msg_type_number_t *emulation_vectorCnt);
203
204 const mach_msg_type_t vector_startType = {
205 /* msgt_name = */ 2,
206 /* msgt_size = */ 32,
207 /* msgt_number = */ 1,
208 /* msgt_inline = */ TRUE((boolean_t) 1),
209 /* msgt_longform = */ FALSE((boolean_t) 0),
210 /* msgt_deallocate = */ FALSE((boolean_t) 0),
211 /* msgt_unused = */ 0
212 };
213
214 const mach_msg_type_long_t emulation_vectorType = {
215 {
216 /* msgt_name = */ 0,
217 /* msgt_size = */ 0,
218 /* msgt_number = */ 0,
219 /* msgt_inline = */ FALSE((boolean_t) 0),
220 /* msgt_longform = */ TRUE((boolean_t) 1),
221 /* msgt_deallocate = */ FALSE((boolean_t) 0),
222 /* msgt_unused = */ 0
223 },
224 /* msgtl_name = */ 2,
225 /* msgtl_size = */ 32,
226 /* msgtl_number = */ 0,
227 };
228
229 task_t task;
230 mach_msg_type_number_t emulation_vectorCnt;
231
232#if TypeCheck1
233 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
234 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
235 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
236#endif /* TypeCheck */
237
238 task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
239
240 OutP->RetCode = task_get_emulation_vector(task, &OutP->vector_start, &OutP->emulation_vector, &emulation_vectorCnt);
241 task_deallocate(task);
242 if (OutP->RetCode != KERN_SUCCESS0)
243 return;
244
245 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
246 OutP->Head.msgh_size = 56;
247
248 OutP->vector_startType = vector_startType;
249
250 OutP->emulation_vectorType = emulation_vectorType;
251
252 OutP->emulation_vectorType.msgtl_number = emulation_vectorCnt;
253}
254
255/* Default implementation of task_get_emulation_vector */
256#ifdef MIG_EOPNOTSUPP
257kern_return_t __attribute__ ((weak))
258task_get_emulation_vector
259(
260 task_t task,
261 int *vector_start,
262 emulation_vector_t *emulation_vector,
263 mach_msg_type_number_t *emulation_vectorCnt
264) { return MIG_EOPNOTSUPP; }
265#endif /* MIG_EOPNOTSUPP */
266
267/* Routine task_set_emulation_vector */
268mig_internalstatic void _Xtask_set_emulation_vector
269 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
270{
271 typedef struct {
272 mach_msg_header_t Head;
273 mach_msg_type_t vector_startType;
274 int vector_start;
275 mach_msg_type_long_t emulation_vectorType;
276 emulation_vector_t emulation_vector;
277 } Request;
278
279 typedef struct {
280 mach_msg_header_t Head;
281 mach_msg_type_t RetCodeType;
282 kern_return_t RetCode;
283 } Reply;
284
285 Request *In0P = (Request *) InHeadP;
286 Reply *OutP = (Reply *) OutHeadP;
287 mig_external kern_return_t task_set_emulation_vector
288 (task_t task, int vector_start, emulation_vector_t emulation_vector, mach_msg_type_number_t emulation_vectorCnt);
289
290 const mach_msg_type_t vector_startCheck = {
291 /* msgt_name = */ 2,
292 /* msgt_size = */ 32,
293 /* msgt_number = */ 1,
294 /* msgt_inline = */ TRUE((boolean_t) 1),
295 /* msgt_longform = */ FALSE((boolean_t) 0),
296 /* msgt_deallocate = */ FALSE((boolean_t) 0),
297 /* msgt_unused = */ 0
298 };
299
300 task_t task;
301
302#if TypeCheck1
303 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
304 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
305 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
306#endif /* TypeCheck */
307
308#if TypeCheck1
309 if (BAD_TYPECHECK(&In0P->vector_startType, &vector_startCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->vector_startType); _c.t =
*(&vector_startCheck);_t.w != _c.w; })), 0)
)
310 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
311#endif /* TypeCheck */
312
313#if TypeCheck1
314 if (mig_unlikely ((In0P->emulation_vectorType.msgtl_header.msgt_inline != FALSE) ||__builtin_expect (!! ((In0P->emulation_vectorType.msgtl_header
.msgt_inline != ((boolean_t) 0)) || (In0P->emulation_vectorType
.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->
emulation_vectorType.msgtl_name != 2) || (In0P->emulation_vectorType
.msgtl_size != 32)), 0)
315 (In0P->emulation_vectorType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->emulation_vectorType.msgtl_header
.msgt_inline != ((boolean_t) 0)) || (In0P->emulation_vectorType
.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->
emulation_vectorType.msgtl_name != 2) || (In0P->emulation_vectorType
.msgtl_size != 32)), 0)
316 (In0P->emulation_vectorType.msgtl_name != 2) ||__builtin_expect (!! ((In0P->emulation_vectorType.msgtl_header
.msgt_inline != ((boolean_t) 0)) || (In0P->emulation_vectorType
.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->
emulation_vectorType.msgtl_name != 2) || (In0P->emulation_vectorType
.msgtl_size != 32)), 0)
317 (In0P->emulation_vectorType.msgtl_size != 32))__builtin_expect (!! ((In0P->emulation_vectorType.msgtl_header
.msgt_inline != ((boolean_t) 0)) || (In0P->emulation_vectorType
.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->
emulation_vectorType.msgtl_name != 2) || (In0P->emulation_vectorType
.msgtl_size != 32)), 0)
)
318 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
319#endif /* TypeCheck */
320
321 task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
322
323 OutP->RetCode = task_set_emulation_vector(task, In0P->vector_start, In0P->emulation_vector, In0P->emulation_vectorType.msgtl_number);
324 task_deallocate(task);
325}
326
327/* Default implementation of task_set_emulation_vector */
328#ifdef MIG_EOPNOTSUPP
329kern_return_t __attribute__ ((weak))
330task_set_emulation_vector
331(
332 task_t task,
333 int vector_start,
334 emulation_vector_t emulation_vector,
335 mach_msg_type_number_t emulation_vectorCnt
336) { return MIG_EOPNOTSUPP; }
337#endif /* MIG_EOPNOTSUPP */
338
339/* Routine task_threads */
340mig_internalstatic void _Xtask_threads
341 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
342{
343 typedef struct {
344 mach_msg_header_t Head;
345 } Request;
346
347 typedef struct {
348 mach_msg_header_t Head;
349 mach_msg_type_t RetCodeType;
350 kern_return_t RetCode;
351 mach_msg_type_long_t thread_listType;
352 thread_array_t thread_list;
353 } Reply;
354
355 Request *In0P = (Request *) InHeadP;
356 Reply *OutP = (Reply *) OutHeadP;
357 mig_external kern_return_t task_threads
358 (task_t target_task, thread_array_t *thread_list, mach_msg_type_number_t *thread_listCnt);
359
360 const mach_msg_type_long_t thread_listType = {
361 {
362 /* msgt_name = */ 0,
363 /* msgt_size = */ 0,
364 /* msgt_number = */ 0,
365 /* msgt_inline = */ FALSE((boolean_t) 0),
366 /* msgt_longform = */ TRUE((boolean_t) 1),
367 /* msgt_deallocate = */ FALSE((boolean_t) 0),
368 /* msgt_unused = */ 0
369 },
370 /* msgtl_name = */ 17,
371 /* msgtl_size = */ 32,
372 /* msgtl_number = */ 0,
373 };
374
375 task_t target_task;
376 mach_msg_type_number_t thread_listCnt;
377
378#if TypeCheck1
379 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
380 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
381 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
382#endif /* TypeCheck */
383
384 target_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
385
386 OutP->RetCode = task_threads(target_task, &OutP->thread_list, &thread_listCnt);
387 task_deallocate(target_task);
388 if (OutP->RetCode != KERN_SUCCESS0)
389 return;
390
391 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
392 OutP->Head.msgh_size = 48;
393
394 OutP->thread_listType = thread_listType;
395
396 OutP->thread_listType.msgtl_number = thread_listCnt;
397}
398
399/* Default implementation of task_threads */
400#ifdef MIG_EOPNOTSUPP
401kern_return_t __attribute__ ((weak))
402task_threads
403(
404 task_t target_task,
405 thread_array_t *thread_list,
406 mach_msg_type_number_t *thread_listCnt
407) { return MIG_EOPNOTSUPP; }
408#endif /* MIG_EOPNOTSUPP */
409
410/* Routine task_info */
411mig_internalstatic void _Xtask_info
412 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
413{
414 typedef struct {
415 mach_msg_header_t Head;
416 mach_msg_type_t flavorType;
417 int flavor;
418 mach_msg_type_t task_info_outCntType;
419 mach_msg_type_number_t task_info_outCnt;
420 } Request;
421
422 typedef struct {
423 mach_msg_header_t Head;
424 mach_msg_type_t RetCodeType;
425 kern_return_t RetCode;
426 mach_msg_type_t task_info_outType;
427 integer_t task_info_out[1024];
428 } Reply;
429
430 Request *In0P = (Request *) InHeadP;
431 Reply *OutP = (Reply *) OutHeadP;
432 mig_external kern_return_t task_info
433 (task_t target_task, int flavor, task_info_t task_info_out, mach_msg_type_number_t *task_info_outCnt);
434
435 const mach_msg_type_t flavorCheck = {
436 /* msgt_name = */ 2,
437 /* msgt_size = */ 32,
438 /* msgt_number = */ 1,
439 /* msgt_inline = */ TRUE((boolean_t) 1),
440 /* msgt_longform = */ FALSE((boolean_t) 0),
441 /* msgt_deallocate = */ FALSE((boolean_t) 0),
442 /* msgt_unused = */ 0
443 };
444
445 const mach_msg_type_t task_info_outCntCheck = {
446 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
447 /* msgt_size = */ 32,
448 /* msgt_number = */ 1,
449 /* msgt_inline = */ TRUE((boolean_t) 1),
450 /* msgt_longform = */ FALSE((boolean_t) 0),
451 /* msgt_deallocate = */ FALSE((boolean_t) 0),
452 /* msgt_unused = */ 0
453 };
454
455 const mach_msg_type_t task_info_outType = {
456 /* msgt_name = */ 2,
457 /* msgt_size = */ 32,
458 /* msgt_number = */ 1024,
459 /* msgt_inline = */ TRUE((boolean_t) 1),
460 /* msgt_longform = */ FALSE((boolean_t) 0),
461 /* msgt_deallocate = */ FALSE((boolean_t) 0),
462 /* msgt_unused = */ 0
463 };
464
465 task_t target_task;
466 mach_msg_type_number_t task_info_outCnt;
467
468#if TypeCheck1
469 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
470 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
471 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
472#endif /* TypeCheck */
473
474#if TypeCheck1
475 if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->flavorType); _c.t = *(&
flavorCheck);_t.w != _c.w; })), 0)
)
476 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
477#endif /* TypeCheck */
478
479#if TypeCheck1
480 if (BAD_TYPECHECK(&In0P->task_info_outCntType, &task_info_outCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->task_info_outCntType); _c
.t = *(&task_info_outCntCheck);_t.w != _c.w; })), 0)
)
481 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
482#endif /* TypeCheck */
483
484 target_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
485
486 task_info_outCnt = 1024;
487 if (In0P->task_info_outCnt < task_info_outCnt)
488 task_info_outCnt = In0P->task_info_outCnt;
489
490 OutP->RetCode = task_info(target_task, In0P->flavor, OutP->task_info_out, &task_info_outCnt);
491 task_deallocate(target_task);
492 if (OutP->RetCode != KERN_SUCCESS0)
493 return;
494
495 OutP->task_info_outType = task_info_outType;
496
497 OutP->task_info_outType.msgt_number = task_info_outCnt;
498 OutP->Head.msgh_size = 36 + (4 * task_info_outCnt);
499}
500
501/* Default implementation of task_info */
502#ifdef MIG_EOPNOTSUPP
503kern_return_t __attribute__ ((weak))
504task_info
505(
506 task_t target_task,
507 int flavor,
508 task_info_t task_info_out,
509 mach_msg_type_number_t *task_info_outCnt
510) { return MIG_EOPNOTSUPP; }
511#endif /* MIG_EOPNOTSUPP */
512
513/* Routine thread_terminate */
514mig_internalstatic void _Xthread_terminate
515 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
516{
517 typedef struct {
518 mach_msg_header_t Head;
519 } Request;
520
521 typedef struct {
522 mach_msg_header_t Head;
523 mach_msg_type_t RetCodeType;
524 kern_return_t RetCode;
525 } Reply;
526
527 Request *In0P = (Request *) InHeadP;
528 Reply *OutP = (Reply *) OutHeadP;
529 mig_external kern_return_t thread_terminate
530 (thread_t target_thread);
531
532 thread_t target_thread;
533
534#if TypeCheck1
535 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
536 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
537 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
538#endif /* TypeCheck */
539
540 target_thread = convert_port_to_thread((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
541
542 OutP->RetCode = thread_terminate(target_thread);
543 thread_deallocate(target_thread);
544}
545
546/* Default implementation of thread_terminate */
547#ifdef MIG_EOPNOTSUPP
548kern_return_t __attribute__ ((weak))
549thread_terminate
550(
551 thread_t target_thread
552) { return MIG_EOPNOTSUPP; }
553#endif /* MIG_EOPNOTSUPP */
554
555/* Routine thread_get_state */
556mig_internalstatic void _Xthread_get_state
557 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
558{
559 typedef struct {
560 mach_msg_header_t Head;
561 mach_msg_type_t flavorType;
562 int flavor;
563 mach_msg_type_t old_stateCntType;
564 mach_msg_type_number_t old_stateCnt;
565 } Request;
566
567 typedef struct {
568 mach_msg_header_t Head;
569 mach_msg_type_t RetCodeType;
570 kern_return_t RetCode;
571 mach_msg_type_t old_stateType;
572 natural_t old_state[1024];
573 } Reply;
574
575 Request *In0P = (Request *) InHeadP;
576 Reply *OutP = (Reply *) OutHeadP;
577 mig_external kern_return_t thread_get_state
578 (thread_t target_thread, int flavor, thread_state_t old_state, mach_msg_type_number_t *old_stateCnt);
579
580 const mach_msg_type_t flavorCheck = {
581 /* msgt_name = */ 2,
582 /* msgt_size = */ 32,
583 /* msgt_number = */ 1,
584 /* msgt_inline = */ TRUE((boolean_t) 1),
585 /* msgt_longform = */ FALSE((boolean_t) 0),
586 /* msgt_deallocate = */ FALSE((boolean_t) 0),
587 /* msgt_unused = */ 0
588 };
589
590 const mach_msg_type_t old_stateCntCheck = {
591 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
592 /* msgt_size = */ 32,
593 /* msgt_number = */ 1,
594 /* msgt_inline = */ TRUE((boolean_t) 1),
595 /* msgt_longform = */ FALSE((boolean_t) 0),
596 /* msgt_deallocate = */ FALSE((boolean_t) 0),
597 /* msgt_unused = */ 0
598 };
599
600 const mach_msg_type_t old_stateType = {
601 /* msgt_name = */ 2,
602 /* msgt_size = */ 32,
603 /* msgt_number = */ 1024,
604 /* msgt_inline = */ TRUE((boolean_t) 1),
605 /* msgt_longform = */ FALSE((boolean_t) 0),
606 /* msgt_deallocate = */ FALSE((boolean_t) 0),
607 /* msgt_unused = */ 0
608 };
609
610 thread_t target_thread;
611 mach_msg_type_number_t old_stateCnt;
612
613#if TypeCheck1
614 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
615 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
616 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
617#endif /* TypeCheck */
618
619#if TypeCheck1
620 if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->flavorType); _c.t = *(&
flavorCheck);_t.w != _c.w; })), 0)
)
621 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
622#endif /* TypeCheck */
623
624#if TypeCheck1
625 if (BAD_TYPECHECK(&In0P->old_stateCntType, &old_stateCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->old_stateCntType); _c.t =
*(&old_stateCntCheck);_t.w != _c.w; })), 0)
)
626 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
627#endif /* TypeCheck */
628
629 target_thread = convert_port_to_thread((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
630
631 old_stateCnt = 1024;
632 if (In0P->old_stateCnt < old_stateCnt)
633 old_stateCnt = In0P->old_stateCnt;
634
635 OutP->RetCode = thread_get_state(target_thread, In0P->flavor, OutP->old_state, &old_stateCnt);
636 thread_deallocate(target_thread);
637 if (OutP->RetCode != KERN_SUCCESS0)
638 return;
639
640 OutP->old_stateType = old_stateType;
641
642 OutP->old_stateType.msgt_number = old_stateCnt;
643 OutP->Head.msgh_size = 36 + (4 * old_stateCnt);
644}
645
646/* Default implementation of thread_get_state */
647#ifdef MIG_EOPNOTSUPP
648kern_return_t __attribute__ ((weak))
649thread_get_state
650(
651 thread_t target_thread,
652 int flavor,
653 thread_state_t old_state,
654 mach_msg_type_number_t *old_stateCnt
655) { return MIG_EOPNOTSUPP; }
656#endif /* MIG_EOPNOTSUPP */
657
658/* Routine thread_set_state */
659mig_internalstatic void _Xthread_set_state
660 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
661{
662 typedef struct {
663 mach_msg_header_t Head;
664 mach_msg_type_t flavorType;
665 int flavor;
666 mach_msg_type_t new_stateType;
667 natural_t new_state[1024];
668 } Request;
669
670 typedef struct {
671 mach_msg_header_t Head;
672 mach_msg_type_t RetCodeType;
673 kern_return_t RetCode;
674 } Reply;
675
676 Request *In0P = (Request *) InHeadP;
677 Reply *OutP = (Reply *) OutHeadP;
678 mig_external kern_return_t thread_set_state
679 (thread_t target_thread, int flavor, thread_state_t new_state, mach_msg_type_number_t new_stateCnt);
680
681 unsigned int msgh_size;
682
683 const mach_msg_type_t flavorCheck = {
684 /* msgt_name = */ 2,
685 /* msgt_size = */ 32,
686 /* msgt_number = */ 1,
687 /* msgt_inline = */ TRUE((boolean_t) 1),
688 /* msgt_longform = */ FALSE((boolean_t) 0),
689 /* msgt_deallocate = */ FALSE((boolean_t) 0),
690 /* msgt_unused = */ 0
691 };
692
693 thread_t target_thread;
694
695#if TypeCheck1
696 msgh_size = In0P->Head.msgh_size;
697 if (mig_unlikely ((msgh_size < 36) ||__builtin_expect (!! ((msgh_size < 36) || (In0P->Head.msgh_bits
& 0x80000000U)), 0)
698 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 36) || (In0P->Head.msgh_bits
& 0x80000000U)), 0)
)
699 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
700#endif /* TypeCheck */
701
702#if TypeCheck1
703 if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->flavorType); _c.t = *(&
flavorCheck);_t.w != _c.w; })), 0)
)
704 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
705#endif /* TypeCheck */
706
707#if TypeCheck1
708 if (mig_unlikely ((In0P->new_stateType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->new_stateType.msgt_inline != (
(boolean_t) 1)) || (In0P->new_stateType.msgt_longform != (
(boolean_t) 0)) || (In0P->new_stateType.msgt_name != 2) ||
(In0P->new_stateType.msgt_size != 32)), 0)
709 (In0P->new_stateType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->new_stateType.msgt_inline != (
(boolean_t) 1)) || (In0P->new_stateType.msgt_longform != (
(boolean_t) 0)) || (In0P->new_stateType.msgt_name != 2) ||
(In0P->new_stateType.msgt_size != 32)), 0)
710 (In0P->new_stateType.msgt_name != 2) ||__builtin_expect (!! ((In0P->new_stateType.msgt_inline != (
(boolean_t) 1)) || (In0P->new_stateType.msgt_longform != (
(boolean_t) 0)) || (In0P->new_stateType.msgt_name != 2) ||
(In0P->new_stateType.msgt_size != 32)), 0)
711 (In0P->new_stateType.msgt_size != 32))__builtin_expect (!! ((In0P->new_stateType.msgt_inline != (
(boolean_t) 1)) || (In0P->new_stateType.msgt_longform != (
(boolean_t) 0)) || (In0P->new_stateType.msgt_name != 2) ||
(In0P->new_stateType.msgt_size != 32)), 0)
)
712 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
713#endif /* TypeCheck */
714
715#if TypeCheck1
716 if (mig_unlikely (msgh_size != 36 + (4 * In0P->new_stateType.msgt_number))__builtin_expect (!! (msgh_size != 36 + (4 * In0P->new_stateType
.msgt_number)), 0)
)
717 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
718#endif /* TypeCheck */
719
720 target_thread = convert_port_to_thread((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
721
722 OutP->RetCode = thread_set_state(target_thread, In0P->flavor, In0P->new_state, In0P->new_stateType.msgt_number);
723 thread_deallocate(target_thread);
724}
725
726/* Default implementation of thread_set_state */
727#ifdef MIG_EOPNOTSUPP
728kern_return_t __attribute__ ((weak))
729thread_set_state
730(
731 thread_t target_thread,
732 int flavor,
733 thread_state_t new_state,
734 mach_msg_type_number_t new_stateCnt
735) { return MIG_EOPNOTSUPP; }
736#endif /* MIG_EOPNOTSUPP */
737
738/* Routine thread_info */
739mig_internalstatic void _Xthread_info
740 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
741{
742 typedef struct {
743 mach_msg_header_t Head;
744 mach_msg_type_t flavorType;
745 int flavor;
746 mach_msg_type_t thread_info_outCntType;
747 mach_msg_type_number_t thread_info_outCnt;
748 } Request;
749
750 typedef struct {
751 mach_msg_header_t Head;
752 mach_msg_type_t RetCodeType;
753 kern_return_t RetCode;
754 mach_msg_type_t thread_info_outType;
755 integer_t thread_info_out[1024];
756 } Reply;
757
758 Request *In0P = (Request *) InHeadP;
759 Reply *OutP = (Reply *) OutHeadP;
760 mig_external kern_return_t thread_info
761 (thread_t target_thread, int flavor, thread_info_t thread_info_out, mach_msg_type_number_t *thread_info_outCnt);
762
763 const mach_msg_type_t flavorCheck = {
764 /* msgt_name = */ 2,
765 /* msgt_size = */ 32,
766 /* msgt_number = */ 1,
767 /* msgt_inline = */ TRUE((boolean_t) 1),
768 /* msgt_longform = */ FALSE((boolean_t) 0),
769 /* msgt_deallocate = */ FALSE((boolean_t) 0),
770 /* msgt_unused = */ 0
771 };
772
773 const mach_msg_type_t thread_info_outCntCheck = {
774 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
775 /* msgt_size = */ 32,
776 /* msgt_number = */ 1,
777 /* msgt_inline = */ TRUE((boolean_t) 1),
778 /* msgt_longform = */ FALSE((boolean_t) 0),
779 /* msgt_deallocate = */ FALSE((boolean_t) 0),
780 /* msgt_unused = */ 0
781 };
782
783 const mach_msg_type_t thread_info_outType = {
784 /* msgt_name = */ 2,
785 /* msgt_size = */ 32,
786 /* msgt_number = */ 1024,
787 /* msgt_inline = */ TRUE((boolean_t) 1),
788 /* msgt_longform = */ FALSE((boolean_t) 0),
789 /* msgt_deallocate = */ FALSE((boolean_t) 0),
790 /* msgt_unused = */ 0
791 };
792
793 thread_t target_thread;
794 mach_msg_type_number_t thread_info_outCnt;
795
796#if TypeCheck1
797 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
798 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
799 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
800#endif /* TypeCheck */
801
802#if TypeCheck1
803 if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->flavorType); _c.t = *(&
flavorCheck);_t.w != _c.w; })), 0)
)
804 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
805#endif /* TypeCheck */
806
807#if TypeCheck1
808 if (BAD_TYPECHECK(&In0P->thread_info_outCntType, &thread_info_outCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->thread_info_outCntType);
_c.t = *(&thread_info_outCntCheck);_t.w != _c.w; })), 0)
)
809 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
810#endif /* TypeCheck */
811
812 target_thread = convert_port_to_thread((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
813
814 thread_info_outCnt = 1024;
815 if (In0P->thread_info_outCnt < thread_info_outCnt)
816 thread_info_outCnt = In0P->thread_info_outCnt;
817
818 OutP->RetCode = thread_info(target_thread, In0P->flavor, OutP->thread_info_out, &thread_info_outCnt);
819 thread_deallocate(target_thread);
820 if (OutP->RetCode != KERN_SUCCESS0)
821 return;
822
823 OutP->thread_info_outType = thread_info_outType;
824
825 OutP->thread_info_outType.msgt_number = thread_info_outCnt;
826 OutP->Head.msgh_size = 36 + (4 * thread_info_outCnt);
827}
828
829/* Default implementation of thread_info */
830#ifdef MIG_EOPNOTSUPP
831kern_return_t __attribute__ ((weak))
832thread_info
833(
834 thread_t target_thread,
835 int flavor,
836 thread_info_t thread_info_out,
837 mach_msg_type_number_t *thread_info_outCnt
838) { return MIG_EOPNOTSUPP; }
839#endif /* MIG_EOPNOTSUPP */
840
841/* Routine vm_allocate */
842mig_internalstatic void _Xvm_allocate
843 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
844{
845 typedef struct {
846 mach_msg_header_t Head;
847 mach_msg_type_t addressType;
848 vm_address_t address;
849 mach_msg_type_t sizeType;
850 vm_size_t size;
851 mach_msg_type_t anywhereType;
852 boolean_t anywhere;
853 } Request;
854
855 typedef struct {
856 mach_msg_header_t Head;
857 mach_msg_type_t RetCodeType;
858 kern_return_t RetCode;
859 mach_msg_type_t addressType;
860 vm_address_t address;
861 } Reply;
862
863 Request *In0P = (Request *) InHeadP;
864 Reply *OutP = (Reply *) OutHeadP;
865 mig_external kern_return_t vm_allocate
866 (vm_map_t target_task, vm_address_t *address, vm_size_t size, boolean_t anywhere);
867
868 const mach_msg_type_t addressCheck = {
869 /* msgt_name = */ 2,
870 /* msgt_size = */ 32,
871 /* msgt_number = */ 1,
872 /* msgt_inline = */ TRUE((boolean_t) 1),
873 /* msgt_longform = */ FALSE((boolean_t) 0),
874 /* msgt_deallocate = */ FALSE((boolean_t) 0),
875 /* msgt_unused = */ 0
876 };
877
878 const mach_msg_type_t sizeCheck = {
879 /* msgt_name = */ 2,
880 /* msgt_size = */ 32,
881 /* msgt_number = */ 1,
882 /* msgt_inline = */ TRUE((boolean_t) 1),
883 /* msgt_longform = */ FALSE((boolean_t) 0),
884 /* msgt_deallocate = */ FALSE((boolean_t) 0),
885 /* msgt_unused = */ 0
886 };
887
888 const mach_msg_type_t anywhereCheck = {
889 /* msgt_name = */ 0,
890 /* msgt_size = */ 32,
891 /* msgt_number = */ 1,
892 /* msgt_inline = */ TRUE((boolean_t) 1),
893 /* msgt_longform = */ FALSE((boolean_t) 0),
894 /* msgt_deallocate = */ FALSE((boolean_t) 0),
895 /* msgt_unused = */ 0
896 };
897
898 const mach_msg_type_t addressType = {
899 /* msgt_name = */ 2,
900 /* msgt_size = */ 32,
901 /* msgt_number = */ 1,
902 /* msgt_inline = */ TRUE((boolean_t) 1),
903 /* msgt_longform = */ FALSE((boolean_t) 0),
904 /* msgt_deallocate = */ FALSE((boolean_t) 0),
905 /* msgt_unused = */ 0
906 };
907
908 vm_map_t target_task;
909
910#if TypeCheck1
911 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
912 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
913 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
914#endif /* TypeCheck */
915
916#if TypeCheck1
917 if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addressType); _c.t = *(&
addressCheck);_t.w != _c.w; })), 0)
)
918 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
919#endif /* TypeCheck */
920
921#if TypeCheck1
922 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
923 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
924#endif /* TypeCheck */
925
926#if TypeCheck1
927 if (BAD_TYPECHECK(&In0P->anywhereType, &anywhereCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->anywhereType); _c.t = *(
&anywhereCheck);_t.w != _c.w; })), 0)
)
928 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
929#endif /* TypeCheck */
930
931 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
932
933 OutP->RetCode = vm_allocate(target_task, &In0P->address, In0P->size, In0P->anywhere);
934 vm_map_deallocate(target_task);
935 if (OutP->RetCode != KERN_SUCCESS0)
936 return;
937
938 OutP->Head.msgh_size = 40;
939
940 OutP->addressType = addressType;
941
942 OutP->address = In0P->address;
943}
944
945/* Default implementation of vm_allocate */
946#ifdef MIG_EOPNOTSUPP
947kern_return_t __attribute__ ((weak))
948vm_allocate
949(
950 vm_map_t target_task,
951 vm_address_t *address,
952 vm_size_t size,
953 boolean_t anywhere
954) { return MIG_EOPNOTSUPP; }
955#endif /* MIG_EOPNOTSUPP */
956
957/* Routine vm_deallocate */
958mig_internalstatic void _Xvm_deallocate
959 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
960{
961 typedef struct {
962 mach_msg_header_t Head;
963 mach_msg_type_t addressType;
964 vm_address_t address;
965 mach_msg_type_t sizeType;
966 vm_size_t size;
967 } Request;
968
969 typedef struct {
970 mach_msg_header_t Head;
971 mach_msg_type_t RetCodeType;
972 kern_return_t RetCode;
973 } Reply;
974
975 Request *In0P = (Request *) InHeadP;
976 Reply *OutP = (Reply *) OutHeadP;
977 mig_external kern_return_t vm_deallocate
978 (vm_map_t target_task, vm_address_t address, vm_size_t size);
979
980 const mach_msg_type_t addressCheck = {
981 /* msgt_name = */ 2,
982 /* msgt_size = */ 32,
983 /* msgt_number = */ 1,
984 /* msgt_inline = */ TRUE((boolean_t) 1),
985 /* msgt_longform = */ FALSE((boolean_t) 0),
986 /* msgt_deallocate = */ FALSE((boolean_t) 0),
987 /* msgt_unused = */ 0
988 };
989
990 const mach_msg_type_t sizeCheck = {
991 /* msgt_name = */ 2,
992 /* msgt_size = */ 32,
993 /* msgt_number = */ 1,
994 /* msgt_inline = */ TRUE((boolean_t) 1),
995 /* msgt_longform = */ FALSE((boolean_t) 0),
996 /* msgt_deallocate = */ FALSE((boolean_t) 0),
997 /* msgt_unused = */ 0
998 };
999
1000 vm_map_t target_task;
1001
1002#if TypeCheck1
1003 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1004 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1005 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1006#endif /* TypeCheck */
1007
1008#if TypeCheck1
1009 if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addressType); _c.t = *(&
addressCheck);_t.w != _c.w; })), 0)
)
1010 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1011#endif /* TypeCheck */
1012
1013#if TypeCheck1
1014 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
1015 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1016#endif /* TypeCheck */
1017
1018 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1019
1020 OutP->RetCode = vm_deallocate(target_task, In0P->address, In0P->size);
1021 vm_map_deallocate(target_task);
1022}
1023
1024/* Default implementation of vm_deallocate */
1025#ifdef MIG_EOPNOTSUPP
1026kern_return_t __attribute__ ((weak))
1027vm_deallocate
1028(
1029 vm_map_t target_task,
1030 vm_address_t address,
1031 vm_size_t size
1032) { return MIG_EOPNOTSUPP; }
1033#endif /* MIG_EOPNOTSUPP */
1034
1035/* Routine vm_protect */
1036mig_internalstatic void _Xvm_protect
1037 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1038{
1039 typedef struct {
1040 mach_msg_header_t Head;
1041 mach_msg_type_t addressType;
1042 vm_address_t address;
1043 mach_msg_type_t sizeType;
1044 vm_size_t size;
1045 mach_msg_type_t set_maximumType;
1046 boolean_t set_maximum;
1047 mach_msg_type_t new_protectionType;
1048 vm_prot_t new_protection;
1049 } Request;
1050
1051 typedef struct {
1052 mach_msg_header_t Head;
1053 mach_msg_type_t RetCodeType;
1054 kern_return_t RetCode;
1055 } Reply;
1056
1057 Request *In0P = (Request *) InHeadP;
1058 Reply *OutP = (Reply *) OutHeadP;
1059 mig_external kern_return_t vm_protect
1060 (vm_map_t target_task, vm_address_t address, vm_size_t size, boolean_t set_maximum, vm_prot_t new_protection);
1061
1062 const mach_msg_type_t addressCheck = {
1063 /* msgt_name = */ 2,
1064 /* msgt_size = */ 32,
1065 /* msgt_number = */ 1,
1066 /* msgt_inline = */ TRUE((boolean_t) 1),
1067 /* msgt_longform = */ FALSE((boolean_t) 0),
1068 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1069 /* msgt_unused = */ 0
1070 };
1071
1072 const mach_msg_type_t sizeCheck = {
1073 /* msgt_name = */ 2,
1074 /* msgt_size = */ 32,
1075 /* msgt_number = */ 1,
1076 /* msgt_inline = */ TRUE((boolean_t) 1),
1077 /* msgt_longform = */ FALSE((boolean_t) 0),
1078 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1079 /* msgt_unused = */ 0
1080 };
1081
1082 const mach_msg_type_t set_maximumCheck = {
1083 /* msgt_name = */ 0,
1084 /* msgt_size = */ 32,
1085 /* msgt_number = */ 1,
1086 /* msgt_inline = */ TRUE((boolean_t) 1),
1087 /* msgt_longform = */ FALSE((boolean_t) 0),
1088 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1089 /* msgt_unused = */ 0
1090 };
1091
1092 const mach_msg_type_t new_protectionCheck = {
1093 /* msgt_name = */ 2,
1094 /* msgt_size = */ 32,
1095 /* msgt_number = */ 1,
1096 /* msgt_inline = */ TRUE((boolean_t) 1),
1097 /* msgt_longform = */ FALSE((boolean_t) 0),
1098 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1099 /* msgt_unused = */ 0
1100 };
1101
1102 vm_map_t target_task;
1103
1104#if TypeCheck1
1105 if (mig_unlikely ((In0P->Head.msgh_size != 56) ||__builtin_expect (!! ((In0P->Head.msgh_size != 56) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1106 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 56) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1107 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1108#endif /* TypeCheck */
1109
1110#if TypeCheck1
1111 if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addressType); _c.t = *(&
addressCheck);_t.w != _c.w; })), 0)
)
1112 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1113#endif /* TypeCheck */
1114
1115#if TypeCheck1
1116 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
1117 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1118#endif /* TypeCheck */
1119
1120#if TypeCheck1
1121 if (BAD_TYPECHECK(&In0P->set_maximumType, &set_maximumCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->set_maximumType); _c.t =
*(&set_maximumCheck);_t.w != _c.w; })), 0)
)
1122 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1123#endif /* TypeCheck */
1124
1125#if TypeCheck1
1126 if (BAD_TYPECHECK(&In0P->new_protectionType, &new_protectionCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_protectionType); _c.
t = *(&new_protectionCheck);_t.w != _c.w; })), 0)
)
1127 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1128#endif /* TypeCheck */
1129
1130 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1131
1132 OutP->RetCode = vm_protect(target_task, In0P->address, In0P->size, In0P->set_maximum, In0P->new_protection);
1133 vm_map_deallocate(target_task);
1134}
1135
1136/* Default implementation of vm_protect */
1137#ifdef MIG_EOPNOTSUPP
1138kern_return_t __attribute__ ((weak))
1139vm_protect
1140(
1141 vm_map_t target_task,
1142 vm_address_t address,
1143 vm_size_t size,
1144 boolean_t set_maximum,
1145 vm_prot_t new_protection
1146) { return MIG_EOPNOTSUPP; }
1147#endif /* MIG_EOPNOTSUPP */
1148
1149/* Routine vm_inherit */
1150mig_internalstatic void _Xvm_inherit
1151 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1152{
1153 typedef struct {
1154 mach_msg_header_t Head;
1155 mach_msg_type_t addressType;
1156 vm_address_t address;
1157 mach_msg_type_t sizeType;
1158 vm_size_t size;
1159 mach_msg_type_t new_inheritanceType;
1160 vm_inherit_t new_inheritance;
1161 } Request;
1162
1163 typedef struct {
1164 mach_msg_header_t Head;
1165 mach_msg_type_t RetCodeType;
1166 kern_return_t RetCode;
1167 } Reply;
1168
1169 Request *In0P = (Request *) InHeadP;
1170 Reply *OutP = (Reply *) OutHeadP;
1171 mig_external kern_return_t vm_inherit
1172 (vm_map_t target_task, vm_address_t address, vm_size_t size, vm_inherit_t new_inheritance);
1173
1174 const mach_msg_type_t addressCheck = {
1175 /* msgt_name = */ 2,
1176 /* msgt_size = */ 32,
1177 /* msgt_number = */ 1,
1178 /* msgt_inline = */ TRUE((boolean_t) 1),
1179 /* msgt_longform = */ FALSE((boolean_t) 0),
1180 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1181 /* msgt_unused = */ 0
1182 };
1183
1184 const mach_msg_type_t sizeCheck = {
1185 /* msgt_name = */ 2,
1186 /* msgt_size = */ 32,
1187 /* msgt_number = */ 1,
1188 /* msgt_inline = */ TRUE((boolean_t) 1),
1189 /* msgt_longform = */ FALSE((boolean_t) 0),
1190 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1191 /* msgt_unused = */ 0
1192 };
1193
1194 const mach_msg_type_t new_inheritanceCheck = {
1195 /* msgt_name = */ 2,
1196 /* msgt_size = */ 32,
1197 /* msgt_number = */ 1,
1198 /* msgt_inline = */ TRUE((boolean_t) 1),
1199 /* msgt_longform = */ FALSE((boolean_t) 0),
1200 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1201 /* msgt_unused = */ 0
1202 };
1203
1204 vm_map_t target_task;
1205
1206#if TypeCheck1
1207 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1208 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1209 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1210#endif /* TypeCheck */
1211
1212#if TypeCheck1
1213 if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addressType); _c.t = *(&
addressCheck);_t.w != _c.w; })), 0)
)
1214 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1215#endif /* TypeCheck */
1216
1217#if TypeCheck1
1218 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
1219 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1220#endif /* TypeCheck */
1221
1222#if TypeCheck1
1223 if (BAD_TYPECHECK(&In0P->new_inheritanceType, &new_inheritanceCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->new_inheritanceType); _c
.t = *(&new_inheritanceCheck);_t.w != _c.w; })), 0)
)
1224 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1225#endif /* TypeCheck */
1226
1227 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1228
1229 OutP->RetCode = vm_inherit(target_task, In0P->address, In0P->size, In0P->new_inheritance);
1230 vm_map_deallocate(target_task);
1231}
1232
1233/* Default implementation of vm_inherit */
1234#ifdef MIG_EOPNOTSUPP
1235kern_return_t __attribute__ ((weak))
1236vm_inherit
1237(
1238 vm_map_t target_task,
1239 vm_address_t address,
1240 vm_size_t size,
1241 vm_inherit_t new_inheritance
1242) { return MIG_EOPNOTSUPP; }
1243#endif /* MIG_EOPNOTSUPP */
1244
1245/* Routine vm_read */
1246mig_internalstatic void _Xvm_read
1247 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1248{
1249 typedef struct {
1250 mach_msg_header_t Head;
1251 mach_msg_type_t addressType;
1252 vm_address_t address;
1253 mach_msg_type_t sizeType;
1254 vm_size_t size;
1255 } Request;
1256
1257 typedef struct {
1258 mach_msg_header_t Head;
1259 mach_msg_type_t RetCodeType;
1260 kern_return_t RetCode;
1261 mach_msg_type_long_t dataType;
1262 vm_offset_t data;
1263 } Reply;
1264
1265 Request *In0P = (Request *) InHeadP;
1266 Reply *OutP = (Reply *) OutHeadP;
1267 mig_external kern_return_t vm_read
1268 (vm_map_t target_task, vm_address_t address, vm_size_t size, vm_offset_t *data, mach_msg_type_number_t *dataCnt);
1269
1270 const mach_msg_type_t addressCheck = {
1271 /* msgt_name = */ 2,
1272 /* msgt_size = */ 32,
1273 /* msgt_number = */ 1,
1274 /* msgt_inline = */ TRUE((boolean_t) 1),
1275 /* msgt_longform = */ FALSE((boolean_t) 0),
1276 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1277 /* msgt_unused = */ 0
1278 };
1279
1280 const mach_msg_type_t sizeCheck = {
1281 /* msgt_name = */ 2,
1282 /* msgt_size = */ 32,
1283 /* msgt_number = */ 1,
1284 /* msgt_inline = */ TRUE((boolean_t) 1),
1285 /* msgt_longform = */ FALSE((boolean_t) 0),
1286 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1287 /* msgt_unused = */ 0
1288 };
1289
1290 const mach_msg_type_long_t dataType = {
1291 {
1292 /* msgt_name = */ 0,
1293 /* msgt_size = */ 0,
1294 /* msgt_number = */ 0,
1295 /* msgt_inline = */ FALSE((boolean_t) 0),
1296 /* msgt_longform = */ TRUE((boolean_t) 1),
1297 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1298 /* msgt_unused = */ 0
1299 },
1300 /* msgtl_name = */ 9,
1301 /* msgtl_size = */ 8,
1302 /* msgtl_number = */ 0,
1303 };
1304
1305 vm_map_t target_task;
1306 mach_msg_type_number_t dataCnt;
1307
1308#if TypeCheck1
1309 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1310 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1311 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1312#endif /* TypeCheck */
1313
1314#if TypeCheck1
1315 if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addressType); _c.t = *(&
addressCheck);_t.w != _c.w; })), 0)
)
1316 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1317#endif /* TypeCheck */
1318
1319#if TypeCheck1
1320 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
1321 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1322#endif /* TypeCheck */
1323
1324 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1325
1326 OutP->RetCode = vm_read(target_task, In0P->address, In0P->size, &OutP->data, &dataCnt);
1327 vm_map_deallocate(target_task);
1328 if (OutP->RetCode != KERN_SUCCESS0)
1329 return;
1330
1331 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1332 OutP->Head.msgh_size = 48;
1333
1334 OutP->dataType = dataType;
1335
1336 OutP->dataType.msgtl_number = dataCnt;
1337}
1338
1339/* Default implementation of vm_read */
1340#ifdef MIG_EOPNOTSUPP
1341kern_return_t __attribute__ ((weak))
1342vm_read
1343(
1344 vm_map_t target_task,
1345 vm_address_t address,
1346 vm_size_t size,
1347 vm_offset_t *data,
1348 mach_msg_type_number_t *dataCnt
1349) { return MIG_EOPNOTSUPP; }
1350#endif /* MIG_EOPNOTSUPP */
1351
1352/* Routine vm_write */
1353mig_internalstatic void _Xvm_write
1354 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1355{
1356 typedef struct {
1357 mach_msg_header_t Head;
1358 mach_msg_type_t addressType;
1359 vm_address_t address;
1360 mach_msg_type_long_t dataType;
1361 vm_offset_t data;
1362 } Request;
1363
1364 typedef struct {
1365 mach_msg_header_t Head;
1366 mach_msg_type_t RetCodeType;
1367 kern_return_t RetCode;
1368 } Reply;
1369
1370 Request *In0P = (Request *) InHeadP;
1371 Reply *OutP = (Reply *) OutHeadP;
1372 mig_external kern_return_t vm_write
1373 (vm_map_t target_task, vm_address_t address, vm_offset_t data, mach_msg_type_number_t dataCnt);
1374
1375 const mach_msg_type_t addressCheck = {
1376 /* msgt_name = */ 2,
1377 /* msgt_size = */ 32,
1378 /* msgt_number = */ 1,
1379 /* msgt_inline = */ TRUE((boolean_t) 1),
1380 /* msgt_longform = */ FALSE((boolean_t) 0),
1381 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1382 /* msgt_unused = */ 0
1383 };
1384
1385 vm_map_t target_task;
1386
1387#if TypeCheck1
1388 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
1389 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1390 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1391#endif /* TypeCheck */
1392
1393#if TypeCheck1
1394 if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addressType); _c.t = *(&
addressCheck);_t.w != _c.w; })), 0)
)
1395 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1396#endif /* TypeCheck */
1397
1398#if TypeCheck1
1399 if (mig_unlikely ((In0P->dataType.msgtl_header.msgt_inline != FALSE) ||__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
1400 (In0P->dataType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
1401 (In0P->dataType.msgtl_name != 9) ||__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
1402 (In0P->dataType.msgtl_size != 8))__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
)
1403 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1404#endif /* TypeCheck */
1405
1406 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1407
1408 OutP->RetCode = vm_write(target_task, In0P->address, In0P->data, In0P->dataType.msgtl_number);
1409 vm_map_deallocate(target_task);
1410}
1411
1412/* Default implementation of vm_write */
1413#ifdef MIG_EOPNOTSUPP
1414kern_return_t __attribute__ ((weak))
1415vm_write
1416(
1417 vm_map_t target_task,
1418 vm_address_t address,
1419 vm_offset_t data,
1420 mach_msg_type_number_t dataCnt
1421) { return MIG_EOPNOTSUPP; }
1422#endif /* MIG_EOPNOTSUPP */
1423
1424/* Routine vm_copy */
1425mig_internalstatic void _Xvm_copy
1426 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1427{
1428 typedef struct {
1429 mach_msg_header_t Head;
1430 mach_msg_type_t source_addressType;
1431 vm_address_t source_address;
1432 mach_msg_type_t sizeType;
1433 vm_size_t size;
1434 mach_msg_type_t dest_addressType;
1435 vm_address_t dest_address;
1436 } Request;
1437
1438 typedef struct {
1439 mach_msg_header_t Head;
1440 mach_msg_type_t RetCodeType;
1441 kern_return_t RetCode;
1442 } Reply;
1443
1444 Request *In0P = (Request *) InHeadP;
1445 Reply *OutP = (Reply *) OutHeadP;
1446 mig_external kern_return_t vm_copy
1447 (vm_map_t target_task, vm_address_t source_address, vm_size_t size, vm_address_t dest_address);
1448
1449 const mach_msg_type_t source_addressCheck = {
1450 /* msgt_name = */ 2,
1451 /* msgt_size = */ 32,
1452 /* msgt_number = */ 1,
1453 /* msgt_inline = */ TRUE((boolean_t) 1),
1454 /* msgt_longform = */ FALSE((boolean_t) 0),
1455 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1456 /* msgt_unused = */ 0
1457 };
1458
1459 const mach_msg_type_t sizeCheck = {
1460 /* msgt_name = */ 2,
1461 /* msgt_size = */ 32,
1462 /* msgt_number = */ 1,
1463 /* msgt_inline = */ TRUE((boolean_t) 1),
1464 /* msgt_longform = */ FALSE((boolean_t) 0),
1465 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1466 /* msgt_unused = */ 0
1467 };
1468
1469 const mach_msg_type_t dest_addressCheck = {
1470 /* msgt_name = */ 2,
1471 /* msgt_size = */ 32,
1472 /* msgt_number = */ 1,
1473 /* msgt_inline = */ TRUE((boolean_t) 1),
1474 /* msgt_longform = */ FALSE((boolean_t) 0),
1475 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1476 /* msgt_unused = */ 0
1477 };
1478
1479 vm_map_t target_task;
1480
1481#if TypeCheck1
1482 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1483 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1484 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1485#endif /* TypeCheck */
1486
1487#if TypeCheck1
1488 if (BAD_TYPECHECK(&In0P->source_addressType, &source_addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->source_addressType); _c.
t = *(&source_addressCheck);_t.w != _c.w; })), 0)
)
1489 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1490#endif /* TypeCheck */
1491
1492#if TypeCheck1
1493 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
1494 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1495#endif /* TypeCheck */
1496
1497#if TypeCheck1
1498 if (BAD_TYPECHECK(&In0P->dest_addressType, &dest_addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->dest_addressType); _c.t =
*(&dest_addressCheck);_t.w != _c.w; })), 0)
)
1499 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1500#endif /* TypeCheck */
1501
1502 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1503
1504 OutP->RetCode = vm_copy(target_task, In0P->source_address, In0P->size, In0P->dest_address);
1505 vm_map_deallocate(target_task);
1506}
1507
1508/* Default implementation of vm_copy */
1509#ifdef MIG_EOPNOTSUPP
1510kern_return_t __attribute__ ((weak))
1511vm_copy
1512(
1513 vm_map_t target_task,
1514 vm_address_t source_address,
1515 vm_size_t size,
1516 vm_address_t dest_address
1517) { return MIG_EOPNOTSUPP; }
1518#endif /* MIG_EOPNOTSUPP */
1519
1520/* Routine vm_region */
1521mig_internalstatic void _Xvm_region
1522 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1523{
1524 typedef struct {
1525 mach_msg_header_t Head;
1526 mach_msg_type_t addressType;
1527 vm_address_t address;
1528 } Request;
1529
1530 typedef struct {
1531 mach_msg_header_t Head;
1532 mach_msg_type_t RetCodeType;
1533 kern_return_t RetCode;
1534 mach_msg_type_t addressType;
1535 vm_address_t address;
1536 mach_msg_type_t sizeType;
1537 vm_size_t size;
1538 mach_msg_type_t protectionType;
1539 vm_prot_t protection;
1540 mach_msg_type_t max_protectionType;
1541 vm_prot_t max_protection;
1542 mach_msg_type_t inheritanceType;
1543 vm_inherit_t inheritance;
1544 mach_msg_type_t is_sharedType;
1545 boolean_t is_shared;
1546 mach_msg_type_t object_nameType;
1547 ipc_port_t object_name;
1548 mach_msg_type_t offsetType;
1549 vm_offset_t offset;
1550 } Reply;
1551
1552 Request *In0P = (Request *) InHeadP;
1553 Reply *OutP = (Reply *) OutHeadP;
1554 mig_external kern_return_t vm_region
1555 (vm_map_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, ipc_port_t *object_name, vm_offset_t *offset);
1556
1557 const mach_msg_type_t addressCheck = {
1558 /* msgt_name = */ 2,
1559 /* msgt_size = */ 32,
1560 /* msgt_number = */ 1,
1561 /* msgt_inline = */ TRUE((boolean_t) 1),
1562 /* msgt_longform = */ FALSE((boolean_t) 0),
1563 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1564 /* msgt_unused = */ 0
1565 };
1566
1567 const mach_msg_type_t addressType = {
1568 /* msgt_name = */ 2,
1569 /* msgt_size = */ 32,
1570 /* msgt_number = */ 1,
1571 /* msgt_inline = */ TRUE((boolean_t) 1),
1572 /* msgt_longform = */ FALSE((boolean_t) 0),
1573 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1574 /* msgt_unused = */ 0
1575 };
1576
1577 const mach_msg_type_t sizeType = {
1578 /* msgt_name = */ 2,
1579 /* msgt_size = */ 32,
1580 /* msgt_number = */ 1,
1581 /* msgt_inline = */ TRUE((boolean_t) 1),
1582 /* msgt_longform = */ FALSE((boolean_t) 0),
1583 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1584 /* msgt_unused = */ 0
1585 };
1586
1587 const mach_msg_type_t protectionType = {
1588 /* msgt_name = */ 2,
1589 /* msgt_size = */ 32,
1590 /* msgt_number = */ 1,
1591 /* msgt_inline = */ TRUE((boolean_t) 1),
1592 /* msgt_longform = */ FALSE((boolean_t) 0),
1593 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1594 /* msgt_unused = */ 0
1595 };
1596
1597 const mach_msg_type_t max_protectionType = {
1598 /* msgt_name = */ 2,
1599 /* msgt_size = */ 32,
1600 /* msgt_number = */ 1,
1601 /* msgt_inline = */ TRUE((boolean_t) 1),
1602 /* msgt_longform = */ FALSE((boolean_t) 0),
1603 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1604 /* msgt_unused = */ 0
1605 };
1606
1607 const mach_msg_type_t inheritanceType = {
1608 /* msgt_name = */ 2,
1609 /* msgt_size = */ 32,
1610 /* msgt_number = */ 1,
1611 /* msgt_inline = */ TRUE((boolean_t) 1),
1612 /* msgt_longform = */ FALSE((boolean_t) 0),
1613 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1614 /* msgt_unused = */ 0
1615 };
1616
1617 const mach_msg_type_t is_sharedType = {
1618 /* msgt_name = */ 0,
1619 /* msgt_size = */ 32,
1620 /* msgt_number = */ 1,
1621 /* msgt_inline = */ TRUE((boolean_t) 1),
1622 /* msgt_longform = */ FALSE((boolean_t) 0),
1623 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1624 /* msgt_unused = */ 0
1625 };
1626
1627 const mach_msg_type_t object_nameType = {
1628 /* msgt_name = */ 17,
1629 /* msgt_size = */ 32,
1630 /* msgt_number = */ 1,
1631 /* msgt_inline = */ TRUE((boolean_t) 1),
1632 /* msgt_longform = */ FALSE((boolean_t) 0),
1633 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1634 /* msgt_unused = */ 0
1635 };
1636
1637 const mach_msg_type_t offsetType = {
1638 /* msgt_name = */ 2,
1639 /* msgt_size = */ 32,
1640 /* msgt_number = */ 1,
1641 /* msgt_inline = */ TRUE((boolean_t) 1),
1642 /* msgt_longform = */ FALSE((boolean_t) 0),
1643 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1644 /* msgt_unused = */ 0
1645 };
1646
1647 vm_map_t target_task;
1648
1649#if TypeCheck1
1650 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1651 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1652 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1653#endif /* TypeCheck */
1654
1655#if TypeCheck1
1656 if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addressType); _c.t = *(&
addressCheck);_t.w != _c.w; })), 0)
)
1657 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1658#endif /* TypeCheck */
1659
1660 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1661
1662 OutP->RetCode = vm_region(target_task, &In0P->address, &OutP->size, &OutP->protection, &OutP->max_protection, &OutP->inheritance, &OutP->is_shared, &OutP->object_name, &OutP->offset);
1663 vm_map_deallocate(target_task);
1664 if (OutP->RetCode != KERN_SUCCESS0)
1665 return;
1666
1667 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1668 OutP->Head.msgh_size = 96;
1669
1670 OutP->addressType = addressType;
1671
1672 OutP->address = In0P->address;
1673
1674 OutP->sizeType = sizeType;
1675
1676 OutP->protectionType = protectionType;
1677
1678 OutP->max_protectionType = max_protectionType;
1679
1680 OutP->inheritanceType = inheritanceType;
1681
1682 OutP->is_sharedType = is_sharedType;
1683
1684 OutP->object_nameType = object_nameType;
1685
1686 OutP->offsetType = offsetType;
1687}
1688
1689/* Default implementation of vm_region */
1690#ifdef MIG_EOPNOTSUPP
1691kern_return_t __attribute__ ((weak))
1692vm_region
1693(
1694 vm_map_t target_task,
1695 vm_address_t *address,
1696 vm_size_t *size,
1697 vm_prot_t *protection,
1698 vm_prot_t *max_protection,
1699 vm_inherit_t *inheritance,
1700 boolean_t *is_shared,
1701 ipc_port_t *object_name,
1702 vm_offset_t *offset
1703) { return MIG_EOPNOTSUPP; }
1704#endif /* MIG_EOPNOTSUPP */
1705
1706/* Routine vm_statistics */
1707mig_internalstatic void _Xvm_statistics
1708 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1709{
1710 typedef struct {
1711 mach_msg_header_t Head;
1712 } Request;
1713
1714 typedef struct {
1715 mach_msg_header_t Head;
1716 mach_msg_type_t RetCodeType;
1717 kern_return_t RetCode;
1718 mach_msg_type_t vm_statsType;
1719 vm_statistics_data_t vm_stats;
1720 } Reply;
1721
1722 Request *In0P = (Request *) InHeadP;
1723 Reply *OutP = (Reply *) OutHeadP;
1724 mig_external kern_return_t vm_statistics
1725 (vm_map_t target_task, vm_statistics_data_t *vm_stats);
1726
1727 const mach_msg_type_t vm_statsType = {
1728 /* msgt_name = */ 2,
1729 /* msgt_size = */ 32,
1730 /* msgt_number = */ 13,
1731 /* msgt_inline = */ TRUE((boolean_t) 1),
1732 /* msgt_longform = */ FALSE((boolean_t) 0),
1733 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1734 /* msgt_unused = */ 0
1735 };
1736
1737 vm_map_t target_task;
1738
1739#if TypeCheck1
1740 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1741 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1742 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1743#endif /* TypeCheck */
1744
1745 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1746
1747 OutP->RetCode = vm_statistics(target_task, &OutP->vm_stats);
1748 vm_map_deallocate(target_task);
1749 if (OutP->RetCode != KERN_SUCCESS0)
1750 return;
1751
1752 OutP->Head.msgh_size = 88;
1753
1754 OutP->vm_statsType = vm_statsType;
1755}
1756
1757/* Default implementation of vm_statistics */
1758#ifdef MIG_EOPNOTSUPP
1759kern_return_t __attribute__ ((weak))
1760vm_statistics
1761(
1762 vm_map_t target_task,
1763 vm_statistics_data_t *vm_stats
1764) { return MIG_EOPNOTSUPP; }
1765#endif /* MIG_EOPNOTSUPP */
1766
1767/* Routine mach_ports_register */
1768mig_internalstatic void _Xmach_ports_register
1769 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1770{
1771 typedef struct {
1772 mach_msg_header_t Head;
1773 mach_msg_type_long_t init_port_setType;
1774 mach_port_array_t init_port_set;
1775 } Request;
1776
1777 typedef struct {
1778 mach_msg_header_t Head;
1779 mach_msg_type_t RetCodeType;
1780 kern_return_t RetCode;
1781 } Reply;
1782
1783 Request *In0P = (Request *) InHeadP;
1784 Reply *OutP = (Reply *) OutHeadP;
1785 mig_external kern_return_t mach_ports_register
1786 (task_t target_task, mach_port_array_t init_port_set, mach_msg_type_number_t init_port_setCnt);
1787
1788 task_t target_task;
1789
1790#if TypeCheck1
1791 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
1792 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1793 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1794#endif /* TypeCheck */
1795
1796#if TypeCheck1
1797 if (mig_unlikely ((In0P->init_port_setType.msgtl_header.msgt_inline != FALSE) ||__builtin_expect (!! ((In0P->init_port_setType.msgtl_header
.msgt_inline != ((boolean_t) 0)) || (In0P->init_port_setType
.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->
init_port_setType.msgtl_name != 17) || (In0P->init_port_setType
.msgtl_size != 32)), 0)
1798 (In0P->init_port_setType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->init_port_setType.msgtl_header
.msgt_inline != ((boolean_t) 0)) || (In0P->init_port_setType
.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->
init_port_setType.msgtl_name != 17) || (In0P->init_port_setType
.msgtl_size != 32)), 0)
1799 (In0P->init_port_setType.msgtl_name != 17) ||__builtin_expect (!! ((In0P->init_port_setType.msgtl_header
.msgt_inline != ((boolean_t) 0)) || (In0P->init_port_setType
.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->
init_port_setType.msgtl_name != 17) || (In0P->init_port_setType
.msgtl_size != 32)), 0)
1800 (In0P->init_port_setType.msgtl_size != 32))__builtin_expect (!! ((In0P->init_port_setType.msgtl_header
.msgt_inline != ((boolean_t) 0)) || (In0P->init_port_setType
.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->
init_port_setType.msgtl_name != 17) || (In0P->init_port_setType
.msgtl_size != 32)), 0)
)
1801 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1802#endif /* TypeCheck */
1803
1804 target_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1805
1806 OutP->RetCode = mach_ports_register(target_task, In0P->init_port_set, In0P->init_port_setType.msgtl_number);
1807 task_deallocate(target_task);
1808}
1809
1810/* Default implementation of mach_ports_register */
1811#ifdef MIG_EOPNOTSUPP
1812kern_return_t __attribute__ ((weak))
1813mach_ports_register
1814(
1815 task_t target_task,
1816 mach_port_array_t init_port_set,
1817 mach_msg_type_number_t init_port_setCnt
1818) { return MIG_EOPNOTSUPP; }
1819#endif /* MIG_EOPNOTSUPP */
1820
1821/* Routine mach_ports_lookup */
1822mig_internalstatic void _Xmach_ports_lookup
1823 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1824{
1825 typedef struct {
1826 mach_msg_header_t Head;
1827 } Request;
1828
1829 typedef struct {
1830 mach_msg_header_t Head;
1831 mach_msg_type_t RetCodeType;
1832 kern_return_t RetCode;
1833 mach_msg_type_long_t init_port_setType;
1834 mach_port_array_t init_port_set;
1835 } Reply;
1836
1837 Request *In0P = (Request *) InHeadP;
1838 Reply *OutP = (Reply *) OutHeadP;
1839 mig_external kern_return_t mach_ports_lookup
1840 (task_t target_task, mach_port_array_t *init_port_set, mach_msg_type_number_t *init_port_setCnt);
1841
1842 const mach_msg_type_long_t init_port_setType = {
1843 {
1844 /* msgt_name = */ 0,
1845 /* msgt_size = */ 0,
1846 /* msgt_number = */ 0,
1847 /* msgt_inline = */ FALSE((boolean_t) 0),
1848 /* msgt_longform = */ TRUE((boolean_t) 1),
1849 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1850 /* msgt_unused = */ 0
1851 },
1852 /* msgtl_name = */ 17,
1853 /* msgtl_size = */ 32,
1854 /* msgtl_number = */ 0,
1855 };
1856
1857 task_t target_task;
1858 mach_msg_type_number_t init_port_setCnt;
1859
1860#if TypeCheck1
1861 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1862 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1863 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1864#endif /* TypeCheck */
1865
1866 target_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1867
1868 OutP->RetCode = mach_ports_lookup(target_task, &OutP->init_port_set, &init_port_setCnt);
1869 task_deallocate(target_task);
1870 if (OutP->RetCode != KERN_SUCCESS0)
1871 return;
1872
1873 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1874 OutP->Head.msgh_size = 48;
1875
1876 OutP->init_port_setType = init_port_setType;
1877
1878 OutP->init_port_setType.msgtl_number = init_port_setCnt;
1879}
1880
1881/* Default implementation of mach_ports_lookup */
1882#ifdef MIG_EOPNOTSUPP
1883kern_return_t __attribute__ ((weak))
1884mach_ports_lookup
1885(
1886 task_t target_task,
1887 mach_port_array_t *init_port_set,
1888 mach_msg_type_number_t *init_port_setCnt
1889) { return MIG_EOPNOTSUPP; }
1890#endif /* MIG_EOPNOTSUPP */
1891
1892/* SimpleRoutine memory_object_data_provided */
1893mig_internalstatic void _Xmemory_object_data_provided
1894 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1895{
1896 typedef struct {
1897 mach_msg_header_t Head;
1898 mach_msg_type_t offsetType;
1899 vm_offset_t offset;
1900 mach_msg_type_long_t dataType;
1901 vm_offset_t data;
1902 mach_msg_type_t lock_valueType;
1903 vm_prot_t lock_value;
1904 } Request;
1905
1906 typedef struct {
1907 mach_msg_header_t Head;
1908 mach_msg_type_t RetCodeType;
1909 kern_return_t RetCode;
1910 } Reply;
1911
1912 Request *In0P = (Request *) InHeadP;
1913 Reply *OutP = (Reply *) OutHeadP;
1914 mig_external kern_return_t memory_object_data_provided
1915 (vm_object_t memory_control, vm_offset_t offset, vm_offset_t data, mach_msg_type_number_t dataCnt, vm_prot_t lock_value);
1916
1917 const mach_msg_type_t offsetCheck = {
1918 /* msgt_name = */ 2,
1919 /* msgt_size = */ 32,
1920 /* msgt_number = */ 1,
1921 /* msgt_inline = */ TRUE((boolean_t) 1),
1922 /* msgt_longform = */ FALSE((boolean_t) 0),
1923 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1924 /* msgt_unused = */ 0
1925 };
1926
1927 const mach_msg_type_t lock_valueCheck = {
1928 /* msgt_name = */ 2,
1929 /* msgt_size = */ 32,
1930 /* msgt_number = */ 1,
1931 /* msgt_inline = */ TRUE((boolean_t) 1),
1932 /* msgt_longform = */ FALSE((boolean_t) 0),
1933 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1934 /* msgt_unused = */ 0
1935 };
1936
1937#if TypeCheck1
1938 if (mig_unlikely ((In0P->Head.msgh_size != 56) ||__builtin_expect (!! ((In0P->Head.msgh_size != 56) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
1939 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 56) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1940 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1941#endif /* TypeCheck */
1942
1943#if TypeCheck1
1944 if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->offsetType); _c.t = *(&
offsetCheck);_t.w != _c.w; })), 0)
)
1945 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1946#endif /* TypeCheck */
1947
1948#if TypeCheck1
1949 if (mig_unlikely ((In0P->dataType.msgtl_header.msgt_inline != FALSE) ||__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
1950 (In0P->dataType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
1951 (In0P->dataType.msgtl_name != 9) ||__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
1952 (In0P->dataType.msgtl_size != 8))__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
)
1953 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1954#endif /* TypeCheck */
1955
1956#if TypeCheck1
1957 if (BAD_TYPECHECK(&In0P->lock_valueType, &lock_valueCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->lock_valueType); _c.t = *
(&lock_valueCheck);_t.w != _c.w; })), 0)
)
1958 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1959#endif /* TypeCheck */
1960
1961 OutP->RetCode = memory_object_data_provided(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), In0P->offset, In0P->data, In0P->dataType.msgtl_number, In0P->lock_value);
1962}
1963
1964/* Default implementation of memory_object_data_provided */
1965#ifdef MIG_EOPNOTSUPP
1966kern_return_t __attribute__ ((weak))
1967memory_object_data_provided
1968(
1969 vm_object_t memory_control,
1970 vm_offset_t offset,
1971 vm_offset_t data,
1972 mach_msg_type_number_t dataCnt,
1973 vm_prot_t lock_value
1974) { return MIG_EOPNOTSUPP; }
1975#endif /* MIG_EOPNOTSUPP */
1976
1977/* SimpleRoutine memory_object_data_unavailable */
1978mig_internalstatic void _Xmemory_object_data_unavailable
1979 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1980{
1981 typedef struct {
1982 mach_msg_header_t Head;
1983 mach_msg_type_t offsetType;
1984 vm_offset_t offset;
1985 mach_msg_type_t sizeType;
1986 vm_size_t size;
1987 } Request;
1988
1989 typedef struct {
1990 mach_msg_header_t Head;
1991 mach_msg_type_t RetCodeType;
1992 kern_return_t RetCode;
1993 } Reply;
1994
1995 Request *In0P = (Request *) InHeadP;
1996 Reply *OutP = (Reply *) OutHeadP;
1997 mig_external kern_return_t memory_object_data_unavailable
1998 (vm_object_t memory_control, vm_offset_t offset, vm_size_t size);
1999
2000 const mach_msg_type_t offsetCheck = {
2001 /* msgt_name = */ 2,
2002 /* msgt_size = */ 32,
2003 /* msgt_number = */ 1,
2004 /* msgt_inline = */ TRUE((boolean_t) 1),
2005 /* msgt_longform = */ FALSE((boolean_t) 0),
2006 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2007 /* msgt_unused = */ 0
2008 };
2009
2010 const mach_msg_type_t sizeCheck = {
2011 /* msgt_name = */ 2,
2012 /* msgt_size = */ 32,
2013 /* msgt_number = */ 1,
2014 /* msgt_inline = */ TRUE((boolean_t) 1),
2015 /* msgt_longform = */ FALSE((boolean_t) 0),
2016 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2017 /* msgt_unused = */ 0
2018 };
2019
2020#if TypeCheck1
2021 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2022 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2023 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2024#endif /* TypeCheck */
2025
2026#if TypeCheck1
2027 if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->offsetType); _c.t = *(&
offsetCheck);_t.w != _c.w; })), 0)
)
2028 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2029#endif /* TypeCheck */
2030
2031#if TypeCheck1
2032 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
2033 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2034#endif /* TypeCheck */
2035
2036 OutP->RetCode = memory_object_data_unavailable(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), In0P->offset, In0P->size);
2037}
2038
2039/* Default implementation of memory_object_data_unavailable */
2040#ifdef MIG_EOPNOTSUPP
2041kern_return_t __attribute__ ((weak))
2042memory_object_data_unavailable
2043(
2044 vm_object_t memory_control,
2045 vm_offset_t offset,
2046 vm_size_t size
2047) { return MIG_EOPNOTSUPP; }
2048#endif /* MIG_EOPNOTSUPP */
2049
2050/* Routine memory_object_get_attributes */
2051mig_internalstatic void _Xmemory_object_get_attributes
2052 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2053{
2054 typedef struct {
2055 mach_msg_header_t Head;
2056 } Request;
2057
2058 typedef struct {
2059 mach_msg_header_t Head;
2060 mach_msg_type_t RetCodeType;
2061 kern_return_t RetCode;
2062 mach_msg_type_t object_readyType;
2063 boolean_t object_ready;
2064 mach_msg_type_t may_cacheType;
2065 boolean_t may_cache;
2066 mach_msg_type_t copy_strategyType;
2067 memory_object_copy_strategy_t copy_strategy;
2068 } Reply;
2069
2070 Request *In0P = (Request *) InHeadP;
2071 Reply *OutP = (Reply *) OutHeadP;
2072 mig_external kern_return_t memory_object_get_attributes
2073 (vm_object_t memory_control, boolean_t *object_ready, boolean_t *may_cache, memory_object_copy_strategy_t *copy_strategy);
2074
2075 const mach_msg_type_t object_readyType = {
2076 /* msgt_name = */ 0,
2077 /* msgt_size = */ 32,
2078 /* msgt_number = */ 1,
2079 /* msgt_inline = */ TRUE((boolean_t) 1),
2080 /* msgt_longform = */ FALSE((boolean_t) 0),
2081 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2082 /* msgt_unused = */ 0
2083 };
2084
2085 const mach_msg_type_t may_cacheType = {
2086 /* msgt_name = */ 0,
2087 /* msgt_size = */ 32,
2088 /* msgt_number = */ 1,
2089 /* msgt_inline = */ TRUE((boolean_t) 1),
2090 /* msgt_longform = */ FALSE((boolean_t) 0),
2091 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2092 /* msgt_unused = */ 0
2093 };
2094
2095 const mach_msg_type_t copy_strategyType = {
2096 /* msgt_name = */ 2,
2097 /* msgt_size = */ 32,
2098 /* msgt_number = */ 1,
2099 /* msgt_inline = */ TRUE((boolean_t) 1),
2100 /* msgt_longform = */ FALSE((boolean_t) 0),
2101 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2102 /* msgt_unused = */ 0
2103 };
2104
2105#if TypeCheck1
2106 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2107 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2108 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2109#endif /* TypeCheck */
2110
2111 OutP->RetCode = memory_object_get_attributes(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), &OutP->object_ready, &OutP->may_cache, &OutP->copy_strategy);
2112 if (OutP->RetCode != KERN_SUCCESS0)
2113 return;
2114
2115 OutP->Head.msgh_size = 56;
2116
2117 OutP->object_readyType = object_readyType;
2118
2119 OutP->may_cacheType = may_cacheType;
2120
2121 OutP->copy_strategyType = copy_strategyType;
2122}
2123
2124/* Default implementation of memory_object_get_attributes */
2125#ifdef MIG_EOPNOTSUPP
2126kern_return_t __attribute__ ((weak))
2127memory_object_get_attributes
2128(
2129 vm_object_t memory_control,
2130 boolean_t *object_ready,
2131 boolean_t *may_cache,
2132 memory_object_copy_strategy_t *copy_strategy
2133) { return MIG_EOPNOTSUPP; }
2134#endif /* MIG_EOPNOTSUPP */
2135
2136/* Routine vm_set_default_memory_manager */
2137mig_internalstatic void _Xvm_set_default_memory_manager
2138 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2139{
2140 typedef struct {
2141 mach_msg_header_t Head;
2142 mach_msg_type_t default_managerType;
2143 ipc_port_t default_manager;
2144 } Request;
2145
2146 typedef struct {
2147 mach_msg_header_t Head;
2148 mach_msg_type_t RetCodeType;
2149 kern_return_t RetCode;
2150 mach_msg_type_t default_managerType;
2151 ipc_port_t default_manager;
2152 } Reply;
2153
2154 Request *In0P = (Request *) InHeadP;
2155 Reply *OutP = (Reply *) OutHeadP;
2156 mig_external kern_return_t vm_set_default_memory_manager
2157 (host_t host_priv, ipc_port_t *default_manager);
2158
2159 const mach_msg_type_t default_managerType = {
2160 /* msgt_name = */ 17,
2161 /* msgt_size = */ 32,
2162 /* msgt_number = */ 1,
2163 /* msgt_inline = */ TRUE((boolean_t) 1),
2164 /* msgt_longform = */ FALSE((boolean_t) 0),
2165 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2166 /* msgt_unused = */ 0
2167 };
2168
2169#if TypeCheck1
2170 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
2171 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2172 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2173#endif /* TypeCheck */
2174
2175#if TypeCheck1
2176 if (mig_unlikely ((In0P->default_managerType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->default_managerType.msgt_inline
!= ((boolean_t) 1)) || (In0P->default_managerType.msgt_longform
!= ((boolean_t) 0)) || (In0P->default_managerType.msgt_name
!= 17) || (In0P->default_managerType.msgt_number != 1) ||
(In0P->default_managerType.msgt_size != 32)), 0)
2177 (In0P->default_managerType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->default_managerType.msgt_inline
!= ((boolean_t) 1)) || (In0P->default_managerType.msgt_longform
!= ((boolean_t) 0)) || (In0P->default_managerType.msgt_name
!= 17) || (In0P->default_managerType.msgt_number != 1) ||
(In0P->default_managerType.msgt_size != 32)), 0)
2178 (In0P->default_managerType.msgt_name != 17) ||__builtin_expect (!! ((In0P->default_managerType.msgt_inline
!= ((boolean_t) 1)) || (In0P->default_managerType.msgt_longform
!= ((boolean_t) 0)) || (In0P->default_managerType.msgt_name
!= 17) || (In0P->default_managerType.msgt_number != 1) ||
(In0P->default_managerType.msgt_size != 32)), 0)
2179 (In0P->default_managerType.msgt_number != 1) ||__builtin_expect (!! ((In0P->default_managerType.msgt_inline
!= ((boolean_t) 1)) || (In0P->default_managerType.msgt_longform
!= ((boolean_t) 0)) || (In0P->default_managerType.msgt_name
!= 17) || (In0P->default_managerType.msgt_number != 1) ||
(In0P->default_managerType.msgt_size != 32)), 0)
2180 (In0P->default_managerType.msgt_size != 32))__builtin_expect (!! ((In0P->default_managerType.msgt_inline
!= ((boolean_t) 1)) || (In0P->default_managerType.msgt_longform
!= ((boolean_t) 0)) || (In0P->default_managerType.msgt_name
!= 17) || (In0P->default_managerType.msgt_number != 1) ||
(In0P->default_managerType.msgt_size != 32)), 0)
)
2181 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2182#endif /* TypeCheck */
2183
2184 OutP->RetCode = vm_set_default_memory_manager(convert_port_to_host_priv((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), &In0P->default_manager);
2185 if (OutP->RetCode != KERN_SUCCESS0)
2186 return;
2187
2188 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
2189 OutP->Head.msgh_size = 40;
2190
2191 OutP->default_managerType = default_managerType;
2192
2193 OutP->default_manager = In0P->default_manager;
2194}
2195
2196/* Default implementation of vm_set_default_memory_manager */
2197#ifdef MIG_EOPNOTSUPP
2198kern_return_t __attribute__ ((weak))
2199vm_set_default_memory_manager
2200(
2201 host_t host_priv,
2202 ipc_port_t *default_manager
2203) { return MIG_EOPNOTSUPP; }
2204#endif /* MIG_EOPNOTSUPP */
2205
2206/* SimpleRoutine memory_object_lock_request */
2207mig_internalstatic void _Xmemory_object_lock_request
2208 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2209{
2210 typedef struct {
2211 mach_msg_header_t Head;
2212 mach_msg_type_t offsetType;
2213 vm_offset_t offset;
2214 mach_msg_type_t sizeType;
2215 vm_size_t size;
2216 mach_msg_type_t should_returnType;
2217 memory_object_return_t should_return;
2218 mach_msg_type_t should_flushType;
2219 boolean_t should_flush;
2220 mach_msg_type_t lock_valueType;
2221 vm_prot_t lock_value;
2222 mach_msg_type_t reply_toType;
2223 ipc_port_t reply_to;
2224 } Request;
2225
2226 typedef struct {
2227 mach_msg_header_t Head;
2228 mach_msg_type_t RetCodeType;
2229 kern_return_t RetCode;
2230 } Reply;
2231
2232 Request *In0P = (Request *) InHeadP;
2233 Reply *OutP = (Reply *) OutHeadP;
2234 mig_external kern_return_t memory_object_lock_request
2235 (vm_object_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, ipc_port_t reply_to, mach_msg_type_name_t reply_toPoly);
2236
2237#if TypeCheck1
2238 boolean_t msgh_simple = msgh_simple;
2239#endif /* TypeCheck */
2240
2241 const mach_msg_type_t offsetCheck = {
2242 /* msgt_name = */ 2,
2243 /* msgt_size = */ 32,
2244 /* msgt_number = */ 1,
2245 /* msgt_inline = */ TRUE((boolean_t) 1),
2246 /* msgt_longform = */ FALSE((boolean_t) 0),
2247 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2248 /* msgt_unused = */ 0
2249 };
2250
2251 const mach_msg_type_t sizeCheck = {
2252 /* msgt_name = */ 2,
2253 /* msgt_size = */ 32,
2254 /* msgt_number = */ 1,
2255 /* msgt_inline = */ TRUE((boolean_t) 1),
2256 /* msgt_longform = */ FALSE((boolean_t) 0),
2257 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2258 /* msgt_unused = */ 0
2259 };
2260
2261 const mach_msg_type_t should_returnCheck = {
2262 /* msgt_name = */ 2,
2263 /* msgt_size = */ 32,
2264 /* msgt_number = */ 1,
2265 /* msgt_inline = */ TRUE((boolean_t) 1),
2266 /* msgt_longform = */ FALSE((boolean_t) 0),
2267 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2268 /* msgt_unused = */ 0
2269 };
2270
2271 const mach_msg_type_t should_flushCheck = {
2272 /* msgt_name = */ 0,
2273 /* msgt_size = */ 32,
2274 /* msgt_number = */ 1,
2275 /* msgt_inline = */ TRUE((boolean_t) 1),
2276 /* msgt_longform = */ FALSE((boolean_t) 0),
2277 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2278 /* msgt_unused = */ 0
2279 };
2280
2281 const mach_msg_type_t lock_valueCheck = {
2282 /* msgt_name = */ 2,
2283 /* msgt_size = */ 32,
2284 /* msgt_number = */ 1,
2285 /* msgt_inline = */ TRUE((boolean_t) 1),
2286 /* msgt_longform = */ FALSE((boolean_t) 0),
2287 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2288 /* msgt_unused = */ 0
2289 };
2290
2291#if TypeCheck1
2292 msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U);
2293 if (mig_unlikely ((In0P->Head.msgh_size != 72))__builtin_expect (!! ((In0P->Head.msgh_size != 72)), 0))
2294 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2295#endif /* TypeCheck */
2296
2297#if TypeCheck1
2298 if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->offsetType); _c.t = *(&
offsetCheck);_t.w != _c.w; })), 0)
)
2299 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2300#endif /* TypeCheck */
2301
2302#if TypeCheck1
2303 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
2304 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2305#endif /* TypeCheck */
2306
2307#if TypeCheck1
2308 if (BAD_TYPECHECK(&In0P->should_returnType, &should_returnCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->should_returnType); _c.t
= *(&should_returnCheck);_t.w != _c.w; })), 0)
)
2309 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2310#endif /* TypeCheck */
2311
2312#if TypeCheck1
2313 if (BAD_TYPECHECK(&In0P->should_flushType, &should_flushCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->should_flushType); _c.t =
*(&should_flushCheck);_t.w != _c.w; })), 0)
)
2314 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2315#endif /* TypeCheck */
2316
2317#if TypeCheck1
2318 if (BAD_TYPECHECK(&In0P->lock_valueType, &lock_valueCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->lock_valueType); _c.t = *
(&lock_valueCheck);_t.w != _c.w; })), 0)
)
2319 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2320#endif /* TypeCheck */
2321
2322#if TypeCheck1
2323 if (mig_unlikely ((In0P->reply_toType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
2324 (In0P->reply_toType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
2325 (MACH_MSG_TYPE_PORT_ANY(In0P->reply_toType.msgt_name) && msgh_simple) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
2326 (In0P->reply_toType.msgt_number != 1) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
2327 (In0P->reply_toType.msgt_size != 32))__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
)
2328 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2329#endif /* TypeCheck */
2330
2331 OutP->RetCode = memory_object_lock_request(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), In0P->offset, In0P->size, In0P->should_return, In0P->should_flush, In0P->lock_value, In0P->reply_to, In0P->reply_toType.msgt_name);
2332}
2333
2334/* Default implementation of memory_object_lock_request */
2335#ifdef MIG_EOPNOTSUPP
2336kern_return_t __attribute__ ((weak))
2337memory_object_lock_request
2338(
2339 vm_object_t memory_control,
2340 vm_offset_t offset,
2341 vm_size_t size,
2342 memory_object_return_t should_return,
2343 boolean_t should_flush,
2344 vm_prot_t lock_value,
2345 ipc_port_t reply_to,
2346 mach_msg_type_name_t reply_toPoly
2347) { return MIG_EOPNOTSUPP; }
2348#endif /* MIG_EOPNOTSUPP */
2349
2350/* Routine task_suspend */
2351mig_internalstatic void _Xtask_suspend
2352 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2353{
2354 typedef struct {
2355 mach_msg_header_t Head;
2356 } Request;
2357
2358 typedef struct {
2359 mach_msg_header_t Head;
2360 mach_msg_type_t RetCodeType;
2361 kern_return_t RetCode;
2362 } Reply;
2363
2364 Request *In0P = (Request *) InHeadP;
2365 Reply *OutP = (Reply *) OutHeadP;
2366 mig_external kern_return_t task_suspend
2367 (task_t target_task);
2368
2369 task_t target_task;
2370
2371#if TypeCheck1
2372 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2373 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2374 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2375#endif /* TypeCheck */
2376
2377 target_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2378
2379 OutP->RetCode = task_suspend(target_task);
2380 task_deallocate(target_task);
2381}
2382
2383/* Default implementation of task_suspend */
2384#ifdef MIG_EOPNOTSUPP
2385kern_return_t __attribute__ ((weak))
2386task_suspend
2387(
2388 task_t target_task
2389) { return MIG_EOPNOTSUPP; }
2390#endif /* MIG_EOPNOTSUPP */
2391
2392/* Routine task_resume */
2393mig_internalstatic void _Xtask_resume
2394 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2395{
2396 typedef struct {
2397 mach_msg_header_t Head;
2398 } Request;
2399
2400 typedef struct {
2401 mach_msg_header_t Head;
2402 mach_msg_type_t RetCodeType;
2403 kern_return_t RetCode;
2404 } Reply;
2405
2406 Request *In0P = (Request *) InHeadP;
2407 Reply *OutP = (Reply *) OutHeadP;
2408 mig_external kern_return_t task_resume
2409 (task_t target_task);
2410
2411 task_t target_task;
2412
2413#if TypeCheck1
2414 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2415 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2416 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2417#endif /* TypeCheck */
2418
2419 target_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2420
2421 OutP->RetCode = task_resume(target_task);
2422 task_deallocate(target_task);
2423}
2424
2425/* Default implementation of task_resume */
2426#ifdef MIG_EOPNOTSUPP
2427kern_return_t __attribute__ ((weak))
2428task_resume
2429(
2430 task_t target_task
2431) { return MIG_EOPNOTSUPP; }
2432#endif /* MIG_EOPNOTSUPP */
2433
2434/* Routine task_get_special_port */
2435mig_internalstatic void _Xtask_get_special_port
2436 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2437{
2438 typedef struct {
2439 mach_msg_header_t Head;
2440 mach_msg_type_t which_portType;
2441 int which_port;
2442 } Request;
2443
2444 typedef struct {
2445 mach_msg_header_t Head;
2446 mach_msg_type_t RetCodeType;
2447 kern_return_t RetCode;
2448 mach_msg_type_t special_portType;
2449 ipc_port_t special_port;
2450 } Reply;
2451
2452 Request *In0P = (Request *) InHeadP;
2453 Reply *OutP = (Reply *) OutHeadP;
2454 mig_external kern_return_t task_get_special_port
2455 (task_t task, int which_port, ipc_port_t *special_port);
2456
2457 const mach_msg_type_t which_portCheck = {
2458 /* msgt_name = */ 2,
2459 /* msgt_size = */ 32,
2460 /* msgt_number = */ 1,
2461 /* msgt_inline = */ TRUE((boolean_t) 1),
2462 /* msgt_longform = */ FALSE((boolean_t) 0),
2463 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2464 /* msgt_unused = */ 0
2465 };
2466
2467 const mach_msg_type_t special_portType = {
2468 /* msgt_name = */ 17,
2469 /* msgt_size = */ 32,
2470 /* msgt_number = */ 1,
2471 /* msgt_inline = */ TRUE((boolean_t) 1),
2472 /* msgt_longform = */ FALSE((boolean_t) 0),
2473 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2474 /* msgt_unused = */ 0
2475 };
2476
2477 task_t task;
2478
2479#if TypeCheck1
2480 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2481 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2482 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2483#endif /* TypeCheck */
2484
2485#if TypeCheck1
2486 if (BAD_TYPECHECK(&In0P->which_portType, &which_portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->which_portType); _c.t = *
(&which_portCheck);_t.w != _c.w; })), 0)
)
2487 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2488#endif /* TypeCheck */
2489
2490 task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2491
2492 OutP->RetCode = task_get_special_port(task, In0P->which_port, &OutP->special_port);
2493 task_deallocate(task);
2494 if (OutP->RetCode != KERN_SUCCESS0)
2495 return;
2496
2497 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
2498 OutP->Head.msgh_size = 40;
2499
2500 OutP->special_portType = special_portType;
2501}
2502
2503/* Default implementation of task_get_special_port */
2504#ifdef MIG_EOPNOTSUPP
2505kern_return_t __attribute__ ((weak))
2506task_get_special_port
2507(
2508 task_t task,
2509 int which_port,
2510 ipc_port_t *special_port
2511) { return MIG_EOPNOTSUPP; }
2512#endif /* MIG_EOPNOTSUPP */
2513
2514/* Routine task_set_special_port */
2515mig_internalstatic void _Xtask_set_special_port
2516 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2517{
2518 typedef struct {
2519 mach_msg_header_t Head;
2520 mach_msg_type_t which_portType;
2521 int which_port;
2522 mach_msg_type_t special_portType;
2523 ipc_port_t special_port;
2524 } Request;
2525
2526 typedef struct {
2527 mach_msg_header_t Head;
2528 mach_msg_type_t RetCodeType;
2529 kern_return_t RetCode;
2530 } Reply;
2531
2532 Request *In0P = (Request *) InHeadP;
2533 Reply *OutP = (Reply *) OutHeadP;
2534 mig_external kern_return_t task_set_special_port
2535 (task_t task, int which_port, ipc_port_t special_port);
2536
2537 const mach_msg_type_t which_portCheck = {
2538 /* msgt_name = */ 2,
2539 /* msgt_size = */ 32,
2540 /* msgt_number = */ 1,
2541 /* msgt_inline = */ TRUE((boolean_t) 1),
2542 /* msgt_longform = */ FALSE((boolean_t) 0),
2543 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2544 /* msgt_unused = */ 0
2545 };
2546
2547 task_t task;
2548
2549#if TypeCheck1
2550 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
2551 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2552 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2553#endif /* TypeCheck */
2554
2555#if TypeCheck1
2556 if (BAD_TYPECHECK(&In0P->which_portType, &which_portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->which_portType); _c.t = *
(&which_portCheck);_t.w != _c.w; })), 0)
)
2557 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2558#endif /* TypeCheck */
2559
2560#if TypeCheck1
2561 if (mig_unlikely ((In0P->special_portType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
2562 (In0P->special_portType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
2563 (In0P->special_portType.msgt_name != 17) ||__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
2564 (In0P->special_portType.msgt_number != 1) ||__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
2565 (In0P->special_portType.msgt_size != 32))__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
)
2566 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2567#endif /* TypeCheck */
2568
2569 task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2570
2571 OutP->RetCode = task_set_special_port(task, In0P->which_port, In0P->special_port);
2572 task_deallocate(task);
2573}
2574
2575/* Default implementation of task_set_special_port */
2576#ifdef MIG_EOPNOTSUPP
2577kern_return_t __attribute__ ((weak))
2578task_set_special_port
2579(
2580 task_t task,
2581 int which_port,
2582 ipc_port_t special_port
2583) { return MIG_EOPNOTSUPP; }
2584#endif /* MIG_EOPNOTSUPP */
2585
2586/* Routine thread_create */
2587mig_internalstatic void _Xthread_create
2588 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2589{
2590 typedef struct {
2591 mach_msg_header_t Head;
2592 } Request;
2593
2594 typedef struct {
2595 mach_msg_header_t Head;
2596 mach_msg_type_t RetCodeType;
2597 kern_return_t RetCode;
2598 mach_msg_type_t child_threadType;
2599 ipc_port_t child_thread;
2600 } Reply;
2601
2602 Request *In0P = (Request *) InHeadP;
2603 Reply *OutP = (Reply *) OutHeadP;
2604 mig_external kern_return_t thread_create
2605 (task_t parent_task, thread_t *child_thread);
2606
2607 const mach_msg_type_t child_threadType = {
2608 /* msgt_name = */ 17,
2609 /* msgt_size = */ 32,
2610 /* msgt_number = */ 1,
2611 /* msgt_inline = */ TRUE((boolean_t) 1),
2612 /* msgt_longform = */ FALSE((boolean_t) 0),
2613 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2614 /* msgt_unused = */ 0
2615 };
2616
2617 task_t parent_task;
2618 thread_t child_thread;
2619
2620#if TypeCheck1
2621 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2622 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2623 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2624#endif /* TypeCheck */
2625
2626 parent_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2627
2628 OutP->RetCode = thread_create(parent_task, &child_thread);
2629 task_deallocate(parent_task);
2630 if (OutP->RetCode != KERN_SUCCESS0)
2631 return;
2632
2633 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
2634 OutP->Head.msgh_size = 40;
2635
2636 OutP->child_threadType = child_threadType;
2637
2638 OutP->child_thread = convert_thread_to_port(child_thread);
2639}
2640
2641/* Default implementation of thread_create */
2642#ifdef MIG_EOPNOTSUPP
2643kern_return_t __attribute__ ((weak))
2644thread_create
2645(
2646 task_t parent_task,
2647 thread_t *child_thread
2648) { return MIG_EOPNOTSUPP; }
2649#endif /* MIG_EOPNOTSUPP */
2650
2651/* Routine thread_suspend */
2652mig_internalstatic void _Xthread_suspend
2653 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2654{
2655 typedef struct {
2656 mach_msg_header_t Head;
2657 } Request;
2658
2659 typedef struct {
2660 mach_msg_header_t Head;
2661 mach_msg_type_t RetCodeType;
2662 kern_return_t RetCode;
2663 } Reply;
2664
2665 Request *In0P = (Request *) InHeadP;
2666 Reply *OutP = (Reply *) OutHeadP;
2667 mig_external kern_return_t thread_suspend
2668 (thread_t target_thread);
2669
2670 thread_t target_thread;
2671
2672#if TypeCheck1
2673 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2674 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2675 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2676#endif /* TypeCheck */
2677
2678 target_thread = convert_port_to_thread((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2679
2680 OutP->RetCode = thread_suspend(target_thread);
2681 thread_deallocate(target_thread);
2682}
2683
2684/* Default implementation of thread_suspend */
2685#ifdef MIG_EOPNOTSUPP
2686kern_return_t __attribute__ ((weak))
2687thread_suspend
2688(
2689 thread_t target_thread
2690) { return MIG_EOPNOTSUPP; }
2691#endif /* MIG_EOPNOTSUPP */
2692
2693/* Routine thread_resume */
2694mig_internalstatic void _Xthread_resume
2695 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2696{
2697 typedef struct {
2698 mach_msg_header_t Head;
2699 } Request;
2700
2701 typedef struct {
2702 mach_msg_header_t Head;
2703 mach_msg_type_t RetCodeType;
2704 kern_return_t RetCode;
2705 } Reply;
2706
2707 Request *In0P = (Request *) InHeadP;
2708 Reply *OutP = (Reply *) OutHeadP;
2709 mig_external kern_return_t thread_resume
2710 (thread_t target_thread);
2711
2712 thread_t target_thread;
2713
2714#if TypeCheck1
2715 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2716 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2717 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2718#endif /* TypeCheck */
2719
2720 target_thread = convert_port_to_thread((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2721
2722 OutP->RetCode = thread_resume(target_thread);
2723 thread_deallocate(target_thread);
2724}
2725
2726/* Default implementation of thread_resume */
2727#ifdef MIG_EOPNOTSUPP
2728kern_return_t __attribute__ ((weak))
2729thread_resume
2730(
2731 thread_t target_thread
2732) { return MIG_EOPNOTSUPP; }
2733#endif /* MIG_EOPNOTSUPP */
2734
2735/* Routine thread_abort */
2736mig_internalstatic void _Xthread_abort
2737 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2738{
2739 typedef struct {
2740 mach_msg_header_t Head;
2741 } Request;
2742
2743 typedef struct {
2744 mach_msg_header_t Head;
2745 mach_msg_type_t RetCodeType;
2746 kern_return_t RetCode;
2747 } Reply;
2748
2749 Request *In0P = (Request *) InHeadP;
2750 Reply *OutP = (Reply *) OutHeadP;
2751 mig_external kern_return_t thread_abort
2752 (thread_t target_thread);
2753
2754 thread_t target_thread;
2755
2756#if TypeCheck1
2757 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2758 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2759 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2760#endif /* TypeCheck */
2761
2762 target_thread = convert_port_to_thread((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2763
2764 OutP->RetCode = thread_abort(target_thread);
2765 thread_deallocate(target_thread);
2766}
2767
2768/* Default implementation of thread_abort */
2769#ifdef MIG_EOPNOTSUPP
2770kern_return_t __attribute__ ((weak))
2771thread_abort
2772(
2773 thread_t target_thread
2774) { return MIG_EOPNOTSUPP; }
2775#endif /* MIG_EOPNOTSUPP */
2776
2777/* Routine thread_get_special_port */
2778mig_internalstatic void _Xthread_get_special_port
2779 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2780{
2781 typedef struct {
2782 mach_msg_header_t Head;
2783 mach_msg_type_t which_portType;
2784 int which_port;
2785 } Request;
2786
2787 typedef struct {
2788 mach_msg_header_t Head;
2789 mach_msg_type_t RetCodeType;
2790 kern_return_t RetCode;
2791 mach_msg_type_t special_portType;
2792 ipc_port_t special_port;
2793 } Reply;
2794
2795 Request *In0P = (Request *) InHeadP;
2796 Reply *OutP = (Reply *) OutHeadP;
2797 mig_external kern_return_t thread_get_special_port
2798 (thread_t thread, int which_port, ipc_port_t *special_port);
2799
2800 const mach_msg_type_t which_portCheck = {
2801 /* msgt_name = */ 2,
2802 /* msgt_size = */ 32,
2803 /* msgt_number = */ 1,
2804 /* msgt_inline = */ TRUE((boolean_t) 1),
2805 /* msgt_longform = */ FALSE((boolean_t) 0),
2806 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2807 /* msgt_unused = */ 0
2808 };
2809
2810 const mach_msg_type_t special_portType = {
2811 /* msgt_name = */ 17,
2812 /* msgt_size = */ 32,
2813 /* msgt_number = */ 1,
2814 /* msgt_inline = */ TRUE((boolean_t) 1),
2815 /* msgt_longform = */ FALSE((boolean_t) 0),
2816 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2817 /* msgt_unused = */ 0
2818 };
2819
2820 thread_t thread;
2821
2822#if TypeCheck1
2823 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2824 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2825 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2826#endif /* TypeCheck */
2827
2828#if TypeCheck1
2829 if (BAD_TYPECHECK(&In0P->which_portType, &which_portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->which_portType); _c.t = *
(&which_portCheck);_t.w != _c.w; })), 0)
)
2830 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2831#endif /* TypeCheck */
2832
2833 thread = convert_port_to_thread((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2834
2835 OutP->RetCode = thread_get_special_port(thread, In0P->which_port, &OutP->special_port);
2836 thread_deallocate(thread);
2837 if (OutP->RetCode != KERN_SUCCESS0)
2838 return;
2839
2840 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
2841 OutP->Head.msgh_size = 40;
2842
2843 OutP->special_portType = special_portType;
2844}
2845
2846/* Default implementation of thread_get_special_port */
2847#ifdef MIG_EOPNOTSUPP
2848kern_return_t __attribute__ ((weak))
2849thread_get_special_port
2850(
2851 thread_t thread,
2852 int which_port,
2853 ipc_port_t *special_port
2854) { return MIG_EOPNOTSUPP; }
2855#endif /* MIG_EOPNOTSUPP */
2856
2857/* Routine thread_set_special_port */
2858mig_internalstatic void _Xthread_set_special_port
2859 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2860{
2861 typedef struct {
2862 mach_msg_header_t Head;
2863 mach_msg_type_t which_portType;
2864 int which_port;
2865 mach_msg_type_t special_portType;
2866 ipc_port_t special_port;
2867 } Request;
2868
2869 typedef struct {
2870 mach_msg_header_t Head;
2871 mach_msg_type_t RetCodeType;
2872 kern_return_t RetCode;
2873 } Reply;
2874
2875 Request *In0P = (Request *) InHeadP;
2876 Reply *OutP = (Reply *) OutHeadP;
2877 mig_external kern_return_t thread_set_special_port
2878 (thread_t thread, int which_port, ipc_port_t special_port);
2879
2880 const mach_msg_type_t which_portCheck = {
2881 /* msgt_name = */ 2,
2882 /* msgt_size = */ 32,
2883 /* msgt_number = */ 1,
2884 /* msgt_inline = */ TRUE((boolean_t) 1),
2885 /* msgt_longform = */ FALSE((boolean_t) 0),
2886 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2887 /* msgt_unused = */ 0
2888 };
2889
2890 thread_t thread;
2891
2892#if TypeCheck1
2893 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
2894 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2895 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2896#endif /* TypeCheck */
2897
2898#if TypeCheck1
2899 if (BAD_TYPECHECK(&In0P->which_portType, &which_portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->which_portType); _c.t = *
(&which_portCheck);_t.w != _c.w; })), 0)
)
2900 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2901#endif /* TypeCheck */
2902
2903#if TypeCheck1
2904 if (mig_unlikely ((In0P->special_portType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
2905 (In0P->special_portType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
2906 (In0P->special_portType.msgt_name != 17) ||__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
2907 (In0P->special_portType.msgt_number != 1) ||__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
2908 (In0P->special_portType.msgt_size != 32))__builtin_expect (!! ((In0P->special_portType.msgt_inline !=
((boolean_t) 1)) || (In0P->special_portType.msgt_longform
!= ((boolean_t) 0)) || (In0P->special_portType.msgt_name !=
17) || (In0P->special_portType.msgt_number != 1) || (In0P
->special_portType.msgt_size != 32)), 0)
)
2909 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2910#endif /* TypeCheck */
2911
2912 thread = convert_port_to_thread((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2913
2914 OutP->RetCode = thread_set_special_port(thread, In0P->which_port, In0P->special_port);
2915 thread_deallocate(thread);
2916}
2917
2918/* Default implementation of thread_set_special_port */
2919#ifdef MIG_EOPNOTSUPP
2920kern_return_t __attribute__ ((weak))
2921thread_set_special_port
2922(
2923 thread_t thread,
2924 int which_port,
2925 ipc_port_t special_port
2926) { return MIG_EOPNOTSUPP; }
2927#endif /* MIG_EOPNOTSUPP */
2928
2929/* Routine task_set_emulation */
2930mig_internalstatic void _Xtask_set_emulation
2931 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
2932{
2933 typedef struct {
2934 mach_msg_header_t Head;
2935 mach_msg_type_t routine_entry_ptType;
2936 vm_address_t routine_entry_pt;
2937 mach_msg_type_t routine_numberType;
2938 int routine_number;
2939 } Request;
2940
2941 typedef struct {
2942 mach_msg_header_t Head;
2943 mach_msg_type_t RetCodeType;
2944 kern_return_t RetCode;
2945 } Reply;
2946
2947 Request *In0P = (Request *) InHeadP;
2948 Reply *OutP = (Reply *) OutHeadP;
2949 mig_external kern_return_t task_set_emulation
2950 (task_t target_port, vm_address_t routine_entry_pt, int routine_number);
2951
2952 const mach_msg_type_t routine_entry_ptCheck = {
2953 /* msgt_name = */ 2,
2954 /* msgt_size = */ 32,
2955 /* msgt_number = */ 1,
2956 /* msgt_inline = */ TRUE((boolean_t) 1),
2957 /* msgt_longform = */ FALSE((boolean_t) 0),
2958 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2959 /* msgt_unused = */ 0
2960 };
2961
2962 const mach_msg_type_t routine_numberCheck = {
2963 /* msgt_name = */ 2,
2964 /* msgt_size = */ 32,
2965 /* msgt_number = */ 1,
2966 /* msgt_inline = */ TRUE((boolean_t) 1),
2967 /* msgt_longform = */ FALSE((boolean_t) 0),
2968 /* msgt_deallocate = */ FALSE((boolean_t) 0),
2969 /* msgt_unused = */ 0
2970 };
2971
2972 task_t target_port;
2973
2974#if TypeCheck1
2975 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
2976 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
2977 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2978#endif /* TypeCheck */
2979
2980#if TypeCheck1
2981 if (BAD_TYPECHECK(&In0P->routine_entry_ptType, &routine_entry_ptCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->routine_entry_ptType); _c
.t = *(&routine_entry_ptCheck);_t.w != _c.w; })), 0)
)
2982 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2983#endif /* TypeCheck */
2984
2985#if TypeCheck1
2986 if (BAD_TYPECHECK(&In0P->routine_numberType, &routine_numberCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->routine_numberType); _c.
t = *(&routine_numberCheck);_t.w != _c.w; })), 0)
)
2987 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
2988#endif /* TypeCheck */
2989
2990 target_port = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
2991
2992 OutP->RetCode = task_set_emulation(target_port, In0P->routine_entry_pt, In0P->routine_number);
2993 task_deallocate(target_port);
2994}
2995
2996/* Default implementation of task_set_emulation */
2997#ifdef MIG_EOPNOTSUPP
2998kern_return_t __attribute__ ((weak))
2999task_set_emulation
3000(
3001 task_t target_port,
3002 vm_address_t routine_entry_pt,
3003 int routine_number
3004) { return MIG_EOPNOTSUPP; }
3005#endif /* MIG_EOPNOTSUPP */
3006
3007/* Routine task_ras_control */
3008mig_internalstatic void _Xtask_ras_control
3009 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3010{
3011 typedef struct {
3012 mach_msg_header_t Head;
3013 mach_msg_type_t basepcType;
3014 vm_address_t basepc;
3015 mach_msg_type_t boundspcType;
3016 vm_address_t boundspc;
3017 mach_msg_type_t flavorType;
3018 int flavor;
3019 } Request;
3020
3021 typedef struct {
3022 mach_msg_header_t Head;
3023 mach_msg_type_t RetCodeType;
3024 kern_return_t RetCode;
3025 } Reply;
3026
3027 Request *In0P = (Request *) InHeadP;
3028 Reply *OutP = (Reply *) OutHeadP;
3029 mig_external kern_return_t task_ras_control
3030 (task_t target_task, vm_address_t basepc, vm_address_t boundspc, int flavor);
3031
3032 const mach_msg_type_t basepcCheck = {
3033 /* msgt_name = */ 2,
3034 /* msgt_size = */ 32,
3035 /* msgt_number = */ 1,
3036 /* msgt_inline = */ TRUE((boolean_t) 1),
3037 /* msgt_longform = */ FALSE((boolean_t) 0),
3038 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3039 /* msgt_unused = */ 0
3040 };
3041
3042 const mach_msg_type_t boundspcCheck = {
3043 /* msgt_name = */ 2,
3044 /* msgt_size = */ 32,
3045 /* msgt_number = */ 1,
3046 /* msgt_inline = */ TRUE((boolean_t) 1),
3047 /* msgt_longform = */ FALSE((boolean_t) 0),
3048 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3049 /* msgt_unused = */ 0
3050 };
3051
3052 const mach_msg_type_t flavorCheck = {
3053 /* msgt_name = */ 2,
3054 /* msgt_size = */ 32,
3055 /* msgt_number = */ 1,
3056 /* msgt_inline = */ TRUE((boolean_t) 1),
3057 /* msgt_longform = */ FALSE((boolean_t) 0),
3058 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3059 /* msgt_unused = */ 0
3060 };
3061
3062 task_t target_task;
3063
3064#if TypeCheck1
3065 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
3066 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3067 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3068#endif /* TypeCheck */
3069
3070#if TypeCheck1
3071 if (BAD_TYPECHECK(&In0P->basepcType, &basepcCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->basepcType); _c.t = *(&
basepcCheck);_t.w != _c.w; })), 0)
)
3072 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3073#endif /* TypeCheck */
3074
3075#if TypeCheck1
3076 if (BAD_TYPECHECK(&In0P->boundspcType, &boundspcCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->boundspcType); _c.t = *(
&boundspcCheck);_t.w != _c.w; })), 0)
)
3077 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3078#endif /* TypeCheck */
3079
3080#if TypeCheck1
3081 if (BAD_TYPECHECK(&In0P->flavorType, &flavorCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->flavorType); _c.t = *(&
flavorCheck);_t.w != _c.w; })), 0)
)
3082 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3083#endif /* TypeCheck */
3084
3085 target_task = convert_port_to_task((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
3086
3087 OutP->RetCode = task_ras_control(target_task, In0P->basepc, In0P->boundspc, In0P->flavor);
3088 task_deallocate(target_task);
3089}
3090
3091/* Default implementation of task_ras_control */
3092#ifdef MIG_EOPNOTSUPP
3093kern_return_t __attribute__ ((weak))
3094task_ras_control
3095(
3096 task_t target_task,
3097 vm_address_t basepc,
3098 vm_address_t boundspc,
3099 int flavor
3100) { return MIG_EOPNOTSUPP; }
3101#endif /* MIG_EOPNOTSUPP */
3102
3103/* Routine vm_map */
3104mig_internalstatic void _Xvm_map
3105 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3106{
3107 typedef struct {
3108 mach_msg_header_t Head;
3109 mach_msg_type_t addressType;
3110 vm_address_t address;
3111 mach_msg_type_t sizeType;
3112 vm_size_t size;
3113 mach_msg_type_t maskType;
3114 vm_address_t mask;
3115 mach_msg_type_t anywhereType;
3116 boolean_t anywhere;
3117 mach_msg_type_t memory_objectType;
3118 ipc_port_t memory_object;
3119 mach_msg_type_t offsetType;
3120 vm_offset_t offset;
3121 mach_msg_type_t copyType;
3122 boolean_t copy;
3123 mach_msg_type_t cur_protectionType;
3124 vm_prot_t cur_protection;
3125 mach_msg_type_t max_protectionType;
3126 vm_prot_t max_protection;
3127 mach_msg_type_t inheritanceType;
3128 vm_inherit_t inheritance;
3129 } Request;
3130
3131 typedef struct {
3132 mach_msg_header_t Head;
3133 mach_msg_type_t RetCodeType;
3134 kern_return_t RetCode;
3135 mach_msg_type_t addressType;
3136 vm_address_t address;
3137 } Reply;
3138
3139 Request *In0P = (Request *) InHeadP;
3140 Reply *OutP = (Reply *) OutHeadP;
3141 mig_external kern_return_t vm_map
3142 (vm_map_t target_task, vm_address_t *address, vm_size_t size, vm_address_t mask, boolean_t anywhere, ipc_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);
3143
3144 const mach_msg_type_t addressCheck = {
3145 /* msgt_name = */ 2,
3146 /* msgt_size = */ 32,
3147 /* msgt_number = */ 1,
3148 /* msgt_inline = */ TRUE((boolean_t) 1),
3149 /* msgt_longform = */ FALSE((boolean_t) 0),
3150 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3151 /* msgt_unused = */ 0
3152 };
3153
3154 const mach_msg_type_t sizeCheck = {
3155 /* msgt_name = */ 2,
3156 /* msgt_size = */ 32,
3157 /* msgt_number = */ 1,
3158 /* msgt_inline = */ TRUE((boolean_t) 1),
3159 /* msgt_longform = */ FALSE((boolean_t) 0),
3160 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3161 /* msgt_unused = */ 0
3162 };
3163
3164 const mach_msg_type_t maskCheck = {
3165 /* msgt_name = */ 2,
3166 /* msgt_size = */ 32,
3167 /* msgt_number = */ 1,
3168 /* msgt_inline = */ TRUE((boolean_t) 1),
3169 /* msgt_longform = */ FALSE((boolean_t) 0),
3170 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3171 /* msgt_unused = */ 0
3172 };
3173
3174 const mach_msg_type_t anywhereCheck = {
3175 /* msgt_name = */ 0,
3176 /* msgt_size = */ 32,
3177 /* msgt_number = */ 1,
3178 /* msgt_inline = */ TRUE((boolean_t) 1),
3179 /* msgt_longform = */ FALSE((boolean_t) 0),
3180 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3181 /* msgt_unused = */ 0
3182 };
3183
3184 const mach_msg_type_t offsetCheck = {
3185 /* msgt_name = */ 2,
3186 /* msgt_size = */ 32,
3187 /* msgt_number = */ 1,
3188 /* msgt_inline = */ TRUE((boolean_t) 1),
3189 /* msgt_longform = */ FALSE((boolean_t) 0),
3190 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3191 /* msgt_unused = */ 0
3192 };
3193
3194 const mach_msg_type_t copyCheck = {
3195 /* msgt_name = */ 0,
3196 /* msgt_size = */ 32,
3197 /* msgt_number = */ 1,
3198 /* msgt_inline = */ TRUE((boolean_t) 1),
3199 /* msgt_longform = */ FALSE((boolean_t) 0),
3200 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3201 /* msgt_unused = */ 0
3202 };
3203
3204 const mach_msg_type_t cur_protectionCheck = {
3205 /* msgt_name = */ 2,
3206 /* msgt_size = */ 32,
3207 /* msgt_number = */ 1,
3208 /* msgt_inline = */ TRUE((boolean_t) 1),
3209 /* msgt_longform = */ FALSE((boolean_t) 0),
3210 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3211 /* msgt_unused = */ 0
3212 };
3213
3214 const mach_msg_type_t max_protectionCheck = {
3215 /* msgt_name = */ 2,
3216 /* msgt_size = */ 32,
3217 /* msgt_number = */ 1,
3218 /* msgt_inline = */ TRUE((boolean_t) 1),
3219 /* msgt_longform = */ FALSE((boolean_t) 0),
3220 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3221 /* msgt_unused = */ 0
3222 };
3223
3224 const mach_msg_type_t inheritanceCheck = {
3225 /* msgt_name = */ 2,
3226 /* msgt_size = */ 32,
3227 /* msgt_number = */ 1,
3228 /* msgt_inline = */ TRUE((boolean_t) 1),
3229 /* msgt_longform = */ FALSE((boolean_t) 0),
3230 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3231 /* msgt_unused = */ 0
3232 };
3233
3234 const mach_msg_type_t addressType = {
3235 /* msgt_name = */ 2,
3236 /* msgt_size = */ 32,
3237 /* msgt_number = */ 1,
3238 /* msgt_inline = */ TRUE((boolean_t) 1),
3239 /* msgt_longform = */ FALSE((boolean_t) 0),
3240 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3241 /* msgt_unused = */ 0
3242 };
3243
3244 vm_map_t target_task;
3245
3246#if TypeCheck1
3247 if (mig_unlikely ((In0P->Head.msgh_size != 104) ||__builtin_expect (!! ((In0P->Head.msgh_size != 104) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
3248 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 104) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3249 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3250#endif /* TypeCheck */
3251
3252#if TypeCheck1
3253 if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addressType); _c.t = *(&
addressCheck);_t.w != _c.w; })), 0)
)
3254 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3255#endif /* TypeCheck */
3256
3257#if TypeCheck1
3258 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
3259 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3260#endif /* TypeCheck */
3261
3262#if TypeCheck1
3263 if (BAD_TYPECHECK(&In0P->maskType, &maskCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->maskType); _c.t = *(&
maskCheck);_t.w != _c.w; })), 0)
)
3264 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3265#endif /* TypeCheck */
3266
3267#if TypeCheck1
3268 if (BAD_TYPECHECK(&In0P->anywhereType, &anywhereCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->anywhereType); _c.t = *(
&anywhereCheck);_t.w != _c.w; })), 0)
)
3269 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3270#endif /* TypeCheck */
3271
3272#if TypeCheck1
3273 if (mig_unlikely ((In0P->memory_objectType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->memory_objectType.msgt_inline
!= ((boolean_t) 1)) || (In0P->memory_objectType.msgt_longform
!= ((boolean_t) 0)) || (In0P->memory_objectType.msgt_name
!= 17) || (In0P->memory_objectType.msgt_number != 1) || (
In0P->memory_objectType.msgt_size != 32)), 0)
3274 (In0P->memory_objectType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->memory_objectType.msgt_inline
!= ((boolean_t) 1)) || (In0P->memory_objectType.msgt_longform
!= ((boolean_t) 0)) || (In0P->memory_objectType.msgt_name
!= 17) || (In0P->memory_objectType.msgt_number != 1) || (
In0P->memory_objectType.msgt_size != 32)), 0)
3275 (In0P->memory_objectType.msgt_name != 17) ||__builtin_expect (!! ((In0P->memory_objectType.msgt_inline
!= ((boolean_t) 1)) || (In0P->memory_objectType.msgt_longform
!= ((boolean_t) 0)) || (In0P->memory_objectType.msgt_name
!= 17) || (In0P->memory_objectType.msgt_number != 1) || (
In0P->memory_objectType.msgt_size != 32)), 0)
3276 (In0P->memory_objectType.msgt_number != 1) ||__builtin_expect (!! ((In0P->memory_objectType.msgt_inline
!= ((boolean_t) 1)) || (In0P->memory_objectType.msgt_longform
!= ((boolean_t) 0)) || (In0P->memory_objectType.msgt_name
!= 17) || (In0P->memory_objectType.msgt_number != 1) || (
In0P->memory_objectType.msgt_size != 32)), 0)
3277 (In0P->memory_objectType.msgt_size != 32))__builtin_expect (!! ((In0P->memory_objectType.msgt_inline
!= ((boolean_t) 1)) || (In0P->memory_objectType.msgt_longform
!= ((boolean_t) 0)) || (In0P->memory_objectType.msgt_name
!= 17) || (In0P->memory_objectType.msgt_number != 1) || (
In0P->memory_objectType.msgt_size != 32)), 0)
)
3278 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3279#endif /* TypeCheck */
3280
3281#if TypeCheck1
3282 if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->offsetType); _c.t = *(&
offsetCheck);_t.w != _c.w; })), 0)
)
3283 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3284#endif /* TypeCheck */
3285
3286#if TypeCheck1
3287 if (BAD_TYPECHECK(&In0P->copyType, &copyCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->copyType); _c.t = *(&
copyCheck);_t.w != _c.w; })), 0)
)
3288 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3289#endif /* TypeCheck */
3290
3291#if TypeCheck1
3292 if (BAD_TYPECHECK(&In0P->cur_protectionType, &cur_protectionCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->cur_protectionType); _c.
t = *(&cur_protectionCheck);_t.w != _c.w; })), 0)
)
3293 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3294#endif /* TypeCheck */
3295
3296#if TypeCheck1
3297 if (BAD_TYPECHECK(&In0P->max_protectionType, &max_protectionCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->max_protectionType); _c.
t = *(&max_protectionCheck);_t.w != _c.w; })), 0)
)
3298 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3299#endif /* TypeCheck */
3300
3301#if TypeCheck1
3302 if (BAD_TYPECHECK(&In0P->inheritanceType, &inheritanceCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->inheritanceType); _c.t =
*(&inheritanceCheck);_t.w != _c.w; })), 0)
)
3303 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3304#endif /* TypeCheck */
3305
3306 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
3307
3308 OutP->RetCode = vm_map(target_task, &In0P->address, In0P->size, In0P->mask, In0P->anywhere, null_conversion(In0P->memory_object)(In0P->memory_object), In0P->offset, In0P->copy, In0P->cur_protection, In0P->max_protection, In0P->inheritance);
3309 vm_map_deallocate(target_task);
3310 if (OutP->RetCode != KERN_SUCCESS0)
3311 return;
3312
3313 if (IP_VALID(In0P->memory_object)(((&(In0P->memory_object)->ip_target.ipt_object) !=
((ipc_object_t) 0)) && ((&(In0P->memory_object
)->ip_target.ipt_object) != ((ipc_object_t) -1)))
)
3314 ipc_port_release_send(In0P->memory_object);
3315
3316 OutP->Head.msgh_size = 40;
3317
3318 OutP->addressType = addressType;
3319
3320 OutP->address = In0P->address;
3321}
3322
3323/* Default implementation of vm_map */
3324#ifdef MIG_EOPNOTSUPP
3325kern_return_t __attribute__ ((weak))
3326vm_map
3327(
3328 vm_map_t target_task,
3329 vm_address_t *address,
3330 vm_size_t size,
3331 vm_address_t mask,
3332 boolean_t anywhere,
3333 ipc_port_t memory_object,
3334 vm_offset_t offset,
3335 boolean_t copy,
3336 vm_prot_t cur_protection,
3337 vm_prot_t max_protection,
3338 vm_inherit_t inheritance
3339) { return MIG_EOPNOTSUPP; }
3340#endif /* MIG_EOPNOTSUPP */
3341
3342/* SimpleRoutine memory_object_data_error */
3343mig_internalstatic void _Xmemory_object_data_error
3344 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3345{
3346 typedef struct {
3347 mach_msg_header_t Head;
3348 mach_msg_type_t offsetType;
3349 vm_offset_t offset;
3350 mach_msg_type_t sizeType;
3351 vm_size_t size;
3352 mach_msg_type_t error_valueType;
3353 kern_return_t error_value;
3354 } Request;
3355
3356 typedef struct {
3357 mach_msg_header_t Head;
3358 mach_msg_type_t RetCodeType;
3359 kern_return_t RetCode;
3360 } Reply;
3361
3362 Request *In0P = (Request *) InHeadP;
3363 Reply *OutP = (Reply *) OutHeadP;
3364 mig_external kern_return_t memory_object_data_error
3365 (vm_object_t memory_control, vm_offset_t offset, vm_size_t size, kern_return_t error_value);
3366
3367 const mach_msg_type_t offsetCheck = {
3368 /* msgt_name = */ 2,
3369 /* msgt_size = */ 32,
3370 /* msgt_number = */ 1,
3371 /* msgt_inline = */ TRUE((boolean_t) 1),
3372 /* msgt_longform = */ FALSE((boolean_t) 0),
3373 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3374 /* msgt_unused = */ 0
3375 };
3376
3377 const mach_msg_type_t sizeCheck = {
3378 /* msgt_name = */ 2,
3379 /* msgt_size = */ 32,
3380 /* msgt_number = */ 1,
3381 /* msgt_inline = */ TRUE((boolean_t) 1),
3382 /* msgt_longform = */ FALSE((boolean_t) 0),
3383 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3384 /* msgt_unused = */ 0
3385 };
3386
3387 const mach_msg_type_t error_valueCheck = {
3388 /* msgt_name = */ 2,
3389 /* msgt_size = */ 32,
3390 /* msgt_number = */ 1,
3391 /* msgt_inline = */ TRUE((boolean_t) 1),
3392 /* msgt_longform = */ FALSE((boolean_t) 0),
3393 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3394 /* msgt_unused = */ 0
3395 };
3396
3397#if TypeCheck1
3398 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
3399 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3400 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3401#endif /* TypeCheck */
3402
3403#if TypeCheck1
3404 if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->offsetType); _c.t = *(&
offsetCheck);_t.w != _c.w; })), 0)
)
3405 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3406#endif /* TypeCheck */
3407
3408#if TypeCheck1
3409 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
3410 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3411#endif /* TypeCheck */
3412
3413#if TypeCheck1
3414 if (BAD_TYPECHECK(&In0P->error_valueType, &error_valueCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->error_valueType); _c.t =
*(&error_valueCheck);_t.w != _c.w; })), 0)
)
3415 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3416#endif /* TypeCheck */
3417
3418 OutP->RetCode = memory_object_data_error(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), In0P->offset, In0P->size, In0P->error_value);
3419}
3420
3421/* Default implementation of memory_object_data_error */
3422#ifdef MIG_EOPNOTSUPP
3423kern_return_t __attribute__ ((weak))
3424memory_object_data_error
3425(
3426 vm_object_t memory_control,
3427 vm_offset_t offset,
3428 vm_size_t size,
3429 kern_return_t error_value
3430) { return MIG_EOPNOTSUPP; }
3431#endif /* MIG_EOPNOTSUPP */
3432
3433/* SimpleRoutine memory_object_set_attributes */
3434mig_internalstatic void _Xmemory_object_set_attributes
3435 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3436{
3437 typedef struct {
3438 mach_msg_header_t Head;
3439 mach_msg_type_t object_readyType;
3440 boolean_t object_ready;
3441 mach_msg_type_t may_cacheType;
3442 boolean_t may_cache;
3443 mach_msg_type_t copy_strategyType;
3444 memory_object_copy_strategy_t copy_strategy;
3445 } Request;
3446
3447 typedef struct {
3448 mach_msg_header_t Head;
3449 mach_msg_type_t RetCodeType;
3450 kern_return_t RetCode;
3451 } Reply;
3452
3453 Request *In0P = (Request *) InHeadP;
3454 Reply *OutP = (Reply *) OutHeadP;
3455 mig_external kern_return_t memory_object_set_attributes
3456 (vm_object_t memory_control, boolean_t object_ready, boolean_t may_cache, memory_object_copy_strategy_t copy_strategy);
3457
3458 const mach_msg_type_t object_readyCheck = {
3459 /* msgt_name = */ 0,
3460 /* msgt_size = */ 32,
3461 /* msgt_number = */ 1,
3462 /* msgt_inline = */ TRUE((boolean_t) 1),
3463 /* msgt_longform = */ FALSE((boolean_t) 0),
3464 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3465 /* msgt_unused = */ 0
3466 };
3467
3468 const mach_msg_type_t may_cacheCheck = {
3469 /* msgt_name = */ 0,
3470 /* msgt_size = */ 32,
3471 /* msgt_number = */ 1,
3472 /* msgt_inline = */ TRUE((boolean_t) 1),
3473 /* msgt_longform = */ FALSE((boolean_t) 0),
3474 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3475 /* msgt_unused = */ 0
3476 };
3477
3478 const mach_msg_type_t copy_strategyCheck = {
3479 /* msgt_name = */ 2,
3480 /* msgt_size = */ 32,
3481 /* msgt_number = */ 1,
3482 /* msgt_inline = */ TRUE((boolean_t) 1),
3483 /* msgt_longform = */ FALSE((boolean_t) 0),
3484 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3485 /* msgt_unused = */ 0
3486 };
3487
3488#if TypeCheck1
3489 if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
3490 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3491 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3492#endif /* TypeCheck */
3493
3494#if TypeCheck1
3495 if (BAD_TYPECHECK(&In0P->object_readyType, &object_readyCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->object_readyType); _c.t =
*(&object_readyCheck);_t.w != _c.w; })), 0)
)
3496 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3497#endif /* TypeCheck */
3498
3499#if TypeCheck1
3500 if (BAD_TYPECHECK(&In0P->may_cacheType, &may_cacheCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->may_cacheType); _c.t = *
(&may_cacheCheck);_t.w != _c.w; })), 0)
)
3501 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3502#endif /* TypeCheck */
3503
3504#if TypeCheck1
3505 if (BAD_TYPECHECK(&In0P->copy_strategyType, &copy_strategyCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->copy_strategyType); _c.t
= *(&copy_strategyCheck);_t.w != _c.w; })), 0)
)
3506 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3507#endif /* TypeCheck */
3508
3509 OutP->RetCode = memory_object_set_attributes(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), In0P->object_ready, In0P->may_cache, In0P->copy_strategy);
3510}
3511
3512/* Default implementation of memory_object_set_attributes */
3513#ifdef MIG_EOPNOTSUPP
3514kern_return_t __attribute__ ((weak))
3515memory_object_set_attributes
3516(
3517 vm_object_t memory_control,
3518 boolean_t object_ready,
3519 boolean_t may_cache,
3520 memory_object_copy_strategy_t copy_strategy
3521) { return MIG_EOPNOTSUPP; }
3522#endif /* MIG_EOPNOTSUPP */
3523
3524/* SimpleRoutine memory_object_destroy */
3525mig_internalstatic void _Xmemory_object_destroy
3526 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3527{
3528 typedef struct {
3529 mach_msg_header_t Head;
3530 mach_msg_type_t reasonType;
3531 kern_return_t reason;
3532 } Request;
3533
3534 typedef struct {
3535 mach_msg_header_t Head;
3536 mach_msg_type_t RetCodeType;
3537 kern_return_t RetCode;
3538 } Reply;
3539
3540 Request *In0P = (Request *) InHeadP;
3541 Reply *OutP = (Reply *) OutHeadP;
3542 mig_external kern_return_t memory_object_destroy
3543 (vm_object_t memory_control, kern_return_t reason);
3544
3545 const mach_msg_type_t reasonCheck = {
3546 /* msgt_name = */ 2,
3547 /* msgt_size = */ 32,
3548 /* msgt_number = */ 1,
3549 /* msgt_inline = */ TRUE((boolean_t) 1),
3550 /* msgt_longform = */ FALSE((boolean_t) 0),
3551 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3552 /* msgt_unused = */ 0
3553 };
3554
3555#if TypeCheck1
3556 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
3557 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3558 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3559#endif /* TypeCheck */
3560
3561#if TypeCheck1
3562 if (BAD_TYPECHECK(&In0P->reasonType, &reasonCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->reasonType); _c.t = *(&
reasonCheck);_t.w != _c.w; })), 0)
)
3563 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3564#endif /* TypeCheck */
3565
3566 OutP->RetCode = memory_object_destroy(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), In0P->reason);
3567}
3568
3569/* Default implementation of memory_object_destroy */
3570#ifdef MIG_EOPNOTSUPP
3571kern_return_t __attribute__ ((weak))
3572memory_object_destroy
3573(
3574 vm_object_t memory_control,
3575 kern_return_t reason
3576) { return MIG_EOPNOTSUPP; }
3577#endif /* MIG_EOPNOTSUPP */
3578
3579/* SimpleRoutine memory_object_data_supply */
3580mig_internalstatic void _Xmemory_object_data_supply
3581 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3582{
3583 typedef struct {
3584 mach_msg_header_t Head;
3585 mach_msg_type_t offsetType;
3586 vm_offset_t offset;
3587 mach_msg_type_long_t dataType;
3588 vm_offset_t data;
3589 mach_msg_type_t lock_valueType;
3590 vm_prot_t lock_value;
3591 mach_msg_type_t preciousType;
3592 boolean_t precious;
3593 mach_msg_type_t reply_toType;
3594 ipc_port_t reply_to;
3595 } Request;
3596
3597 typedef struct {
3598 mach_msg_header_t Head;
3599 mach_msg_type_t RetCodeType;
3600 kern_return_t RetCode;
3601 } Reply;
3602
3603 Request *In0P = (Request *) InHeadP;
3604 Reply *OutP = (Reply *) OutHeadP;
3605 mig_external kern_return_t memory_object_data_supply
3606 (vm_object_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, ipc_port_t reply_to, mach_msg_type_name_t reply_toPoly);
3607
3608 const mach_msg_type_t offsetCheck = {
3609 /* msgt_name = */ 2,
3610 /* msgt_size = */ 32,
3611 /* msgt_number = */ 1,
3612 /* msgt_inline = */ TRUE((boolean_t) 1),
3613 /* msgt_longform = */ FALSE((boolean_t) 0),
3614 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3615 /* msgt_unused = */ 0
3616 };
3617
3618 const mach_msg_type_t lock_valueCheck = {
3619 /* msgt_name = */ 2,
3620 /* msgt_size = */ 32,
3621 /* msgt_number = */ 1,
3622 /* msgt_inline = */ TRUE((boolean_t) 1),
3623 /* msgt_longform = */ FALSE((boolean_t) 0),
3624 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3625 /* msgt_unused = */ 0
3626 };
3627
3628 const mach_msg_type_t preciousCheck = {
3629 /* msgt_name = */ 0,
3630 /* msgt_size = */ 32,
3631 /* msgt_number = */ 1,
3632 /* msgt_inline = */ TRUE((boolean_t) 1),
3633 /* msgt_longform = */ FALSE((boolean_t) 0),
3634 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3635 /* msgt_unused = */ 0
3636 };
3637
3638#if TypeCheck1
3639 if (mig_unlikely ((In0P->Head.msgh_size != 72) ||__builtin_expect (!! ((In0P->Head.msgh_size != 72) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
3640 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 72) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3641 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3642#endif /* TypeCheck */
3643
3644#if TypeCheck1
3645 if (BAD_TYPECHECK(&In0P->offsetType, &offsetCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->offsetType); _c.t = *(&
offsetCheck);_t.w != _c.w; })), 0)
)
3646 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3647#endif /* TypeCheck */
3648
3649#if TypeCheck1
3650 if (mig_unlikely ((In0P->dataType.msgtl_header.msgt_inline != FALSE) ||__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
3651 (In0P->dataType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
3652 (In0P->dataType.msgtl_name != 9) ||__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
3653 (In0P->dataType.msgtl_size != 8))__builtin_expect (!! ((In0P->dataType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->dataType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->dataType.msgtl_name != 9) ||
(In0P->dataType.msgtl_size != 8)), 0)
)
3654 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3655#endif /* TypeCheck */
3656
3657#if TypeCheck1
3658 if (BAD_TYPECHECK(&In0P->lock_valueType, &lock_valueCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->lock_valueType); _c.t = *
(&lock_valueCheck);_t.w != _c.w; })), 0)
)
3659 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3660#endif /* TypeCheck */
3661
3662#if TypeCheck1
3663 if (BAD_TYPECHECK(&In0P->preciousType, &preciousCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->preciousType); _c.t = *(
&preciousCheck);_t.w != _c.w; })), 0)
)
3664 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3665#endif /* TypeCheck */
3666
3667#if TypeCheck1
3668 if (mig_unlikely ((In0P->reply_toType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || (In0P->reply_toType.msgt_number != 1) ||
(In0P->reply_toType.msgt_size != 32)), 0)
3669 (In0P->reply_toType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || (In0P->reply_toType.msgt_number != 1) ||
(In0P->reply_toType.msgt_size != 32)), 0)
3670 (In0P->reply_toType.msgt_number != 1) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || (In0P->reply_toType.msgt_number != 1) ||
(In0P->reply_toType.msgt_size != 32)), 0)
3671 (In0P->reply_toType.msgt_size != 32))__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || (In0P->reply_toType.msgt_number != 1) ||
(In0P->reply_toType.msgt_size != 32)), 0)
)
3672 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3673#endif /* TypeCheck */
3674
3675 OutP->RetCode = memory_object_data_supply(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), In0P->offset, In0P->data, In0P->dataType.msgtl_number, In0P->lock_value, In0P->precious, In0P->reply_to, In0P->reply_toType.msgt_name);
3676}
3677
3678/* Default implementation of memory_object_data_supply */
3679#ifdef MIG_EOPNOTSUPP
3680kern_return_t __attribute__ ((weak))
3681memory_object_data_supply
3682(
3683 vm_object_t memory_control,
3684 vm_offset_t offset,
3685 vm_offset_t data,
3686 mach_msg_type_number_t dataCnt,
3687 vm_prot_t lock_value,
3688 boolean_t precious,
3689 ipc_port_t reply_to,
3690 mach_msg_type_name_t reply_toPoly
3691) { return MIG_EOPNOTSUPP; }
3692#endif /* MIG_EOPNOTSUPP */
3693
3694/* SimpleRoutine memory_object_ready */
3695mig_internalstatic void _Xmemory_object_ready
3696 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3697{
3698 typedef struct {
3699 mach_msg_header_t Head;
3700 mach_msg_type_t may_cacheType;
3701 boolean_t may_cache;
3702 mach_msg_type_t copy_strategyType;
3703 memory_object_copy_strategy_t copy_strategy;
3704 } Request;
3705
3706 typedef struct {
3707 mach_msg_header_t Head;
3708 mach_msg_type_t RetCodeType;
3709 kern_return_t RetCode;
3710 } Reply;
3711
3712 Request *In0P = (Request *) InHeadP;
3713 Reply *OutP = (Reply *) OutHeadP;
3714 mig_external kern_return_t memory_object_ready
3715 (vm_object_t memory_control, boolean_t may_cache, memory_object_copy_strategy_t copy_strategy);
3716
3717 const mach_msg_type_t may_cacheCheck = {
3718 /* msgt_name = */ 0,
3719 /* msgt_size = */ 32,
3720 /* msgt_number = */ 1,
3721 /* msgt_inline = */ TRUE((boolean_t) 1),
3722 /* msgt_longform = */ FALSE((boolean_t) 0),
3723 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3724 /* msgt_unused = */ 0
3725 };
3726
3727 const mach_msg_type_t copy_strategyCheck = {
3728 /* msgt_name = */ 2,
3729 /* msgt_size = */ 32,
3730 /* msgt_number = */ 1,
3731 /* msgt_inline = */ TRUE((boolean_t) 1),
3732 /* msgt_longform = */ FALSE((boolean_t) 0),
3733 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3734 /* msgt_unused = */ 0
3735 };
3736
3737#if TypeCheck1
3738 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
3739 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3740 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3741#endif /* TypeCheck */
3742
3743#if TypeCheck1
3744 if (BAD_TYPECHECK(&In0P->may_cacheType, &may_cacheCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->may_cacheType); _c.t = *
(&may_cacheCheck);_t.w != _c.w; })), 0)
)
3745 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3746#endif /* TypeCheck */
3747
3748#if TypeCheck1
3749 if (BAD_TYPECHECK(&In0P->copy_strategyType, &copy_strategyCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->copy_strategyType); _c.t
= *(&copy_strategyCheck);_t.w != _c.w; })), 0)
)
3750 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3751#endif /* TypeCheck */
3752
3753 OutP->RetCode = memory_object_ready(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), In0P->may_cache, In0P->copy_strategy);
3754}
3755
3756/* Default implementation of memory_object_ready */
3757#ifdef MIG_EOPNOTSUPP
3758kern_return_t __attribute__ ((weak))
3759memory_object_ready
3760(
3761 vm_object_t memory_control,
3762 boolean_t may_cache,
3763 memory_object_copy_strategy_t copy_strategy
3764) { return MIG_EOPNOTSUPP; }
3765#endif /* MIG_EOPNOTSUPP */
3766
3767/* SimpleRoutine memory_object_change_attributes */
3768mig_internalstatic void _Xmemory_object_change_attributes
3769 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3770{
3771 typedef struct {
3772 mach_msg_header_t Head;
3773 mach_msg_type_t may_cacheType;
3774 boolean_t may_cache;
3775 mach_msg_type_t copy_strategyType;
3776 memory_object_copy_strategy_t copy_strategy;
3777 mach_msg_type_t reply_toType;
3778 ipc_port_t reply_to;
3779 } Request;
3780
3781 typedef struct {
3782 mach_msg_header_t Head;
3783 mach_msg_type_t RetCodeType;
3784 kern_return_t RetCode;
3785 } Reply;
3786
3787 Request *In0P = (Request *) InHeadP;
3788 Reply *OutP = (Reply *) OutHeadP;
3789 mig_external kern_return_t memory_object_change_attributes
3790 (vm_object_t memory_control, boolean_t may_cache, memory_object_copy_strategy_t copy_strategy, ipc_port_t reply_to, mach_msg_type_name_t reply_toPoly);
3791
3792#if TypeCheck1
3793 boolean_t msgh_simple = msgh_simple;
Assigned value is garbage or undefined
3794#endif /* TypeCheck */
3795
3796 const mach_msg_type_t may_cacheCheck = {
3797 /* msgt_name = */ 0,
3798 /* msgt_size = */ 32,
3799 /* msgt_number = */ 1,
3800 /* msgt_inline = */ TRUE((boolean_t) 1),
3801 /* msgt_longform = */ FALSE((boolean_t) 0),
3802 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3803 /* msgt_unused = */ 0
3804 };
3805
3806 const mach_msg_type_t copy_strategyCheck = {
3807 /* msgt_name = */ 2,
3808 /* msgt_size = */ 32,
3809 /* msgt_number = */ 1,
3810 /* msgt_inline = */ TRUE((boolean_t) 1),
3811 /* msgt_longform = */ FALSE((boolean_t) 0),
3812 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3813 /* msgt_unused = */ 0
3814 };
3815
3816#if TypeCheck1
3817 msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U);
3818 if (mig_unlikely ((In0P->Head.msgh_size != 48))__builtin_expect (!! ((In0P->Head.msgh_size != 48)), 0))
3819 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3820#endif /* TypeCheck */
3821
3822#if TypeCheck1
3823 if (BAD_TYPECHECK(&In0P->may_cacheType, &may_cacheCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->may_cacheType); _c.t = *
(&may_cacheCheck);_t.w != _c.w; })), 0)
)
3824 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3825#endif /* TypeCheck */
3826
3827#if TypeCheck1
3828 if (BAD_TYPECHECK(&In0P->copy_strategyType, &copy_strategyCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->copy_strategyType); _c.t
= *(&copy_strategyCheck);_t.w != _c.w; })), 0)
)
3829 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3830#endif /* TypeCheck */
3831
3832#if TypeCheck1
3833 if (mig_unlikely ((In0P->reply_toType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
3834 (In0P->reply_toType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
3835 (MACH_MSG_TYPE_PORT_ANY(In0P->reply_toType.msgt_name) && msgh_simple) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
3836 (In0P->reply_toType.msgt_number != 1) ||__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
3837 (In0P->reply_toType.msgt_size != 32))__builtin_expect (!! ((In0P->reply_toType.msgt_inline != (
(boolean_t) 1)) || (In0P->reply_toType.msgt_longform != ((
boolean_t) 0)) || ((((In0P->reply_toType.msgt_name) >= 16
) && ((In0P->reply_toType.msgt_name) <= 21)) &&
msgh_simple) || (In0P->reply_toType.msgt_number != 1) || (
In0P->reply_toType.msgt_size != 32)), 0)
)
3838 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3839#endif /* TypeCheck */
3840
3841 OutP->RetCode = memory_object_change_attributes(vm_object_lookup((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), In0P->may_cache, In0P->copy_strategy, In0P->reply_to, In0P->reply_toType.msgt_name);
3842}
3843
3844/* Default implementation of memory_object_change_attributes */
3845#ifdef MIG_EOPNOTSUPP
3846kern_return_t __attribute__ ((weak))
3847memory_object_change_attributes
3848(
3849 vm_object_t memory_control,
3850 boolean_t may_cache,
3851 memory_object_copy_strategy_t copy_strategy,
3852 ipc_port_t reply_to,
3853 mach_msg_type_name_t reply_toPoly
3854) { return MIG_EOPNOTSUPP; }
3855#endif /* MIG_EOPNOTSUPP */
3856
3857/* Routine vm_machine_attribute */
3858mig_internalstatic void _Xvm_machine_attribute
3859 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
3860{
3861 typedef struct {
3862 mach_msg_header_t Head;
3863 mach_msg_type_t addressType;
3864 vm_address_t address;
3865 mach_msg_type_t sizeType;
3866 vm_size_t size;
3867 mach_msg_type_t attributeType;
3868 vm_machine_attribute_t attribute;
3869 mach_msg_type_t valueType;
3870 vm_machine_attribute_val_t value;
3871 } Request;
3872
3873 typedef struct {
3874 mach_msg_header_t Head;
3875 mach_msg_type_t RetCodeType;
3876 kern_return_t RetCode;
3877 mach_msg_type_t valueType;
3878 vm_machine_attribute_val_t value;
3879 } Reply;
3880
3881 Request *In0P = (Request *) InHeadP;
3882 Reply *OutP = (Reply *) OutHeadP;
3883 mig_external kern_return_t vm_machine_attribute
3884 (vm_map_t target_task, vm_address_t address, vm_size_t size, vm_machine_attribute_t attribute, vm_machine_attribute_val_t *value);
3885
3886 const mach_msg_type_t addressCheck = {
3887 /* msgt_name = */ 2,
3888 /* msgt_size = */ 32,
3889 /* msgt_number = */ 1,
3890 /* msgt_inline = */ TRUE((boolean_t) 1),
3891 /* msgt_longform = */ FALSE((boolean_t) 0),
3892 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3893 /* msgt_unused = */ 0
3894 };
3895
3896 const mach_msg_type_t sizeCheck = {
3897 /* msgt_name = */ 2,
3898 /* msgt_size = */ 32,
3899 /* msgt_number = */ 1,
3900 /* msgt_inline = */ TRUE((boolean_t) 1),
3901 /* msgt_longform = */ FALSE((boolean_t) 0),
3902 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3903 /* msgt_unused = */ 0
3904 };
3905
3906 const mach_msg_type_t attributeCheck = {
3907 /* msgt_name = */ 2,
3908 /* msgt_size = */ 32,
3909 /* msgt_number = */ 1,
3910 /* msgt_inline = */ TRUE((boolean_t) 1),
3911 /* msgt_longform = */ FALSE((boolean_t) 0),
3912 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3913 /* msgt_unused = */ 0
3914 };
3915
3916 const mach_msg_type_t valueCheck = {
3917 /* msgt_name = */ 2,
3918 /* msgt_size = */ 32,
3919 /* msgt_number = */ 1,
3920 /* msgt_inline = */ TRUE((boolean_t) 1),
3921 /* msgt_longform = */ FALSE((boolean_t) 0),
3922 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3923 /* msgt_unused = */ 0
3924 };
3925
3926 const mach_msg_type_t valueType = {
3927 /* msgt_name = */ 2,
3928 /* msgt_size = */ 32,
3929 /* msgt_number = */ 1,
3930 /* msgt_inline = */ TRUE((boolean_t) 1),
3931 /* msgt_longform = */ FALSE((boolean_t) 0),
3932 /* msgt_deallocate = */ FALSE((boolean_t) 0),
3933 /* msgt_unused = */ 0
3934 };
3935
3936 vm_map_t target_task;
3937
3938#if TypeCheck1
3939 if (mig_unlikely ((In0P->Head.msgh_size != 56) ||__builtin_expect (!! ((In0P->Head.msgh_size != 56) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
3940 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 56) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
3941 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3942#endif /* TypeCheck */
3943
3944#if TypeCheck1
3945 if (BAD_TYPECHECK(&In0P->addressType, &addressCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addressType); _c.t = *(&
addressCheck);_t.w != _c.w; })), 0)
)
3946 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3947#endif /* TypeCheck */
3948
3949#if TypeCheck1
3950 if (BAD_TYPECHECK(&In0P->sizeType, &sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->sizeType); _c.t = *(&
sizeCheck);_t.w != _c.w; })), 0)
)
3951 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3952#endif /* TypeCheck */
3953
3954#if TypeCheck1
3955 if (BAD_TYPECHECK(&In0P->attributeType, &attributeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->attributeType); _c.t = *
(&attributeCheck);_t.w != _c.w; })), 0)
)
3956 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3957#endif /* TypeCheck */
3958
3959#if TypeCheck1
3960 if (BAD_TYPECHECK(&In0P->valueType, &valueCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->valueType); _c.t = *(&
valueCheck);_t.w != _c.w; })), 0)
)
3961 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
3962#endif /* TypeCheck */
3963
3964 target_task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
3965
3966 OutP->RetCode = vm_machine_attribute(target_task, In0P->address, In0P->size, In0P->attribute, &In0P->value);
3967 vm_map_deallocate(target_task);
3968 if (OutP->RetCode != KERN_SUCCESS0)
3969 return;
3970
3971 OutP->Head.msgh_size = 40;
3972
3973 OutP->valueType = valueType;
3974
3975 OutP->value = In0P->value;
3976}
3977
3978/* Default implementation of vm_machine_attribute */
3979#ifdef MIG_EOPNOTSUPP
3980kern_return_t __attribute__ ((weak))
3981vm_machine_attribute
3982(
3983 vm_map_t target_task,
3984 vm_address_t address,
3985 vm_size_t size,
3986 vm_machine_attribute_t attribute,
3987 vm_machine_attribute_val_t *value
3988) { return MIG_EOPNOTSUPP; }
3989#endif /* MIG_EOPNOTSUPP */
3990
3991mig_routine_t mach_server_routines[] = {
3992 0,
3993 0,
3994 0,
3995 0,
3996 0,
3997 0,
3998 0,
3999 _Xtask_create,
4000 _Xtask_terminate,
4001 _Xtask_get_emulation_vector,
4002 _Xtask_set_emulation_vector,
4003 _Xtask_threads,
4004 _Xtask_info,
4005 0,
4006 0,
4007 0,
4008 _Xthread_terminate,
4009 _Xthread_get_state,
4010 _Xthread_set_state,
4011 _Xthread_info,
4012 0,
4013 _Xvm_allocate,
4014 0,
4015 _Xvm_deallocate,
4016 _Xvm_protect,
4017 _Xvm_inherit,
4018 _Xvm_read,
4019 _Xvm_write,
4020 _Xvm_copy,
4021 _Xvm_region,
4022 _Xvm_statistics,
4023 0,
4024 0,
4025 _Xmach_ports_register,
4026 _Xmach_ports_lookup,
4027 0,
4028 0,
4029 0,
4030 _Xmemory_object_data_provided,
4031 _Xmemory_object_data_unavailable,
4032 _Xmemory_object_get_attributes,
4033 _Xvm_set_default_memory_manager,
4034 0,
4035 0,
4036 _Xmemory_object_lock_request,
4037 0,
4038 0,
4039 0,
4040 0,
4041 0,
4042 0,
4043 0,
4044 0,
4045 0,
4046 0,
4047 0,
4048 _Xtask_suspend,
4049 _Xtask_resume,
4050 _Xtask_get_special_port,
4051 _Xtask_set_special_port,
4052 0,
4053 _Xthread_create,
4054 _Xthread_suspend,
4055 _Xthread_resume,
4056 _Xthread_abort,
4057 0,
4058 0,
4059 _Xthread_get_special_port,
4060 _Xthread_set_special_port,
4061 0,
4062 _Xtask_set_emulation,
4063 _Xtask_ras_control,
4064 0,
4065 0,
4066 0,
4067 0,
4068 0,
4069 0,
4070 0,
4071 0,
4072 0,
4073 0,
4074 0,
4075 0,
4076 0,
4077 0,
4078 0,
4079 0,
4080 0,
4081 _Xvm_map,
4082 _Xmemory_object_data_error,
4083 _Xmemory_object_set_attributes,
4084 _Xmemory_object_destroy,
4085 _Xmemory_object_data_supply,
4086 _Xmemory_object_ready,
4087 _Xmemory_object_change_attributes,
4088 0,
4089 0,
4090 0,
4091 _Xvm_machine_attribute,
4092 0,
4093};
4094
4095mig_external boolean_t mach_server
4096 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
4097{
4098 mach_msg_header_t *InP = InHeadP;
4099 mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP;
4100
4101 const mach_msg_type_t RetCodeType = {
4102 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
4103 /* msgt_size = */ 32,
4104 /* msgt_number = */ 1,
4105 /* msgt_inline = */ TRUE((boolean_t) 1),
4106 /* msgt_longform = */ FALSE((boolean_t) 0),
4107 /* msgt_deallocate = */ FALSE((boolean_t) 0),
4108 /* msgt_unused = */ 0
4109 };
4110
4111 mig_routine_t routine;
4112
4113 OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)(((((InP->msgh_bits) & 0x0000ff00) >> 8)) | ((0)
<< 8))
;
4114 OutP->Head.msgh_size = sizeof *OutP;
4115 OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_local_port;
4116 OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0);
4117 OutP->Head.msgh_seqno = 0;
4118 OutP->Head.msgh_id = InP->msgh_id + 100;
4119
4120 OutP->RetCodeType = RetCodeType;
4121
4122 if ((InP->msgh_id > 2100) || (InP->msgh_id < 2000) ||
4123 ((routine = mach_server_routines[InP->msgh_id - 2000]) == 0)) {
4124 OutP->RetCode = MIG_BAD_ID-303;
4125 return FALSE((boolean_t) 0);
4126 }
4127 (*routine) (InP, &OutP->Head);
4128 return TRUE((boolean_t) 1);
4129}
4130
4131mig_external mig_routine_t mach_server_routine
4132 (const mach_msg_header_t *InHeadP)
4133{
4134 int msgh_id;
4135
4136 msgh_id = InHeadP->msgh_id - 2000;
4137
4138 if ((msgh_id > 100) || (msgh_id < 0))
4139 return 0;
4140
4141 return mach_server_routines[msgh_id];
4142}
4143