Bug Summary

File:obj-scan-build/kern/mach_debug.server.c
Location:line 159, column 12
Description:Value stored to 'msgh_simple' during its initialization is never read

Annotated Source Code

1/* Module mach_debug */
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#include <mach_debug/mach_debug_types.h>
56
57/* Routine mach_port_get_srights */
58mig_internalstatic void _Xmach_port_get_srights
59 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
60{
61 typedef struct {
62 mach_msg_header_t Head;
63 mach_msg_type_t nameType;
64 mach_port_t name;
65 } Request;
66
67 typedef struct {
68 mach_msg_header_t Head;
69 mach_msg_type_t RetCodeType;
70 kern_return_t RetCode;
71 mach_msg_type_t srightsType;
72 mach_port_rights_t srights;
73 } Reply;
74
75 Request *In0P = (Request *) InHeadP;
76 Reply *OutP = (Reply *) OutHeadP;
77 mig_external kern_return_t mach_port_get_srights
78 (ipc_space_t task, mach_port_t name, mach_port_rights_t *srights);
79
80 const mach_msg_type_t nameCheck = {
81 /* msgt_name = */ 15,
82 /* msgt_size = */ 32,
83 /* msgt_number = */ 1,
84 /* msgt_inline = */ TRUE((boolean_t) 1),
85 /* msgt_longform = */ FALSE((boolean_t) 0),
86 /* msgt_deallocate = */ FALSE((boolean_t) 0),
87 /* msgt_unused = */ 0
88 };
89
90 const mach_msg_type_t srightsType = {
91 /* msgt_name = */ 2,
92 /* msgt_size = */ 32,
93 /* msgt_number = */ 1,
94 /* msgt_inline = */ TRUE((boolean_t) 1),
95 /* msgt_longform = */ FALSE((boolean_t) 0),
96 /* msgt_deallocate = */ FALSE((boolean_t) 0),
97 /* msgt_unused = */ 0
98 };
99
100 ipc_space_t 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->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(&
nameCheck);_t.w != _c.w; })), 0)
)
110 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
111#endif /* TypeCheck */
112
113 task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
114
115 OutP->RetCode = mach_port_get_srights(task, In0P->name, &OutP->srights);
116 space_deallocate(task);
117 if (OutP->RetCode != KERN_SUCCESS0)
118 return;
119
120 OutP->Head.msgh_size = 40;
121
122 OutP->srightsType = srightsType;
123}
124
125/* Default implementation of mach_port_get_srights */
126#ifdef MIG_EOPNOTSUPP
127kern_return_t __attribute__ ((weak))
128mach_port_get_srights
129(
130 ipc_space_t task,
131 mach_port_t name,
132 mach_port_rights_t *srights
133) { return MIG_EOPNOTSUPP; }
134#endif /* MIG_EOPNOTSUPP */
135
136/* Routine host_ipc_hash_info */
137mig_internalstatic void _Xhost_ipc_hash_info
138 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
139{
140 typedef struct {
141 mach_msg_header_t Head;
142 mach_msg_type_t infoCntType;
143 mach_msg_type_number_t infoCnt;
144 } Request;
145
146 typedef struct {
147 mach_msg_header_t Head;
148 mach_msg_type_t RetCodeType;
149 kern_return_t RetCode;
150 mach_msg_type_long_t infoType;
151 hash_info_bucket_t info[512];
152 } Reply;
153
154 Request *In0P = (Request *) InHeadP;
155 Reply *OutP = (Reply *) OutHeadP;
156 mig_external kern_return_t host_ipc_hash_info
157 (host_t host, hash_info_bucket_array_t *info, mach_msg_type_number_t *infoCnt);
158
159 boolean_t msgh_simple = msgh_simple;
Value stored to 'msgh_simple' during its initialization is never read
160 const mach_msg_type_t infoCntCheck = {
161 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
162 /* msgt_size = */ 32,
163 /* msgt_number = */ 1,
164 /* msgt_inline = */ TRUE((boolean_t) 1),
165 /* msgt_longform = */ FALSE((boolean_t) 0),
166 /* msgt_deallocate = */ FALSE((boolean_t) 0),
167 /* msgt_unused = */ 0
168 };
169
170 const mach_msg_type_long_t infoType = {
171 {
172 /* msgt_name = */ 0,
173 /* msgt_size = */ 0,
174 /* msgt_number = */ 0,
175 /* msgt_inline = */ TRUE((boolean_t) 1),
176 /* msgt_longform = */ TRUE((boolean_t) 1),
177 /* msgt_deallocate = */ FALSE((boolean_t) 0),
178 /* msgt_unused = */ 0
179 },
180 /* msgtl_name = */ 2,
181 /* msgtl_size = */ 32,
182 /* msgtl_number = */ 512,
183 };
184
185 mach_msg_type_number_t infoCnt;
186
187 hash_info_bucket_t *infoP;
188
189#if TypeCheck1
190 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
191 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
192 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
193#endif /* TypeCheck */
194
195#if TypeCheck1
196 if (BAD_TYPECHECK(&In0P->infoCntType, &infoCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->infoCntType); _c.t = *(&
infoCntCheck);_t.w != _c.w; })), 0)
)
197 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
198#endif /* TypeCheck */
199
200 infoP = OutP->info;
201 infoCnt = 512;
202 if (In0P->infoCnt < infoCnt)
203 infoCnt = In0P->infoCnt;
204
205 OutP->RetCode = host_ipc_hash_info(convert_port_to_host((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), &infoP, &infoCnt);
206 if (OutP->RetCode != KERN_SUCCESS0)
207 return;
208
209 msgh_simple = TRUE((boolean_t) 1);
210
211 OutP->infoType = infoType;
212 if (infoP != OutP->info) {
213 OutP->infoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
214 OutP->infoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
215 *((hash_info_bucket_t **)OutP->info) = infoP;
216 msgh_simple = FALSE((boolean_t) 0);
217 }
218
219 OutP->infoType.msgtl_number = infoCnt;
220 OutP->Head.msgh_size = 44 + ((OutP->infoType.msgtl_header.msgt_inline) ? 4 * infoCnt : sizeof(hash_info_bucket_t *));
221
222 if (!msgh_simple)
223 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
224}
225
226/* Default implementation of host_ipc_hash_info */
227#ifdef MIG_EOPNOTSUPP
228kern_return_t __attribute__ ((weak))
229host_ipc_hash_info
230(
231 host_t host,
232 hash_info_bucket_array_t *info,
233 mach_msg_type_number_t *infoCnt
234) { return MIG_EOPNOTSUPP; }
235#endif /* MIG_EOPNOTSUPP */
236
237/* Routine host_ipc_marequest_info */
238mig_internalstatic void _Xhost_ipc_marequest_info
239 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
240{
241 typedef struct {
242 mach_msg_header_t Head;
243 mach_msg_type_t infoCntType;
244 mach_msg_type_number_t infoCnt;
245 } Request;
246
247 typedef struct {
248 mach_msg_header_t Head;
249 mach_msg_type_t RetCodeType;
250 kern_return_t RetCode;
251 mach_msg_type_t max_requestsType;
252 unsigned max_requests;
253 mach_msg_type_long_t infoType;
254 hash_info_bucket_t info[512];
255 } Reply;
256
257 Request *In0P = (Request *) InHeadP;
258 Reply *OutP = (Reply *) OutHeadP;
259 mig_external kern_return_t host_ipc_marequest_info
260 (host_t host, unsigned *max_requests, hash_info_bucket_array_t *info, mach_msg_type_number_t *infoCnt);
261
262 boolean_t msgh_simple = msgh_simple;
263 const mach_msg_type_t infoCntCheck = {
264 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
265 /* msgt_size = */ 32,
266 /* msgt_number = */ 1,
267 /* msgt_inline = */ TRUE((boolean_t) 1),
268 /* msgt_longform = */ FALSE((boolean_t) 0),
269 /* msgt_deallocate = */ FALSE((boolean_t) 0),
270 /* msgt_unused = */ 0
271 };
272
273 const mach_msg_type_t max_requestsType = {
274 /* msgt_name = */ 2,
275 /* msgt_size = */ 32,
276 /* msgt_number = */ 1,
277 /* msgt_inline = */ TRUE((boolean_t) 1),
278 /* msgt_longform = */ FALSE((boolean_t) 0),
279 /* msgt_deallocate = */ FALSE((boolean_t) 0),
280 /* msgt_unused = */ 0
281 };
282
283 const mach_msg_type_long_t infoType = {
284 {
285 /* msgt_name = */ 0,
286 /* msgt_size = */ 0,
287 /* msgt_number = */ 0,
288 /* msgt_inline = */ TRUE((boolean_t) 1),
289 /* msgt_longform = */ TRUE((boolean_t) 1),
290 /* msgt_deallocate = */ FALSE((boolean_t) 0),
291 /* msgt_unused = */ 0
292 },
293 /* msgtl_name = */ 2,
294 /* msgtl_size = */ 32,
295 /* msgtl_number = */ 512,
296 };
297
298 mach_msg_type_number_t infoCnt;
299
300 hash_info_bucket_t *infoP;
301
302#if TypeCheck1
303 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
304 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (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->infoCntType, &infoCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->infoCntType); _c.t = *(&
infoCntCheck);_t.w != _c.w; })), 0)
)
310 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
311#endif /* TypeCheck */
312
313 infoP = OutP->info;
314 infoCnt = 512;
315 if (In0P->infoCnt < infoCnt)
316 infoCnt = In0P->infoCnt;
317
318 OutP->RetCode = host_ipc_marequest_info(convert_port_to_host((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), &OutP->max_requests, &infoP, &infoCnt);
319 if (OutP->RetCode != KERN_SUCCESS0)
320 return;
321
322 msgh_simple = TRUE((boolean_t) 1);
323
324 OutP->max_requestsType = max_requestsType;
325
326 OutP->infoType = infoType;
327 if (infoP != OutP->info) {
328 OutP->infoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
329 OutP->infoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
330 *((hash_info_bucket_t **)OutP->info) = infoP;
331 msgh_simple = FALSE((boolean_t) 0);
332 }
333
334 OutP->infoType.msgtl_number = infoCnt;
335 OutP->Head.msgh_size = 52 + ((OutP->infoType.msgtl_header.msgt_inline) ? 4 * infoCnt : sizeof(hash_info_bucket_t *));
336
337 if (!msgh_simple)
338 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
339}
340
341/* Default implementation of host_ipc_marequest_info */
342#ifdef MIG_EOPNOTSUPP
343kern_return_t __attribute__ ((weak))
344host_ipc_marequest_info
345(
346 host_t host,
347 unsigned *max_requests,
348 hash_info_bucket_array_t *info,
349 mach_msg_type_number_t *infoCnt
350) { return MIG_EOPNOTSUPP; }
351#endif /* MIG_EOPNOTSUPP */
352
353/* Routine mach_port_space_info */
354mig_internalstatic void _Xmach_port_space_info
355 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
356{
357 typedef struct {
358 mach_msg_header_t Head;
359 mach_msg_type_t table_infoCntType;
360 mach_msg_type_number_t table_infoCnt;
361 mach_msg_type_t tree_infoCntType;
362 mach_msg_type_number_t tree_infoCnt;
363 } Request;
364
365 typedef struct {
366 mach_msg_header_t Head;
367 mach_msg_type_t RetCodeType;
368 kern_return_t RetCode;
369 mach_msg_type_t infoType;
370 ipc_info_space_t info;
371 mach_msg_type_long_t table_infoType;
372 ipc_info_name_t table_info[56];
373 mach_msg_type_long_t tree_infoType;
374 ipc_info_tree_name_t tree_info[46];
375 } Reply;
376
377 Request *In0P = (Request *) InHeadP;
378 Reply *OutP = (Reply *) OutHeadP;
379 mig_external kern_return_t mach_port_space_info
380 (ipc_space_t task, ipc_info_space_t *info, ipc_info_name_array_t *table_info, mach_msg_type_number_t *table_infoCnt, ipc_info_tree_name_array_t *tree_info, mach_msg_type_number_t *tree_infoCnt);
381
382 boolean_t msgh_simple = msgh_simple;
383 unsigned int msgh_size;
384 unsigned int msgh_size_delta;
385
386 const mach_msg_type_t table_infoCntCheck = {
387 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
388 /* msgt_size = */ 32,
389 /* msgt_number = */ 1,
390 /* msgt_inline = */ TRUE((boolean_t) 1),
391 /* msgt_longform = */ FALSE((boolean_t) 0),
392 /* msgt_deallocate = */ FALSE((boolean_t) 0),
393 /* msgt_unused = */ 0
394 };
395
396 const mach_msg_type_t tree_infoCntCheck = {
397 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
398 /* msgt_size = */ 32,
399 /* msgt_number = */ 1,
400 /* msgt_inline = */ TRUE((boolean_t) 1),
401 /* msgt_longform = */ FALSE((boolean_t) 0),
402 /* msgt_deallocate = */ FALSE((boolean_t) 0),
403 /* msgt_unused = */ 0
404 };
405
406 const mach_msg_type_t infoType = {
407 /* msgt_name = */ 2,
408 /* msgt_size = */ 32,
409 /* msgt_number = */ 6,
410 /* msgt_inline = */ TRUE((boolean_t) 1),
411 /* msgt_longform = */ FALSE((boolean_t) 0),
412 /* msgt_deallocate = */ FALSE((boolean_t) 0),
413 /* msgt_unused = */ 0
414 };
415
416 const mach_msg_type_long_t table_infoType = {
417 {
418 /* msgt_name = */ 0,
419 /* msgt_size = */ 0,
420 /* msgt_number = */ 0,
421 /* msgt_inline = */ TRUE((boolean_t) 1),
422 /* msgt_longform = */ TRUE((boolean_t) 1),
423 /* msgt_deallocate = */ FALSE((boolean_t) 0),
424 /* msgt_unused = */ 0
425 },
426 /* msgtl_name = */ 2,
427 /* msgtl_size = */ 32,
428 /* msgtl_number = */ 504,
429 };
430
431 const mach_msg_type_long_t tree_infoType = {
432 {
433 /* msgt_name = */ 0,
434 /* msgt_size = */ 0,
435 /* msgt_number = */ 0,
436 /* msgt_inline = */ TRUE((boolean_t) 1),
437 /* msgt_longform = */ TRUE((boolean_t) 1),
438 /* msgt_deallocate = */ FALSE((boolean_t) 0),
439 /* msgt_unused = */ 0
440 },
441 /* msgtl_name = */ 2,
442 /* msgtl_size = */ 32,
443 /* msgtl_number = */ 506,
444 };
445
446 ipc_space_t task;
447 mach_msg_type_number_t table_infoCnt;
448 ipc_info_tree_name_t tree_info[46];
449 mach_msg_type_number_t tree_infoCnt;
450
451 ipc_info_name_t *table_infoP;
452 ipc_info_tree_name_t *tree_infoP;
453
454#if TypeCheck1
455 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
456 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
457 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
458#endif /* TypeCheck */
459
460#if TypeCheck1
461 if (BAD_TYPECHECK(&In0P->table_infoCntType, &table_infoCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->table_infoCntType); _c.t
= *(&table_infoCntCheck);_t.w != _c.w; })), 0)
)
462 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
463#endif /* TypeCheck */
464
465#if TypeCheck1
466 if (BAD_TYPECHECK(&In0P->tree_infoCntType, &tree_infoCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->tree_infoCntType); _c.t =
*(&tree_infoCntCheck);_t.w != _c.w; })), 0)
)
467 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
468#endif /* TypeCheck */
469
470 task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
471
472 table_infoP = OutP->table_info;
473 table_infoCnt = 56;
474 if (In0P->table_infoCnt < table_infoCnt)
475 table_infoCnt = In0P->table_infoCnt;
476
477 tree_infoP = tree_info;
478 tree_infoCnt = 46;
479 if (In0P->tree_infoCnt < tree_infoCnt)
480 tree_infoCnt = In0P->tree_infoCnt;
481
482 OutP->RetCode = mach_port_space_info(task, &OutP->info, &table_infoP, &table_infoCnt, &tree_infoP, &tree_infoCnt);
483 space_deallocate(task);
484 if (OutP->RetCode != KERN_SUCCESS0)
485 return;
486
487 msgh_simple = TRUE((boolean_t) 1);
488
489 OutP->infoType = infoType;
490
491 OutP->table_infoType = table_infoType;
492 if (table_infoP != OutP->table_info) {
493 OutP->table_infoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
494 OutP->table_infoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
495 *((ipc_info_name_t **)OutP->table_info) = table_infoP;
496 msgh_simple = FALSE((boolean_t) 0);
497 }
498
499 OutP->table_infoType.msgtl_number = 9 * table_infoCnt;
500 msgh_size_delta = (OutP->table_infoType.msgtl_header.msgt_inline) ? 36 * table_infoCnt : sizeof(ipc_info_name_t *);
501 msgh_size = 84 + msgh_size_delta;
502 OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2016);
503
504 OutP->tree_infoType = tree_infoType;
505
506 if (tree_infoP != tree_info) {
507 OutP->tree_infoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
508 OutP->tree_infoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
509 *((ipc_info_tree_name_t **)OutP->tree_info) = tree_infoP;
510 msgh_simple = FALSE((boolean_t) 0);
511 }
512 else {
513 memcpy(OutP->tree_info, tree_info, 44 * tree_infoCnt);
514 }
515
516 OutP->tree_infoType.msgtl_number = 11 * tree_infoCnt;
517 msgh_size += (OutP->tree_infoType.msgtl_header.msgt_inline) ? 44 * tree_infoCnt : sizeof(ipc_info_tree_name_t *);
518
519 OutP = (Reply *) OutHeadP;
520 if (!msgh_simple)
521 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
522 OutP->Head.msgh_size = msgh_size;
523}
524
525/* Default implementation of mach_port_space_info */
526#ifdef MIG_EOPNOTSUPP
527kern_return_t __attribute__ ((weak))
528mach_port_space_info
529(
530 ipc_space_t task,
531 ipc_info_space_t *info,
532 ipc_info_name_array_t *table_info,
533 mach_msg_type_number_t *table_infoCnt,
534 ipc_info_tree_name_array_t *tree_info,
535 mach_msg_type_number_t *tree_infoCnt
536) { return MIG_EOPNOTSUPP; }
537#endif /* MIG_EOPNOTSUPP */
538
539/* Routine mach_port_dnrequest_info */
540mig_internalstatic void _Xmach_port_dnrequest_info
541 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
542{
543 typedef struct {
544 mach_msg_header_t Head;
545 mach_msg_type_t nameType;
546 mach_port_t name;
547 } Request;
548
549 typedef struct {
550 mach_msg_header_t Head;
551 mach_msg_type_t RetCodeType;
552 kern_return_t RetCode;
553 mach_msg_type_t totalType;
554 unsigned total;
555 mach_msg_type_t usedType;
556 unsigned used;
557 } Reply;
558
559 Request *In0P = (Request *) InHeadP;
560 Reply *OutP = (Reply *) OutHeadP;
561 mig_external kern_return_t mach_port_dnrequest_info
562 (ipc_space_t task, mach_port_t name, unsigned *total, unsigned *used);
563
564 const mach_msg_type_t nameCheck = {
565 /* msgt_name = */ 15,
566 /* msgt_size = */ 32,
567 /* msgt_number = */ 1,
568 /* msgt_inline = */ TRUE((boolean_t) 1),
569 /* msgt_longform = */ FALSE((boolean_t) 0),
570 /* msgt_deallocate = */ FALSE((boolean_t) 0),
571 /* msgt_unused = */ 0
572 };
573
574 const mach_msg_type_t totalType = {
575 /* msgt_name = */ 2,
576 /* msgt_size = */ 32,
577 /* msgt_number = */ 1,
578 /* msgt_inline = */ TRUE((boolean_t) 1),
579 /* msgt_longform = */ FALSE((boolean_t) 0),
580 /* msgt_deallocate = */ FALSE((boolean_t) 0),
581 /* msgt_unused = */ 0
582 };
583
584 const mach_msg_type_t usedType = {
585 /* msgt_name = */ 2,
586 /* msgt_size = */ 32,
587 /* msgt_number = */ 1,
588 /* msgt_inline = */ TRUE((boolean_t) 1),
589 /* msgt_longform = */ FALSE((boolean_t) 0),
590 /* msgt_deallocate = */ FALSE((boolean_t) 0),
591 /* msgt_unused = */ 0
592 };
593
594 ipc_space_t task;
595
596#if TypeCheck1
597 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
598 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
599 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
600#endif /* TypeCheck */
601
602#if TypeCheck1
603 if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(&
nameCheck);_t.w != _c.w; })), 0)
)
604 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
605#endif /* TypeCheck */
606
607 task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
608
609 OutP->RetCode = mach_port_dnrequest_info(task, In0P->name, &OutP->total, &OutP->used);
610 space_deallocate(task);
611 if (OutP->RetCode != KERN_SUCCESS0)
612 return;
613
614 OutP->Head.msgh_size = 48;
615
616 OutP->totalType = totalType;
617
618 OutP->usedType = usedType;
619}
620
621/* Default implementation of mach_port_dnrequest_info */
622#ifdef MIG_EOPNOTSUPP
623kern_return_t __attribute__ ((weak))
624mach_port_dnrequest_info
625(
626 ipc_space_t task,
627 mach_port_t name,
628 unsigned *total,
629 unsigned *used
630) { return MIG_EOPNOTSUPP; }
631#endif /* MIG_EOPNOTSUPP */
632
633/* Routine host_stack_usage */
634mig_internalstatic void _Xhost_stack_usage
635 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
636{
637 typedef struct {
638 mach_msg_header_t Head;
639 } Request;
640
641 typedef struct {
642 mach_msg_header_t Head;
643 mach_msg_type_t RetCodeType;
644 kern_return_t RetCode;
645 mach_msg_type_t reservedType;
646 vm_size_t reserved;
647 mach_msg_type_t totalType;
648 unsigned total;
649 mach_msg_type_t spaceType;
650 vm_size_t space;
651 mach_msg_type_t residentType;
652 vm_size_t resident;
653 mach_msg_type_t maxusageType;
654 vm_size_t maxusage;
655 mach_msg_type_t maxstackType;
656 vm_offset_t maxstack;
657 } Reply;
658
659 Request *In0P = (Request *) InHeadP;
660 Reply *OutP = (Reply *) OutHeadP;
661 mig_external kern_return_t host_stack_usage
662 (host_t host, vm_size_t *reserved, unsigned *total, vm_size_t *space, vm_size_t *resident, vm_size_t *maxusage, vm_offset_t *maxstack);
663
664 const mach_msg_type_t reservedType = {
665 /* msgt_name = */ 2,
666 /* msgt_size = */ 32,
667 /* msgt_number = */ 1,
668 /* msgt_inline = */ TRUE((boolean_t) 1),
669 /* msgt_longform = */ FALSE((boolean_t) 0),
670 /* msgt_deallocate = */ FALSE((boolean_t) 0),
671 /* msgt_unused = */ 0
672 };
673
674 const mach_msg_type_t totalType = {
675 /* msgt_name = */ 2,
676 /* msgt_size = */ 32,
677 /* msgt_number = */ 1,
678 /* msgt_inline = */ TRUE((boolean_t) 1),
679 /* msgt_longform = */ FALSE((boolean_t) 0),
680 /* msgt_deallocate = */ FALSE((boolean_t) 0),
681 /* msgt_unused = */ 0
682 };
683
684 const mach_msg_type_t spaceType = {
685 /* msgt_name = */ 2,
686 /* msgt_size = */ 32,
687 /* msgt_number = */ 1,
688 /* msgt_inline = */ TRUE((boolean_t) 1),
689 /* msgt_longform = */ FALSE((boolean_t) 0),
690 /* msgt_deallocate = */ FALSE((boolean_t) 0),
691 /* msgt_unused = */ 0
692 };
693
694 const mach_msg_type_t residentType = {
695 /* msgt_name = */ 2,
696 /* msgt_size = */ 32,
697 /* msgt_number = */ 1,
698 /* msgt_inline = */ TRUE((boolean_t) 1),
699 /* msgt_longform = */ FALSE((boolean_t) 0),
700 /* msgt_deallocate = */ FALSE((boolean_t) 0),
701 /* msgt_unused = */ 0
702 };
703
704 const mach_msg_type_t maxusageType = {
705 /* msgt_name = */ 2,
706 /* msgt_size = */ 32,
707 /* msgt_number = */ 1,
708 /* msgt_inline = */ TRUE((boolean_t) 1),
709 /* msgt_longform = */ FALSE((boolean_t) 0),
710 /* msgt_deallocate = */ FALSE((boolean_t) 0),
711 /* msgt_unused = */ 0
712 };
713
714 const mach_msg_type_t maxstackType = {
715 /* msgt_name = */ 2,
716 /* msgt_size = */ 32,
717 /* msgt_number = */ 1,
718 /* msgt_inline = */ TRUE((boolean_t) 1),
719 /* msgt_longform = */ FALSE((boolean_t) 0),
720 /* msgt_deallocate = */ FALSE((boolean_t) 0),
721 /* msgt_unused = */ 0
722 };
723
724#if TypeCheck1
725 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
726 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
727 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
728#endif /* TypeCheck */
729
730 OutP->RetCode = host_stack_usage(convert_port_to_host((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), &OutP->reserved, &OutP->total, &OutP->space, &OutP->resident, &OutP->maxusage, &OutP->maxstack);
731 if (OutP->RetCode != KERN_SUCCESS0)
732 return;
733
734 OutP->Head.msgh_size = 80;
735
736 OutP->reservedType = reservedType;
737
738 OutP->totalType = totalType;
739
740 OutP->spaceType = spaceType;
741
742 OutP->residentType = residentType;
743
744 OutP->maxusageType = maxusageType;
745
746 OutP->maxstackType = maxstackType;
747}
748
749/* Default implementation of host_stack_usage */
750#ifdef MIG_EOPNOTSUPP
751kern_return_t __attribute__ ((weak))
752host_stack_usage
753(
754 host_t host,
755 vm_size_t *reserved,
756 unsigned *total,
757 vm_size_t *space,
758 vm_size_t *resident,
759 vm_size_t *maxusage,
760 vm_offset_t *maxstack
761) { return MIG_EOPNOTSUPP; }
762#endif /* MIG_EOPNOTSUPP */
763
764/* Routine processor_set_stack_usage */
765mig_internalstatic void _Xprocessor_set_stack_usage
766 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
767{
768 typedef struct {
769 mach_msg_header_t Head;
770 } Request;
771
772 typedef struct {
773 mach_msg_header_t Head;
774 mach_msg_type_t RetCodeType;
775 kern_return_t RetCode;
776 mach_msg_type_t totalType;
777 unsigned total;
778 mach_msg_type_t spaceType;
779 vm_size_t space;
780 mach_msg_type_t residentType;
781 vm_size_t resident;
782 mach_msg_type_t maxusageType;
783 vm_size_t maxusage;
784 mach_msg_type_t maxstackType;
785 vm_offset_t maxstack;
786 } Reply;
787
788 Request *In0P = (Request *) InHeadP;
789 Reply *OutP = (Reply *) OutHeadP;
790 mig_external kern_return_t processor_set_stack_usage
791 (processor_set_t pset, unsigned *total, vm_size_t *space, vm_size_t *resident, vm_size_t *maxusage, vm_offset_t *maxstack);
792
793 const mach_msg_type_t totalType = {
794 /* msgt_name = */ 2,
795 /* msgt_size = */ 32,
796 /* msgt_number = */ 1,
797 /* msgt_inline = */ TRUE((boolean_t) 1),
798 /* msgt_longform = */ FALSE((boolean_t) 0),
799 /* msgt_deallocate = */ FALSE((boolean_t) 0),
800 /* msgt_unused = */ 0
801 };
802
803 const mach_msg_type_t spaceType = {
804 /* msgt_name = */ 2,
805 /* msgt_size = */ 32,
806 /* msgt_number = */ 1,
807 /* msgt_inline = */ TRUE((boolean_t) 1),
808 /* msgt_longform = */ FALSE((boolean_t) 0),
809 /* msgt_deallocate = */ FALSE((boolean_t) 0),
810 /* msgt_unused = */ 0
811 };
812
813 const mach_msg_type_t residentType = {
814 /* msgt_name = */ 2,
815 /* msgt_size = */ 32,
816 /* msgt_number = */ 1,
817 /* msgt_inline = */ TRUE((boolean_t) 1),
818 /* msgt_longform = */ FALSE((boolean_t) 0),
819 /* msgt_deallocate = */ FALSE((boolean_t) 0),
820 /* msgt_unused = */ 0
821 };
822
823 const mach_msg_type_t maxusageType = {
824 /* msgt_name = */ 2,
825 /* msgt_size = */ 32,
826 /* msgt_number = */ 1,
827 /* msgt_inline = */ TRUE((boolean_t) 1),
828 /* msgt_longform = */ FALSE((boolean_t) 0),
829 /* msgt_deallocate = */ FALSE((boolean_t) 0),
830 /* msgt_unused = */ 0
831 };
832
833 const mach_msg_type_t maxstackType = {
834 /* msgt_name = */ 2,
835 /* msgt_size = */ 32,
836 /* msgt_number = */ 1,
837 /* msgt_inline = */ TRUE((boolean_t) 1),
838 /* msgt_longform = */ FALSE((boolean_t) 0),
839 /* msgt_deallocate = */ FALSE((boolean_t) 0),
840 /* msgt_unused = */ 0
841 };
842
843 processor_set_t pset;
844
845#if TypeCheck1
846 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
847 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
848 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
849#endif /* TypeCheck */
850
851 pset = convert_port_to_pset_name((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
852
853 OutP->RetCode = processor_set_stack_usage(pset, &OutP->total, &OutP->space, &OutP->resident, &OutP->maxusage, &OutP->maxstack);
854 pset_deallocate(pset);
855 if (OutP->RetCode != KERN_SUCCESS0)
856 return;
857
858 OutP->Head.msgh_size = 72;
859
860 OutP->totalType = totalType;
861
862 OutP->spaceType = spaceType;
863
864 OutP->residentType = residentType;
865
866 OutP->maxusageType = maxusageType;
867
868 OutP->maxstackType = maxstackType;
869}
870
871/* Default implementation of processor_set_stack_usage */
872#ifdef MIG_EOPNOTSUPP
873kern_return_t __attribute__ ((weak))
874processor_set_stack_usage
875(
876 processor_set_t pset,
877 unsigned *total,
878 vm_size_t *space,
879 vm_size_t *resident,
880 vm_size_t *maxusage,
881 vm_offset_t *maxstack
882) { return MIG_EOPNOTSUPP; }
883#endif /* MIG_EOPNOTSUPP */
884
885/* Routine host_virtual_physical_table_info */
886mig_internalstatic void _Xhost_virtual_physical_table_info
887 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
888{
889 typedef struct {
890 mach_msg_header_t Head;
891 mach_msg_type_t infoCntType;
892 mach_msg_type_number_t infoCnt;
893 } Request;
894
895 typedef struct {
896 mach_msg_header_t Head;
897 mach_msg_type_t RetCodeType;
898 kern_return_t RetCode;
899 mach_msg_type_long_t infoType;
900 hash_info_bucket_t info[512];
901 } Reply;
902
903 Request *In0P = (Request *) InHeadP;
904 Reply *OutP = (Reply *) OutHeadP;
905 mig_external kern_return_t host_virtual_physical_table_info
906 (host_t host, hash_info_bucket_array_t *info, mach_msg_type_number_t *infoCnt);
907
908 boolean_t msgh_simple = msgh_simple;
909 const mach_msg_type_t infoCntCheck = {
910 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
911 /* msgt_size = */ 32,
912 /* msgt_number = */ 1,
913 /* msgt_inline = */ TRUE((boolean_t) 1),
914 /* msgt_longform = */ FALSE((boolean_t) 0),
915 /* msgt_deallocate = */ FALSE((boolean_t) 0),
916 /* msgt_unused = */ 0
917 };
918
919 const mach_msg_type_long_t infoType = {
920 {
921 /* msgt_name = */ 0,
922 /* msgt_size = */ 0,
923 /* msgt_number = */ 0,
924 /* msgt_inline = */ TRUE((boolean_t) 1),
925 /* msgt_longform = */ TRUE((boolean_t) 1),
926 /* msgt_deallocate = */ FALSE((boolean_t) 0),
927 /* msgt_unused = */ 0
928 },
929 /* msgtl_name = */ 2,
930 /* msgtl_size = */ 32,
931 /* msgtl_number = */ 512,
932 };
933
934 mach_msg_type_number_t infoCnt;
935
936 hash_info_bucket_t *infoP;
937
938#if TypeCheck1
939 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
940 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
941 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
942#endif /* TypeCheck */
943
944#if TypeCheck1
945 if (BAD_TYPECHECK(&In0P->infoCntType, &infoCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->infoCntType); _c.t = *(&
infoCntCheck);_t.w != _c.w; })), 0)
)
946 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
947#endif /* TypeCheck */
948
949 infoP = OutP->info;
950 infoCnt = 512;
951 if (In0P->infoCnt < infoCnt)
952 infoCnt = In0P->infoCnt;
953
954 OutP->RetCode = host_virtual_physical_table_info(convert_port_to_host((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), &infoP, &infoCnt);
955 if (OutP->RetCode != KERN_SUCCESS0)
956 return;
957
958 msgh_simple = TRUE((boolean_t) 1);
959
960 OutP->infoType = infoType;
961 if (infoP != OutP->info) {
962 OutP->infoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
963 OutP->infoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
964 *((hash_info_bucket_t **)OutP->info) = infoP;
965 msgh_simple = FALSE((boolean_t) 0);
966 }
967
968 OutP->infoType.msgtl_number = infoCnt;
969 OutP->Head.msgh_size = 44 + ((OutP->infoType.msgtl_header.msgt_inline) ? 4 * infoCnt : sizeof(hash_info_bucket_t *));
970
971 if (!msgh_simple)
972 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
973}
974
975/* Default implementation of host_virtual_physical_table_info */
976#ifdef MIG_EOPNOTSUPP
977kern_return_t __attribute__ ((weak))
978host_virtual_physical_table_info
979(
980 host_t host,
981 hash_info_bucket_array_t *info,
982 mach_msg_type_number_t *infoCnt
983) { return MIG_EOPNOTSUPP; }
984#endif /* MIG_EOPNOTSUPP */
985
986/* Routine host_load_symbol_table */
987mig_internalstatic void _Xhost_load_symbol_table
988 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
989{
990 typedef struct {
991 mach_msg_header_t Head;
992 mach_msg_type_t taskType;
993 ipc_port_t task;
994 mach_msg_type_long_t nameType;
995 symtab_name_t name;
996 mach_msg_type_long_t symtabType;
997 vm_offset_t symtab;
998 } Request;
999
1000 typedef struct {
1001 mach_msg_header_t Head;
1002 mach_msg_type_t RetCodeType;
1003 kern_return_t RetCode;
1004 } Reply;
1005
1006 Request *In0P = (Request *) InHeadP;
1007 Reply *OutP = (Reply *) OutHeadP;
1008 mig_external kern_return_t host_load_symbol_table
1009 (host_t host, task_t task, symtab_name_t name, vm_offset_t symtab, mach_msg_type_number_t symtabCnt);
1010
1011 task_t task;
1012
1013#if TypeCheck1
1014 if (mig_unlikely ((In0P->Head.msgh_size != 92) ||__builtin_expect (!! ((In0P->Head.msgh_size != 92) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
1015 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 92) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1016 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1017#endif /* TypeCheck */
1018
1019#if TypeCheck1
1020 if (mig_unlikely ((In0P->taskType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->taskType.msgt_inline != ((boolean_t
) 1)) || (In0P->taskType.msgt_longform != ((boolean_t) 0))
|| (In0P->taskType.msgt_name != 17) || (In0P->taskType
.msgt_number != 1) || (In0P->taskType.msgt_size != 32)), 0
)
1021 (In0P->taskType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->taskType.msgt_inline != ((boolean_t
) 1)) || (In0P->taskType.msgt_longform != ((boolean_t) 0))
|| (In0P->taskType.msgt_name != 17) || (In0P->taskType
.msgt_number != 1) || (In0P->taskType.msgt_size != 32)), 0
)
1022 (In0P->taskType.msgt_name != 17) ||__builtin_expect (!! ((In0P->taskType.msgt_inline != ((boolean_t
) 1)) || (In0P->taskType.msgt_longform != ((boolean_t) 0))
|| (In0P->taskType.msgt_name != 17) || (In0P->taskType
.msgt_number != 1) || (In0P->taskType.msgt_size != 32)), 0
)
1023 (In0P->taskType.msgt_number != 1) ||__builtin_expect (!! ((In0P->taskType.msgt_inline != ((boolean_t
) 1)) || (In0P->taskType.msgt_longform != ((boolean_t) 0))
|| (In0P->taskType.msgt_name != 17) || (In0P->taskType
.msgt_number != 1) || (In0P->taskType.msgt_size != 32)), 0
)
1024 (In0P->taskType.msgt_size != 32))__builtin_expect (!! ((In0P->taskType.msgt_inline != ((boolean_t
) 1)) || (In0P->taskType.msgt_longform != ((boolean_t) 0))
|| (In0P->taskType.msgt_name != 17) || (In0P->taskType
.msgt_number != 1) || (In0P->taskType.msgt_size != 32)), 0
)
)
1025 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1026#endif /* TypeCheck */
1027
1028#if TypeCheck1
1029 if (mig_unlikely ((In0P->nameType.msgtl_header.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_name != 12) ||
(In0P->nameType.msgtl_number != 1) || (In0P->nameType.
msgtl_size != 256)), 0)
1030 (In0P->nameType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_name != 12) ||
(In0P->nameType.msgtl_number != 1) || (In0P->nameType.
msgtl_size != 256)), 0)
1031 (In0P->nameType.msgtl_name != 12) ||__builtin_expect (!! ((In0P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_name != 12) ||
(In0P->nameType.msgtl_number != 1) || (In0P->nameType.
msgtl_size != 256)), 0)
1032 (In0P->nameType.msgtl_number != 1) ||__builtin_expect (!! ((In0P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_name != 12) ||
(In0P->nameType.msgtl_number != 1) || (In0P->nameType.
msgtl_size != 256)), 0)
1033 (In0P->nameType.msgtl_size != 256))__builtin_expect (!! ((In0P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->nameType.msgtl_name != 12) ||
(In0P->nameType.msgtl_number != 1) || (In0P->nameType.
msgtl_size != 256)), 0)
)
1034 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1035#endif /* TypeCheck */
1036
1037#if TypeCheck1
1038 if (mig_unlikely ((In0P->symtabType.msgtl_header.msgt_inline != FALSE) ||__builtin_expect (!! ((In0P->symtabType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->symtabType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->symtabType.msgtl_name != 9)
|| (In0P->symtabType.msgtl_size != 8)), 0)
1039 (In0P->symtabType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->symtabType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->symtabType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->symtabType.msgtl_name != 9)
|| (In0P->symtabType.msgtl_size != 8)), 0)
1040 (In0P->symtabType.msgtl_name != 9) ||__builtin_expect (!! ((In0P->symtabType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->symtabType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->symtabType.msgtl_name != 9)
|| (In0P->symtabType.msgtl_size != 8)), 0)
1041 (In0P->symtabType.msgtl_size != 8))__builtin_expect (!! ((In0P->symtabType.msgtl_header.msgt_inline
!= ((boolean_t) 0)) || (In0P->symtabType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->symtabType.msgtl_name != 9)
|| (In0P->symtabType.msgtl_size != 8)), 0)
)
1042 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1043#endif /* TypeCheck */
1044
1045 task = convert_port_to_task(In0P->task);
1046
1047 OutP->RetCode = host_load_symbol_table(convert_port_to_host_priv((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), task, In0P->name, In0P->symtab, In0P->symtabType.msgtl_number);
1048 task_deallocate(task);
1049 if (OutP->RetCode != KERN_SUCCESS0)
1050 return;
1051
1052 if (IP_VALID(In0P->task)(((&(In0P->task)->ip_target.ipt_object) != ((ipc_object_t
) 0)) && ((&(In0P->task)->ip_target.ipt_object
) != ((ipc_object_t) -1)))
)
1053 ipc_port_release_send(In0P->task);
1054}
1055
1056/* Default implementation of host_load_symbol_table */
1057#ifdef MIG_EOPNOTSUPP
1058kern_return_t __attribute__ ((weak))
1059host_load_symbol_table
1060(
1061 host_t host,
1062 task_t task,
1063 symtab_name_t name,
1064 vm_offset_t symtab,
1065 mach_msg_type_number_t symtabCnt
1066) { return MIG_EOPNOTSUPP; }
1067#endif /* MIG_EOPNOTSUPP */
1068
1069/* Routine mach_port_kernel_object */
1070mig_internalstatic void _Xmach_port_kernel_object
1071 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1072{
1073 typedef struct {
1074 mach_msg_header_t Head;
1075 mach_msg_type_t nameType;
1076 mach_port_t name;
1077 } Request;
1078
1079 typedef struct {
1080 mach_msg_header_t Head;
1081 mach_msg_type_t RetCodeType;
1082 kern_return_t RetCode;
1083 mach_msg_type_t object_typeType;
1084 unsigned object_type;
1085 mach_msg_type_t object_addrType;
1086 vm_offset_t object_addr;
1087 } Reply;
1088
1089 Request *In0P = (Request *) InHeadP;
1090 Reply *OutP = (Reply *) OutHeadP;
1091 mig_external kern_return_t mach_port_kernel_object
1092 (ipc_space_t task, mach_port_t name, unsigned *object_type, vm_offset_t *object_addr);
1093
1094 const mach_msg_type_t nameCheck = {
1095 /* msgt_name = */ 15,
1096 /* msgt_size = */ 32,
1097 /* msgt_number = */ 1,
1098 /* msgt_inline = */ TRUE((boolean_t) 1),
1099 /* msgt_longform = */ FALSE((boolean_t) 0),
1100 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1101 /* msgt_unused = */ 0
1102 };
1103
1104 const mach_msg_type_t object_typeType = {
1105 /* msgt_name = */ 2,
1106 /* msgt_size = */ 32,
1107 /* msgt_number = */ 1,
1108 /* msgt_inline = */ TRUE((boolean_t) 1),
1109 /* msgt_longform = */ FALSE((boolean_t) 0),
1110 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1111 /* msgt_unused = */ 0
1112 };
1113
1114 const mach_msg_type_t object_addrType = {
1115 /* msgt_name = */ 2,
1116 /* msgt_size = */ 32,
1117 /* msgt_number = */ 1,
1118 /* msgt_inline = */ TRUE((boolean_t) 1),
1119 /* msgt_longform = */ FALSE((boolean_t) 0),
1120 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1121 /* msgt_unused = */ 0
1122 };
1123
1124 ipc_space_t task;
1125
1126#if TypeCheck1
1127 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1128 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1129 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1130#endif /* TypeCheck */
1131
1132#if TypeCheck1
1133 if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(&
nameCheck);_t.w != _c.w; })), 0)
)
1134 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1135#endif /* TypeCheck */
1136
1137 task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1138
1139 OutP->RetCode = mach_port_kernel_object(task, In0P->name, &OutP->object_type, &OutP->object_addr);
1140 space_deallocate(task);
1141 if (OutP->RetCode != KERN_SUCCESS0)
1142 return;
1143
1144 OutP->Head.msgh_size = 48;
1145
1146 OutP->object_typeType = object_typeType;
1147
1148 OutP->object_addrType = object_addrType;
1149}
1150
1151/* Default implementation of mach_port_kernel_object */
1152#ifdef MIG_EOPNOTSUPP
1153kern_return_t __attribute__ ((weak))
1154mach_port_kernel_object
1155(
1156 ipc_space_t task,
1157 mach_port_t name,
1158 unsigned *object_type,
1159 vm_offset_t *object_addr
1160) { return MIG_EOPNOTSUPP; }
1161#endif /* MIG_EOPNOTSUPP */
1162
1163/* Routine mach_vm_region_info */
1164mig_internalstatic void _Xmach_vm_region_info
1165 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1166{
1167 typedef struct {
1168 mach_msg_header_t Head;
1169 mach_msg_type_t addressType;
1170 vm_address_t address;
1171 } Request;
1172
1173 typedef struct {
1174 mach_msg_header_t Head;
1175 mach_msg_type_t RetCodeType;
1176 kern_return_t RetCode;
1177 mach_msg_type_t regionType;
1178 vm_region_info_t region;
1179 mach_msg_type_t objectType;
1180 ipc_port_t object;
1181 } Reply;
1182
1183 Request *In0P = (Request *) InHeadP;
1184 Reply *OutP = (Reply *) OutHeadP;
1185 mig_external kern_return_t mach_vm_region_info
1186 (vm_map_t task, vm_address_t address, vm_region_info_t *region, ipc_port_t *object);
1187
1188 const mach_msg_type_t addressCheck = {
1189 /* msgt_name = */ 2,
1190 /* msgt_size = */ 32,
1191 /* msgt_number = */ 1,
1192 /* msgt_inline = */ TRUE((boolean_t) 1),
1193 /* msgt_longform = */ FALSE((boolean_t) 0),
1194 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1195 /* msgt_unused = */ 0
1196 };
1197
1198 const mach_msg_type_t regionType = {
1199 /* msgt_name = */ 2,
1200 /* msgt_size = */ 32,
1201 /* msgt_number = */ 11,
1202 /* msgt_inline = */ TRUE((boolean_t) 1),
1203 /* msgt_longform = */ FALSE((boolean_t) 0),
1204 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1205 /* msgt_unused = */ 0
1206 };
1207
1208 const mach_msg_type_t objectType = {
1209 /* msgt_name = */ 17,
1210 /* msgt_size = */ 32,
1211 /* msgt_number = */ 1,
1212 /* msgt_inline = */ TRUE((boolean_t) 1),
1213 /* msgt_longform = */ FALSE((boolean_t) 0),
1214 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1215 /* msgt_unused = */ 0
1216 };
1217
1218 vm_map_t task;
1219
1220#if TypeCheck1
1221 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1222 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1223 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1224#endif /* TypeCheck */
1225
1226#if TypeCheck1
1227 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)
)
1228 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1229#endif /* TypeCheck */
1230
1231 task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1232
1233 OutP->RetCode = mach_vm_region_info(task, In0P->address, &OutP->region, &OutP->object);
1234 vm_map_deallocate(task);
1235 if (OutP->RetCode != KERN_SUCCESS0)
1236 return;
1237
1238 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1239 OutP->Head.msgh_size = 88;
1240
1241 OutP->regionType = regionType;
1242
1243 OutP->objectType = objectType;
1244}
1245
1246/* Default implementation of mach_vm_region_info */
1247#ifdef MIG_EOPNOTSUPP
1248kern_return_t __attribute__ ((weak))
1249mach_vm_region_info
1250(
1251 vm_map_t task,
1252 vm_address_t address,
1253 vm_region_info_t *region,
1254 ipc_port_t *object
1255) { return MIG_EOPNOTSUPP; }
1256#endif /* MIG_EOPNOTSUPP */
1257
1258/* Routine mach_vm_object_info */
1259mig_internalstatic void _Xmach_vm_object_info
1260 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1261{
1262 typedef struct {
1263 mach_msg_header_t Head;
1264 } Request;
1265
1266 typedef struct {
1267 mach_msg_header_t Head;
1268 mach_msg_type_t RetCodeType;
1269 kern_return_t RetCode;
1270 mach_msg_type_t infoType;
1271 vm_object_info_t info;
1272 mach_msg_type_t shadowType;
1273 ipc_port_t shadow;
1274 mach_msg_type_t copyType;
1275 ipc_port_t copy;
1276 } Reply;
1277
1278 Request *In0P = (Request *) InHeadP;
1279 Reply *OutP = (Reply *) OutHeadP;
1280 mig_external kern_return_t mach_vm_object_info
1281 (vm_object_t object, vm_object_info_t *info, ipc_port_t *shadow, ipc_port_t *copy);
1282
1283 const mach_msg_type_t infoType = {
1284 /* msgt_name = */ 2,
1285 /* msgt_size = */ 32,
1286 /* msgt_number = */ 14,
1287 /* msgt_inline = */ TRUE((boolean_t) 1),
1288 /* msgt_longform = */ FALSE((boolean_t) 0),
1289 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1290 /* msgt_unused = */ 0
1291 };
1292
1293 const mach_msg_type_t shadowType = {
1294 /* msgt_name = */ 17,
1295 /* msgt_size = */ 32,
1296 /* msgt_number = */ 1,
1297 /* msgt_inline = */ TRUE((boolean_t) 1),
1298 /* msgt_longform = */ FALSE((boolean_t) 0),
1299 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1300 /* msgt_unused = */ 0
1301 };
1302
1303 const mach_msg_type_t copyType = {
1304 /* msgt_name = */ 17,
1305 /* msgt_size = */ 32,
1306 /* msgt_number = */ 1,
1307 /* msgt_inline = */ TRUE((boolean_t) 1),
1308 /* msgt_longform = */ FALSE((boolean_t) 0),
1309 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1310 /* msgt_unused = */ 0
1311 };
1312
1313 vm_object_t object;
1314
1315#if TypeCheck1
1316 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1317 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1318 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1319#endif /* TypeCheck */
1320
1321 object = vm_object_lookup_name((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1322
1323 OutP->RetCode = mach_vm_object_info(object, &OutP->info, &OutP->shadow, &OutP->copy);
1324 vm_object_deallocate(object);
1325 if (OutP->RetCode != KERN_SUCCESS0)
1326 return;
1327
1328 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1329 OutP->Head.msgh_size = 108;
1330
1331 OutP->infoType = infoType;
1332
1333 OutP->shadowType = shadowType;
1334
1335 OutP->copyType = copyType;
1336}
1337
1338/* Default implementation of mach_vm_object_info */
1339#ifdef MIG_EOPNOTSUPP
1340kern_return_t __attribute__ ((weak))
1341mach_vm_object_info
1342(
1343 vm_object_t object,
1344 vm_object_info_t *info,
1345 ipc_port_t *shadow,
1346 ipc_port_t *copy
1347) { return MIG_EOPNOTSUPP; }
1348#endif /* MIG_EOPNOTSUPP */
1349
1350/* Routine mach_vm_object_pages */
1351mig_internalstatic void _Xmach_vm_object_pages
1352 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1353{
1354 typedef struct {
1355 mach_msg_header_t Head;
1356 mach_msg_type_t pagesCntType;
1357 mach_msg_type_number_t pagesCnt;
1358 } Request;
1359
1360 typedef struct {
1361 mach_msg_header_t Head;
1362 mach_msg_type_t RetCodeType;
1363 kern_return_t RetCode;
1364 mach_msg_type_long_t pagesType;
1365 vm_page_info_t pages[85];
1366 } Reply;
1367
1368 Request *In0P = (Request *) InHeadP;
1369 Reply *OutP = (Reply *) OutHeadP;
1370 mig_external kern_return_t mach_vm_object_pages
1371 (vm_object_t object, vm_page_info_array_t *pages, mach_msg_type_number_t *pagesCnt);
1372
1373 boolean_t msgh_simple = msgh_simple;
1374 const mach_msg_type_t pagesCntCheck = {
1375 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
1376 /* msgt_size = */ 32,
1377 /* msgt_number = */ 1,
1378 /* msgt_inline = */ TRUE((boolean_t) 1),
1379 /* msgt_longform = */ FALSE((boolean_t) 0),
1380 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1381 /* msgt_unused = */ 0
1382 };
1383
1384 const mach_msg_type_long_t pagesType = {
1385 {
1386 /* msgt_name = */ 0,
1387 /* msgt_size = */ 0,
1388 /* msgt_number = */ 0,
1389 /* msgt_inline = */ TRUE((boolean_t) 1),
1390 /* msgt_longform = */ TRUE((boolean_t) 1),
1391 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1392 /* msgt_unused = */ 0
1393 },
1394 /* msgtl_name = */ 2,
1395 /* msgtl_size = */ 32,
1396 /* msgtl_number = */ 510,
1397 };
1398
1399 vm_object_t object;
1400 mach_msg_type_number_t pagesCnt;
1401
1402 vm_page_info_t *pagesP;
1403
1404#if TypeCheck1
1405 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1406 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1407 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1408#endif /* TypeCheck */
1409
1410#if TypeCheck1
1411 if (BAD_TYPECHECK(&In0P->pagesCntType, &pagesCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->pagesCntType); _c.t = *(
&pagesCntCheck);_t.w != _c.w; })), 0)
)
1412 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1413#endif /* TypeCheck */
1414
1415 object = vm_object_lookup_name((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1416
1417 pagesP = OutP->pages;
1418 pagesCnt = 85;
1419 if (In0P->pagesCnt < pagesCnt)
1420 pagesCnt = In0P->pagesCnt;
1421
1422 OutP->RetCode = mach_vm_object_pages(object, &pagesP, &pagesCnt);
1423 vm_object_deallocate(object);
1424 if (OutP->RetCode != KERN_SUCCESS0)
1425 return;
1426
1427 msgh_simple = TRUE((boolean_t) 1);
1428
1429 OutP->pagesType = pagesType;
1430 if (pagesP != OutP->pages) {
1431 OutP->pagesType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1432 OutP->pagesType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
1433 *((vm_page_info_t **)OutP->pages) = pagesP;
1434 msgh_simple = FALSE((boolean_t) 0);
1435 }
1436
1437 OutP->pagesType.msgtl_number = 6 * pagesCnt;
1438 OutP->Head.msgh_size = 44 + ((OutP->pagesType.msgtl_header.msgt_inline) ? 24 * pagesCnt : sizeof(vm_page_info_t *));
1439
1440 if (!msgh_simple)
1441 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1442}
1443
1444/* Default implementation of mach_vm_object_pages */
1445#ifdef MIG_EOPNOTSUPP
1446kern_return_t __attribute__ ((weak))
1447mach_vm_object_pages
1448(
1449 vm_object_t object,
1450 vm_page_info_array_t *pages,
1451 mach_msg_type_number_t *pagesCnt
1452) { return MIG_EOPNOTSUPP; }
1453#endif /* MIG_EOPNOTSUPP */
1454
1455/* Routine host_slab_info */
1456mig_internalstatic void _Xhost_slab_info
1457 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1458{
1459 typedef struct {
1460 mach_msg_header_t Head;
1461 mach_msg_type_t infoCntType;
1462 mach_msg_type_number_t infoCnt;
1463 } Request;
1464
1465 typedef struct {
1466 mach_msg_header_t Head;
1467 mach_msg_type_t RetCodeType;
1468 kern_return_t RetCode;
1469 mach_msg_type_long_t infoType;
1470 cache_info_t info[26];
1471 } Reply;
1472
1473 Request *In0P = (Request *) InHeadP;
1474 Reply *OutP = (Reply *) OutHeadP;
1475 mig_external kern_return_t host_slab_info
1476 (host_t host, cache_info_array_t *info, mach_msg_type_number_t *infoCnt);
1477
1478 boolean_t msgh_simple = msgh_simple;
1479 const mach_msg_type_t infoCntCheck = {
1480 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
1481 /* msgt_size = */ 32,
1482 /* msgt_number = */ 1,
1483 /* msgt_inline = */ TRUE((boolean_t) 1),
1484 /* msgt_longform = */ FALSE((boolean_t) 0),
1485 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1486 /* msgt_unused = */ 0
1487 };
1488
1489 const mach_msg_type_long_t infoType = {
1490 {
1491 /* msgt_name = */ 0,
1492 /* msgt_size = */ 0,
1493 /* msgt_number = */ 0,
1494 /* msgt_inline = */ TRUE((boolean_t) 1),
1495 /* msgt_longform = */ TRUE((boolean_t) 1),
1496 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1497 /* msgt_unused = */ 0
1498 },
1499 /* msgtl_name = */ 2,
1500 /* msgtl_size = */ 32,
1501 /* msgtl_number = */ 494,
1502 };
1503
1504 mach_msg_type_number_t infoCnt;
1505
1506 cache_info_t *infoP;
1507
1508#if TypeCheck1
1509 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1510 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1511 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1512#endif /* TypeCheck */
1513
1514#if TypeCheck1
1515 if (BAD_TYPECHECK(&In0P->infoCntType, &infoCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->infoCntType); _c.t = *(&
infoCntCheck);_t.w != _c.w; })), 0)
)
1516 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1517#endif /* TypeCheck */
1518
1519 infoP = OutP->info;
1520 infoCnt = 26;
1521 if (In0P->infoCnt < infoCnt)
1522 infoCnt = In0P->infoCnt;
1523
1524 OutP->RetCode = host_slab_info(convert_port_to_host((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), &infoP, &infoCnt);
1525 if (OutP->RetCode != KERN_SUCCESS0)
1526 return;
1527
1528 msgh_simple = TRUE((boolean_t) 1);
1529
1530 OutP->infoType = infoType;
1531 if (infoP != OutP->info) {
1532 OutP->infoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1533 OutP->infoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
1534 *((cache_info_t **)OutP->info) = infoP;
1535 msgh_simple = FALSE((boolean_t) 0);
1536 }
1537
1538 OutP->infoType.msgtl_number = 19 * infoCnt;
1539 OutP->Head.msgh_size = 44 + ((OutP->infoType.msgtl_header.msgt_inline) ? 76 * infoCnt : sizeof(cache_info_t *));
1540
1541 if (!msgh_simple)
1542 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1543}
1544
1545/* Default implementation of host_slab_info */
1546#ifdef MIG_EOPNOTSUPP
1547kern_return_t __attribute__ ((weak))
1548host_slab_info
1549(
1550 host_t host,
1551 cache_info_array_t *info,
1552 mach_msg_type_number_t *infoCnt
1553) { return MIG_EOPNOTSUPP; }
1554#endif /* MIG_EOPNOTSUPP */
1555
1556mig_routine_t mach_debug_server_routines[] = {
1557 0,
1558 0,
1559 0,
1560 0,
1561 0,
1562 0,
1563 0,
1564 _Xmach_port_get_srights,
1565 _Xhost_ipc_hash_info,
1566 _Xhost_ipc_marequest_info,
1567 _Xmach_port_space_info,
1568 _Xmach_port_dnrequest_info,
1569 0,
1570 0,
1571 _Xhost_stack_usage,
1572 _Xprocessor_set_stack_usage,
1573 _Xhost_virtual_physical_table_info,
1574 _Xhost_load_symbol_table,
1575 _Xmach_port_kernel_object,
1576 _Xmach_vm_region_info,
1577 _Xmach_vm_object_info,
1578 _Xmach_vm_object_pages,
1579 _Xhost_slab_info,
1580};
1581
1582mig_external boolean_t mach_debug_server
1583 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1584{
1585 mach_msg_header_t *InP = InHeadP;
1586 mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP;
1587
1588 const mach_msg_type_t RetCodeType = {
1589 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
1590 /* msgt_size = */ 32,
1591 /* msgt_number = */ 1,
1592 /* msgt_inline = */ TRUE((boolean_t) 1),
1593 /* msgt_longform = */ FALSE((boolean_t) 0),
1594 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1595 /* msgt_unused = */ 0
1596 };
1597
1598 mig_routine_t routine;
1599
1600 OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)(((((InP->msgh_bits) & 0x0000ff00) >> 8)) | ((0)
<< 8))
;
1601 OutP->Head.msgh_size = sizeof *OutP;
1602 OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_local_port;
1603 OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0);
1604 OutP->Head.msgh_seqno = 0;
1605 OutP->Head.msgh_id = InP->msgh_id + 100;
1606
1607 OutP->RetCodeType = RetCodeType;
1608
1609 if ((InP->msgh_id > 3022) || (InP->msgh_id < 3000) ||
1610 ((routine = mach_debug_server_routines[InP->msgh_id - 3000]) == 0)) {
1611 OutP->RetCode = MIG_BAD_ID-303;
1612 return FALSE((boolean_t) 0);
1613 }
1614 (*routine) (InP, &OutP->Head);
1615 return TRUE((boolean_t) 1);
1616}
1617
1618mig_external mig_routine_t mach_debug_server_routine
1619 (const mach_msg_header_t *InHeadP)
1620{
1621 int msgh_id;
1622
1623 msgh_id = InHeadP->msgh_id - 3000;
1624
1625 if ((msgh_id > 22) || (msgh_id < 0))
1626 return 0;
1627
1628 return mach_debug_server_routines[msgh_id];
1629}
1630