Bug Summary

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

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_marequest_info */
137mig_internalstatic void _Xhost_ipc_marequest_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_t max_requestsType;
151 unsigned max_requests;
152 mach_msg_type_long_t infoType;
153 hash_info_bucket_t info[512];
154 } Reply;
155
156 Request *In0P = (Request *) InHeadP;
157 Reply *OutP = (Reply *) OutHeadP;
158 mig_external kern_return_t host_ipc_marequest_info
159 (host_t host, unsigned *max_requests, hash_info_bucket_array_t *info, mach_msg_type_number_t *infoCnt);
160
161 boolean_t msgh_simple = msgh_simple;
Assigned value is garbage or undefined
162 const mach_msg_type_t infoCntCheck = {
163 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
164 /* msgt_size = */ 32,
165 /* msgt_number = */ 1,
166 /* msgt_inline = */ TRUE((boolean_t) 1),
167 /* msgt_longform = */ FALSE((boolean_t) 0),
168 /* msgt_deallocate = */ FALSE((boolean_t) 0),
169 /* msgt_unused = */ 0
170 };
171
172 const mach_msg_type_t max_requestsType = {
173 /* msgt_name = */ 2,
174 /* msgt_size = */ 32,
175 /* msgt_number = */ 1,
176 /* msgt_inline = */ TRUE((boolean_t) 1),
177 /* msgt_longform = */ FALSE((boolean_t) 0),
178 /* msgt_deallocate = */ FALSE((boolean_t) 0),
179 /* msgt_unused = */ 0
180 };
181
182 const mach_msg_type_long_t infoType = {
183 {
184 /* msgt_name = */ 0,
185 /* msgt_size = */ 0,
186 /* msgt_number = */ 0,
187 /* msgt_inline = */ TRUE((boolean_t) 1),
188 /* msgt_longform = */ TRUE((boolean_t) 1),
189 /* msgt_deallocate = */ FALSE((boolean_t) 0),
190 /* msgt_unused = */ 0
191 },
192 /* msgtl_name = */ 2,
193 /* msgtl_size = */ 32,
194 /* msgtl_number = */ 512,
195 };
196
197 mach_msg_type_number_t infoCnt;
198
199 hash_info_bucket_t *infoP;
200
201#if TypeCheck1
202 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
203 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
204 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
205#endif /* TypeCheck */
206
207#if TypeCheck1
208 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)
)
209 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
210#endif /* TypeCheck */
211
212 infoP = OutP->info;
213 infoCnt = 512;
214 if (In0P->infoCnt < infoCnt)
215 infoCnt = In0P->infoCnt;
216
217 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);
218 if (OutP->RetCode != KERN_SUCCESS0)
219 return;
220
221 msgh_simple = TRUE((boolean_t) 1);
222
223 OutP->max_requestsType = max_requestsType;
224
225 OutP->infoType = infoType;
226 if (infoP != OutP->info) {
227 OutP->infoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
228 OutP->infoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
229 *((hash_info_bucket_t **)OutP->info) = infoP;
230 msgh_simple = FALSE((boolean_t) 0);
231 }
232
233 OutP->infoType.msgtl_number = infoCnt;
234 OutP->Head.msgh_size = 52 + ((OutP->infoType.msgtl_header.msgt_inline) ? 4 * infoCnt : sizeof(hash_info_bucket_t *));
235
236 if (!msgh_simple)
237 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
238}
239
240/* Default implementation of host_ipc_marequest_info */
241#ifdef MIG_EOPNOTSUPP
242kern_return_t __attribute__ ((weak))
243host_ipc_marequest_info
244(
245 host_t host,
246 unsigned *max_requests,
247 hash_info_bucket_array_t *info,
248 mach_msg_type_number_t *infoCnt
249) { return MIG_EOPNOTSUPP; }
250#endif /* MIG_EOPNOTSUPP */
251
252/* Routine mach_port_dnrequest_info */
253mig_internalstatic void _Xmach_port_dnrequest_info
254 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
255{
256 typedef struct {
257 mach_msg_header_t Head;
258 mach_msg_type_t nameType;
259 mach_port_t name;
260 } Request;
261
262 typedef struct {
263 mach_msg_header_t Head;
264 mach_msg_type_t RetCodeType;
265 kern_return_t RetCode;
266 mach_msg_type_t totalType;
267 unsigned total;
268 mach_msg_type_t usedType;
269 unsigned used;
270 } Reply;
271
272 Request *In0P = (Request *) InHeadP;
273 Reply *OutP = (Reply *) OutHeadP;
274 mig_external kern_return_t mach_port_dnrequest_info
275 (ipc_space_t task, mach_port_t name, unsigned *total, unsigned *used);
276
277 const mach_msg_type_t nameCheck = {
278 /* msgt_name = */ 15,
279 /* msgt_size = */ 32,
280 /* msgt_number = */ 1,
281 /* msgt_inline = */ TRUE((boolean_t) 1),
282 /* msgt_longform = */ FALSE((boolean_t) 0),
283 /* msgt_deallocate = */ FALSE((boolean_t) 0),
284 /* msgt_unused = */ 0
285 };
286
287 const mach_msg_type_t totalType = {
288 /* msgt_name = */ 2,
289 /* msgt_size = */ 32,
290 /* msgt_number = */ 1,
291 /* msgt_inline = */ TRUE((boolean_t) 1),
292 /* msgt_longform = */ FALSE((boolean_t) 0),
293 /* msgt_deallocate = */ FALSE((boolean_t) 0),
294 /* msgt_unused = */ 0
295 };
296
297 const mach_msg_type_t usedType = {
298 /* msgt_name = */ 2,
299 /* msgt_size = */ 32,
300 /* msgt_number = */ 1,
301 /* msgt_inline = */ TRUE((boolean_t) 1),
302 /* msgt_longform = */ FALSE((boolean_t) 0),
303 /* msgt_deallocate = */ FALSE((boolean_t) 0),
304 /* msgt_unused = */ 0
305 };
306
307 ipc_space_t task;
308
309#if TypeCheck1
310 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
311 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
312 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
313#endif /* TypeCheck */
314
315#if TypeCheck1
316 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)
)
317 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
318#endif /* TypeCheck */
319
320 task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
321
322 OutP->RetCode = mach_port_dnrequest_info(task, In0P->name, &OutP->total, &OutP->used);
323 space_deallocate(task);
324 if (OutP->RetCode != KERN_SUCCESS0)
325 return;
326
327 OutP->Head.msgh_size = 48;
328
329 OutP->totalType = totalType;
330
331 OutP->usedType = usedType;
332}
333
334/* Default implementation of mach_port_dnrequest_info */
335#ifdef MIG_EOPNOTSUPP
336kern_return_t __attribute__ ((weak))
337mach_port_dnrequest_info
338(
339 ipc_space_t task,
340 mach_port_t name,
341 unsigned *total,
342 unsigned *used
343) { return MIG_EOPNOTSUPP; }
344#endif /* MIG_EOPNOTSUPP */
345
346/* Routine host_stack_usage */
347mig_internalstatic void _Xhost_stack_usage
348 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
349{
350 typedef struct {
351 mach_msg_header_t Head;
352 } Request;
353
354 typedef struct {
355 mach_msg_header_t Head;
356 mach_msg_type_t RetCodeType;
357 kern_return_t RetCode;
358 mach_msg_type_t reservedType;
359 vm_size_t reserved;
360 mach_msg_type_t totalType;
361 unsigned total;
362 mach_msg_type_t spaceType;
363 vm_size_t space;
364 mach_msg_type_t residentType;
365 vm_size_t resident;
366 mach_msg_type_t maxusageType;
367 vm_size_t maxusage;
368 mach_msg_type_t maxstackType;
369 vm_offset_t maxstack;
370 } Reply;
371
372 Request *In0P = (Request *) InHeadP;
373 Reply *OutP = (Reply *) OutHeadP;
374 mig_external kern_return_t host_stack_usage
375 (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);
376
377 const mach_msg_type_t reservedType = {
378 /* msgt_name = */ 2,
379 /* msgt_size = */ 32,
380 /* msgt_number = */ 1,
381 /* msgt_inline = */ TRUE((boolean_t) 1),
382 /* msgt_longform = */ FALSE((boolean_t) 0),
383 /* msgt_deallocate = */ FALSE((boolean_t) 0),
384 /* msgt_unused = */ 0
385 };
386
387 const mach_msg_type_t totalType = {
388 /* msgt_name = */ 2,
389 /* msgt_size = */ 32,
390 /* msgt_number = */ 1,
391 /* msgt_inline = */ TRUE((boolean_t) 1),
392 /* msgt_longform = */ FALSE((boolean_t) 0),
393 /* msgt_deallocate = */ FALSE((boolean_t) 0),
394 /* msgt_unused = */ 0
395 };
396
397 const mach_msg_type_t spaceType = {
398 /* msgt_name = */ 2,
399 /* msgt_size = */ 32,
400 /* msgt_number = */ 1,
401 /* msgt_inline = */ TRUE((boolean_t) 1),
402 /* msgt_longform = */ FALSE((boolean_t) 0),
403 /* msgt_deallocate = */ FALSE((boolean_t) 0),
404 /* msgt_unused = */ 0
405 };
406
407 const mach_msg_type_t residentType = {
408 /* msgt_name = */ 2,
409 /* msgt_size = */ 32,
410 /* msgt_number = */ 1,
411 /* msgt_inline = */ TRUE((boolean_t) 1),
412 /* msgt_longform = */ FALSE((boolean_t) 0),
413 /* msgt_deallocate = */ FALSE((boolean_t) 0),
414 /* msgt_unused = */ 0
415 };
416
417 const mach_msg_type_t maxusageType = {
418 /* msgt_name = */ 2,
419 /* msgt_size = */ 32,
420 /* msgt_number = */ 1,
421 /* msgt_inline = */ TRUE((boolean_t) 1),
422 /* msgt_longform = */ FALSE((boolean_t) 0),
423 /* msgt_deallocate = */ FALSE((boolean_t) 0),
424 /* msgt_unused = */ 0
425 };
426
427 const mach_msg_type_t maxstackType = {
428 /* msgt_name = */ 2,
429 /* msgt_size = */ 32,
430 /* msgt_number = */ 1,
431 /* msgt_inline = */ TRUE((boolean_t) 1),
432 /* msgt_longform = */ FALSE((boolean_t) 0),
433 /* msgt_deallocate = */ FALSE((boolean_t) 0),
434 /* msgt_unused = */ 0
435 };
436
437#if TypeCheck1
438 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
439 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
440 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
441#endif /* TypeCheck */
442
443 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);
444 if (OutP->RetCode != KERN_SUCCESS0)
445 return;
446
447 OutP->Head.msgh_size = 80;
448
449 OutP->reservedType = reservedType;
450
451 OutP->totalType = totalType;
452
453 OutP->spaceType = spaceType;
454
455 OutP->residentType = residentType;
456
457 OutP->maxusageType = maxusageType;
458
459 OutP->maxstackType = maxstackType;
460}
461
462/* Default implementation of host_stack_usage */
463#ifdef MIG_EOPNOTSUPP
464kern_return_t __attribute__ ((weak))
465host_stack_usage
466(
467 host_t host,
468 vm_size_t *reserved,
469 unsigned *total,
470 vm_size_t *space,
471 vm_size_t *resident,
472 vm_size_t *maxusage,
473 vm_offset_t *maxstack
474) { return MIG_EOPNOTSUPP; }
475#endif /* MIG_EOPNOTSUPP */
476
477/* Routine processor_set_stack_usage */
478mig_internalstatic void _Xprocessor_set_stack_usage
479 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
480{
481 typedef struct {
482 mach_msg_header_t Head;
483 } Request;
484
485 typedef struct {
486 mach_msg_header_t Head;
487 mach_msg_type_t RetCodeType;
488 kern_return_t RetCode;
489 mach_msg_type_t totalType;
490 unsigned total;
491 mach_msg_type_t spaceType;
492 vm_size_t space;
493 mach_msg_type_t residentType;
494 vm_size_t resident;
495 mach_msg_type_t maxusageType;
496 vm_size_t maxusage;
497 mach_msg_type_t maxstackType;
498 vm_offset_t maxstack;
499 } Reply;
500
501 Request *In0P = (Request *) InHeadP;
502 Reply *OutP = (Reply *) OutHeadP;
503 mig_external kern_return_t processor_set_stack_usage
504 (processor_set_t pset, unsigned *total, vm_size_t *space, vm_size_t *resident, vm_size_t *maxusage, vm_offset_t *maxstack);
505
506 const mach_msg_type_t totalType = {
507 /* msgt_name = */ 2,
508 /* msgt_size = */ 32,
509 /* msgt_number = */ 1,
510 /* msgt_inline = */ TRUE((boolean_t) 1),
511 /* msgt_longform = */ FALSE((boolean_t) 0),
512 /* msgt_deallocate = */ FALSE((boolean_t) 0),
513 /* msgt_unused = */ 0
514 };
515
516 const mach_msg_type_t spaceType = {
517 /* msgt_name = */ 2,
518 /* msgt_size = */ 32,
519 /* msgt_number = */ 1,
520 /* msgt_inline = */ TRUE((boolean_t) 1),
521 /* msgt_longform = */ FALSE((boolean_t) 0),
522 /* msgt_deallocate = */ FALSE((boolean_t) 0),
523 /* msgt_unused = */ 0
524 };
525
526 const mach_msg_type_t residentType = {
527 /* msgt_name = */ 2,
528 /* msgt_size = */ 32,
529 /* msgt_number = */ 1,
530 /* msgt_inline = */ TRUE((boolean_t) 1),
531 /* msgt_longform = */ FALSE((boolean_t) 0),
532 /* msgt_deallocate = */ FALSE((boolean_t) 0),
533 /* msgt_unused = */ 0
534 };
535
536 const mach_msg_type_t maxusageType = {
537 /* msgt_name = */ 2,
538 /* msgt_size = */ 32,
539 /* msgt_number = */ 1,
540 /* msgt_inline = */ TRUE((boolean_t) 1),
541 /* msgt_longform = */ FALSE((boolean_t) 0),
542 /* msgt_deallocate = */ FALSE((boolean_t) 0),
543 /* msgt_unused = */ 0
544 };
545
546 const mach_msg_type_t maxstackType = {
547 /* msgt_name = */ 2,
548 /* msgt_size = */ 32,
549 /* msgt_number = */ 1,
550 /* msgt_inline = */ TRUE((boolean_t) 1),
551 /* msgt_longform = */ FALSE((boolean_t) 0),
552 /* msgt_deallocate = */ FALSE((boolean_t) 0),
553 /* msgt_unused = */ 0
554 };
555
556 processor_set_t pset;
557
558#if TypeCheck1
559 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
560 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
561 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
562#endif /* TypeCheck */
563
564 pset = convert_port_to_pset_name((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
565
566 OutP->RetCode = processor_set_stack_usage(pset, &OutP->total, &OutP->space, &OutP->resident, &OutP->maxusage, &OutP->maxstack);
567 pset_deallocate(pset);
568 if (OutP->RetCode != KERN_SUCCESS0)
569 return;
570
571 OutP->Head.msgh_size = 72;
572
573 OutP->totalType = totalType;
574
575 OutP->spaceType = spaceType;
576
577 OutP->residentType = residentType;
578
579 OutP->maxusageType = maxusageType;
580
581 OutP->maxstackType = maxstackType;
582}
583
584/* Default implementation of processor_set_stack_usage */
585#ifdef MIG_EOPNOTSUPP
586kern_return_t __attribute__ ((weak))
587processor_set_stack_usage
588(
589 processor_set_t pset,
590 unsigned *total,
591 vm_size_t *space,
592 vm_size_t *resident,
593 vm_size_t *maxusage,
594 vm_offset_t *maxstack
595) { return MIG_EOPNOTSUPP; }
596#endif /* MIG_EOPNOTSUPP */
597
598/* Routine host_virtual_physical_table_info */
599mig_internalstatic void _Xhost_virtual_physical_table_info
600 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
601{
602 typedef struct {
603 mach_msg_header_t Head;
604 mach_msg_type_t infoCntType;
605 mach_msg_type_number_t infoCnt;
606 } Request;
607
608 typedef struct {
609 mach_msg_header_t Head;
610 mach_msg_type_t RetCodeType;
611 kern_return_t RetCode;
612 mach_msg_type_long_t infoType;
613 hash_info_bucket_t info[512];
614 } Reply;
615
616 Request *In0P = (Request *) InHeadP;
617 Reply *OutP = (Reply *) OutHeadP;
618 mig_external kern_return_t host_virtual_physical_table_info
619 (host_t host, hash_info_bucket_array_t *info, mach_msg_type_number_t *infoCnt);
620
621 boolean_t msgh_simple = msgh_simple;
622 const mach_msg_type_t infoCntCheck = {
623 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
624 /* msgt_size = */ 32,
625 /* msgt_number = */ 1,
626 /* msgt_inline = */ TRUE((boolean_t) 1),
627 /* msgt_longform = */ FALSE((boolean_t) 0),
628 /* msgt_deallocate = */ FALSE((boolean_t) 0),
629 /* msgt_unused = */ 0
630 };
631
632 const mach_msg_type_long_t infoType = {
633 {
634 /* msgt_name = */ 0,
635 /* msgt_size = */ 0,
636 /* msgt_number = */ 0,
637 /* msgt_inline = */ TRUE((boolean_t) 1),
638 /* msgt_longform = */ TRUE((boolean_t) 1),
639 /* msgt_deallocate = */ FALSE((boolean_t) 0),
640 /* msgt_unused = */ 0
641 },
642 /* msgtl_name = */ 2,
643 /* msgtl_size = */ 32,
644 /* msgtl_number = */ 512,
645 };
646
647 mach_msg_type_number_t infoCnt;
648
649 hash_info_bucket_t *infoP;
650
651#if TypeCheck1
652 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
653 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
654 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
655#endif /* TypeCheck */
656
657#if TypeCheck1
658 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)
)
659 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
660#endif /* TypeCheck */
661
662 infoP = OutP->info;
663 infoCnt = 512;
664 if (In0P->infoCnt < infoCnt)
665 infoCnt = In0P->infoCnt;
666
667 OutP->RetCode = host_virtual_physical_table_info(convert_port_to_host((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), &infoP, &infoCnt);
668 if (OutP->RetCode != KERN_SUCCESS0)
669 return;
670
671 msgh_simple = TRUE((boolean_t) 1);
672
673 OutP->infoType = infoType;
674 if (infoP != OutP->info) {
675 OutP->infoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
676 OutP->infoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
677 *((hash_info_bucket_t **)OutP->info) = infoP;
678 msgh_simple = FALSE((boolean_t) 0);
679 }
680
681 OutP->infoType.msgtl_number = infoCnt;
682 OutP->Head.msgh_size = 44 + ((OutP->infoType.msgtl_header.msgt_inline) ? 4 * infoCnt : sizeof(hash_info_bucket_t *));
683
684 if (!msgh_simple)
685 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
686}
687
688/* Default implementation of host_virtual_physical_table_info */
689#ifdef MIG_EOPNOTSUPP
690kern_return_t __attribute__ ((weak))
691host_virtual_physical_table_info
692(
693 host_t host,
694 hash_info_bucket_array_t *info,
695 mach_msg_type_number_t *infoCnt
696) { return MIG_EOPNOTSUPP; }
697#endif /* MIG_EOPNOTSUPP */
698
699/* Routine host_load_symbol_table */
700mig_internalstatic void _Xhost_load_symbol_table
701 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
702{
703 typedef struct {
704 mach_msg_header_t Head;
705 mach_msg_type_t taskType;
706 ipc_port_t task;
707 mach_msg_type_long_t nameType;
708 symtab_name_t name;
709 mach_msg_type_long_t symtabType;
710 vm_offset_t symtab;
711 } Request;
712
713 typedef struct {
714 mach_msg_header_t Head;
715 mach_msg_type_t RetCodeType;
716 kern_return_t RetCode;
717 } Reply;
718
719 Request *In0P = (Request *) InHeadP;
720 Reply *OutP = (Reply *) OutHeadP;
721 mig_external kern_return_t host_load_symbol_table
722 (host_t host, task_t task, symtab_name_t name, vm_offset_t symtab, mach_msg_type_number_t symtabCnt);
723
724 task_t task;
725
726#if TypeCheck1
727 if (mig_unlikely ((In0P->Head.msgh_size != 92) ||__builtin_expect (!! ((In0P->Head.msgh_size != 92) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
728 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 92) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
729 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
730#endif /* TypeCheck */
731
732#if TypeCheck1
733 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
)
734 (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
)
735 (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
)
736 (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
)
737 (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
)
)
738 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
739#endif /* TypeCheck */
740
741#if TypeCheck1
742 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)
743 (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)
744 (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)
745 (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)
746 (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)
)
747 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
748#endif /* TypeCheck */
749
750#if TypeCheck1
751 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)
752 (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)
753 (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)
754 (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)
)
755 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
756#endif /* TypeCheck */
757
758 task = convert_port_to_task(In0P->task);
759
760 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);
761 task_deallocate(task);
762 if (OutP->RetCode != KERN_SUCCESS0)
763 return;
764
765 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)))
)
766 ipc_port_release_send(In0P->task);
767}
768
769/* Default implementation of host_load_symbol_table */
770#ifdef MIG_EOPNOTSUPP
771kern_return_t __attribute__ ((weak))
772host_load_symbol_table
773(
774 host_t host,
775 task_t task,
776 symtab_name_t name,
777 vm_offset_t symtab,
778 mach_msg_type_number_t symtabCnt
779) { return MIG_EOPNOTSUPP; }
780#endif /* MIG_EOPNOTSUPP */
781
782/* Routine mach_port_kernel_object */
783mig_internalstatic void _Xmach_port_kernel_object
784 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
785{
786 typedef struct {
787 mach_msg_header_t Head;
788 mach_msg_type_t nameType;
789 mach_port_t name;
790 } Request;
791
792 typedef struct {
793 mach_msg_header_t Head;
794 mach_msg_type_t RetCodeType;
795 kern_return_t RetCode;
796 mach_msg_type_t object_typeType;
797 unsigned object_type;
798 mach_msg_type_t object_addrType;
799 vm_offset_t object_addr;
800 } Reply;
801
802 Request *In0P = (Request *) InHeadP;
803 Reply *OutP = (Reply *) OutHeadP;
804 mig_external kern_return_t mach_port_kernel_object
805 (ipc_space_t task, mach_port_t name, unsigned *object_type, vm_offset_t *object_addr);
806
807 const mach_msg_type_t nameCheck = {
808 /* msgt_name = */ 15,
809 /* msgt_size = */ 32,
810 /* msgt_number = */ 1,
811 /* msgt_inline = */ TRUE((boolean_t) 1),
812 /* msgt_longform = */ FALSE((boolean_t) 0),
813 /* msgt_deallocate = */ FALSE((boolean_t) 0),
814 /* msgt_unused = */ 0
815 };
816
817 const mach_msg_type_t object_typeType = {
818 /* msgt_name = */ 2,
819 /* msgt_size = */ 32,
820 /* msgt_number = */ 1,
821 /* msgt_inline = */ TRUE((boolean_t) 1),
822 /* msgt_longform = */ FALSE((boolean_t) 0),
823 /* msgt_deallocate = */ FALSE((boolean_t) 0),
824 /* msgt_unused = */ 0
825 };
826
827 const mach_msg_type_t object_addrType = {
828 /* msgt_name = */ 2,
829 /* msgt_size = */ 32,
830 /* msgt_number = */ 1,
831 /* msgt_inline = */ TRUE((boolean_t) 1),
832 /* msgt_longform = */ FALSE((boolean_t) 0),
833 /* msgt_deallocate = */ FALSE((boolean_t) 0),
834 /* msgt_unused = */ 0
835 };
836
837 ipc_space_t task;
838
839#if TypeCheck1
840 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
841 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
842 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
843#endif /* TypeCheck */
844
845#if TypeCheck1
846 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)
)
847 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
848#endif /* TypeCheck */
849
850 task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
851
852 OutP->RetCode = mach_port_kernel_object(task, In0P->name, &OutP->object_type, &OutP->object_addr);
853 space_deallocate(task);
854 if (OutP->RetCode != KERN_SUCCESS0)
855 return;
856
857 OutP->Head.msgh_size = 48;
858
859 OutP->object_typeType = object_typeType;
860
861 OutP->object_addrType = object_addrType;
862}
863
864/* Default implementation of mach_port_kernel_object */
865#ifdef MIG_EOPNOTSUPP
866kern_return_t __attribute__ ((weak))
867mach_port_kernel_object
868(
869 ipc_space_t task,
870 mach_port_t name,
871 unsigned *object_type,
872 vm_offset_t *object_addr
873) { return MIG_EOPNOTSUPP; }
874#endif /* MIG_EOPNOTSUPP */
875
876/* Routine mach_vm_region_info */
877mig_internalstatic void _Xmach_vm_region_info
878 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
879{
880 typedef struct {
881 mach_msg_header_t Head;
882 mach_msg_type_t addressType;
883 vm_address_t address;
884 } Request;
885
886 typedef struct {
887 mach_msg_header_t Head;
888 mach_msg_type_t RetCodeType;
889 kern_return_t RetCode;
890 mach_msg_type_t regionType;
891 vm_region_info_t region;
892 mach_msg_type_t objectType;
893 ipc_port_t object;
894 } Reply;
895
896 Request *In0P = (Request *) InHeadP;
897 Reply *OutP = (Reply *) OutHeadP;
898 mig_external kern_return_t mach_vm_region_info
899 (vm_map_t task, vm_address_t address, vm_region_info_t *region, ipc_port_t *object);
900
901 const mach_msg_type_t addressCheck = {
902 /* msgt_name = */ 2,
903 /* msgt_size = */ 32,
904 /* msgt_number = */ 1,
905 /* msgt_inline = */ TRUE((boolean_t) 1),
906 /* msgt_longform = */ FALSE((boolean_t) 0),
907 /* msgt_deallocate = */ FALSE((boolean_t) 0),
908 /* msgt_unused = */ 0
909 };
910
911 const mach_msg_type_t regionType = {
912 /* msgt_name = */ 2,
913 /* msgt_size = */ 32,
914 /* msgt_number = */ 11,
915 /* msgt_inline = */ TRUE((boolean_t) 1),
916 /* msgt_longform = */ FALSE((boolean_t) 0),
917 /* msgt_deallocate = */ FALSE((boolean_t) 0),
918 /* msgt_unused = */ 0
919 };
920
921 const mach_msg_type_t objectType = {
922 /* msgt_name = */ 17,
923 /* msgt_size = */ 32,
924 /* msgt_number = */ 1,
925 /* msgt_inline = */ TRUE((boolean_t) 1),
926 /* msgt_longform = */ FALSE((boolean_t) 0),
927 /* msgt_deallocate = */ FALSE((boolean_t) 0),
928 /* msgt_unused = */ 0
929 };
930
931 vm_map_t task;
932
933#if TypeCheck1
934 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
935 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
936 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
937#endif /* TypeCheck */
938
939#if TypeCheck1
940 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)
)
941 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
942#endif /* TypeCheck */
943
944 task = convert_port_to_map((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
945
946 OutP->RetCode = mach_vm_region_info(task, In0P->address, &OutP->region, &OutP->object);
947 vm_map_deallocate(task);
948 if (OutP->RetCode != KERN_SUCCESS0)
949 return;
950
951 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
952 OutP->Head.msgh_size = 88;
953
954 OutP->regionType = regionType;
955
956 OutP->objectType = objectType;
957}
958
959/* Default implementation of mach_vm_region_info */
960#ifdef MIG_EOPNOTSUPP
961kern_return_t __attribute__ ((weak))
962mach_vm_region_info
963(
964 vm_map_t task,
965 vm_address_t address,
966 vm_region_info_t *region,
967 ipc_port_t *object
968) { return MIG_EOPNOTSUPP; }
969#endif /* MIG_EOPNOTSUPP */
970
971/* Routine mach_vm_object_info */
972mig_internalstatic void _Xmach_vm_object_info
973 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
974{
975 typedef struct {
976 mach_msg_header_t Head;
977 } Request;
978
979 typedef struct {
980 mach_msg_header_t Head;
981 mach_msg_type_t RetCodeType;
982 kern_return_t RetCode;
983 mach_msg_type_t infoType;
984 vm_object_info_t info;
985 mach_msg_type_t shadowType;
986 ipc_port_t shadow;
987 mach_msg_type_t copyType;
988 ipc_port_t copy;
989 } Reply;
990
991 Request *In0P = (Request *) InHeadP;
992 Reply *OutP = (Reply *) OutHeadP;
993 mig_external kern_return_t mach_vm_object_info
994 (vm_object_t object, vm_object_info_t *info, ipc_port_t *shadow, ipc_port_t *copy);
995
996 const mach_msg_type_t infoType = {
997 /* msgt_name = */ 2,
998 /* msgt_size = */ 32,
999 /* msgt_number = */ 14,
1000 /* msgt_inline = */ TRUE((boolean_t) 1),
1001 /* msgt_longform = */ FALSE((boolean_t) 0),
1002 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1003 /* msgt_unused = */ 0
1004 };
1005
1006 const mach_msg_type_t shadowType = {
1007 /* msgt_name = */ 17,
1008 /* msgt_size = */ 32,
1009 /* msgt_number = */ 1,
1010 /* msgt_inline = */ TRUE((boolean_t) 1),
1011 /* msgt_longform = */ FALSE((boolean_t) 0),
1012 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1013 /* msgt_unused = */ 0
1014 };
1015
1016 const mach_msg_type_t copyType = {
1017 /* msgt_name = */ 17,
1018 /* msgt_size = */ 32,
1019 /* msgt_number = */ 1,
1020 /* msgt_inline = */ TRUE((boolean_t) 1),
1021 /* msgt_longform = */ FALSE((boolean_t) 0),
1022 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1023 /* msgt_unused = */ 0
1024 };
1025
1026 vm_object_t object;
1027
1028#if TypeCheck1
1029 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1030 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1031 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1032#endif /* TypeCheck */
1033
1034 object = vm_object_lookup_name((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1035
1036 OutP->RetCode = mach_vm_object_info(object, &OutP->info, &OutP->shadow, &OutP->copy);
1037 vm_object_deallocate(object);
1038 if (OutP->RetCode != KERN_SUCCESS0)
1039 return;
1040
1041 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1042 OutP->Head.msgh_size = 108;
1043
1044 OutP->infoType = infoType;
1045
1046 OutP->shadowType = shadowType;
1047
1048 OutP->copyType = copyType;
1049}
1050
1051/* Default implementation of mach_vm_object_info */
1052#ifdef MIG_EOPNOTSUPP
1053kern_return_t __attribute__ ((weak))
1054mach_vm_object_info
1055(
1056 vm_object_t object,
1057 vm_object_info_t *info,
1058 ipc_port_t *shadow,
1059 ipc_port_t *copy
1060) { return MIG_EOPNOTSUPP; }
1061#endif /* MIG_EOPNOTSUPP */
1062
1063/* Routine mach_vm_object_pages */
1064mig_internalstatic void _Xmach_vm_object_pages
1065 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1066{
1067 typedef struct {
1068 mach_msg_header_t Head;
1069 mach_msg_type_t pagesCntType;
1070 mach_msg_type_number_t pagesCnt;
1071 } Request;
1072
1073 typedef struct {
1074 mach_msg_header_t Head;
1075 mach_msg_type_t RetCodeType;
1076 kern_return_t RetCode;
1077 mach_msg_type_long_t pagesType;
1078 vm_page_info_t pages[85];
1079 } Reply;
1080
1081 Request *In0P = (Request *) InHeadP;
1082 Reply *OutP = (Reply *) OutHeadP;
1083 mig_external kern_return_t mach_vm_object_pages
1084 (vm_object_t object, vm_page_info_array_t *pages, mach_msg_type_number_t *pagesCnt);
1085
1086 boolean_t msgh_simple = msgh_simple;
1087 const mach_msg_type_t pagesCntCheck = {
1088 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
1089 /* msgt_size = */ 32,
1090 /* msgt_number = */ 1,
1091 /* msgt_inline = */ TRUE((boolean_t) 1),
1092 /* msgt_longform = */ FALSE((boolean_t) 0),
1093 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1094 /* msgt_unused = */ 0
1095 };
1096
1097 const mach_msg_type_long_t pagesType = {
1098 {
1099 /* msgt_name = */ 0,
1100 /* msgt_size = */ 0,
1101 /* msgt_number = */ 0,
1102 /* msgt_inline = */ TRUE((boolean_t) 1),
1103 /* msgt_longform = */ TRUE((boolean_t) 1),
1104 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1105 /* msgt_unused = */ 0
1106 },
1107 /* msgtl_name = */ 2,
1108 /* msgtl_size = */ 32,
1109 /* msgtl_number = */ 510,
1110 };
1111
1112 vm_object_t object;
1113 mach_msg_type_number_t pagesCnt;
1114
1115 vm_page_info_t *pagesP;
1116
1117#if TypeCheck1
1118 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1119 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1120 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1121#endif /* TypeCheck */
1122
1123#if TypeCheck1
1124 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)
)
1125 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1126#endif /* TypeCheck */
1127
1128 object = vm_object_lookup_name((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port);
1129
1130 pagesP = OutP->pages;
1131 pagesCnt = 85;
1132 if (In0P->pagesCnt < pagesCnt)
1133 pagesCnt = In0P->pagesCnt;
1134
1135 OutP->RetCode = mach_vm_object_pages(object, &pagesP, &pagesCnt);
1136 vm_object_deallocate(object);
1137 if (OutP->RetCode != KERN_SUCCESS0)
1138 return;
1139
1140 msgh_simple = TRUE((boolean_t) 1);
1141
1142 OutP->pagesType = pagesType;
1143 if (pagesP != OutP->pages) {
1144 OutP->pagesType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1145 OutP->pagesType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
1146 *((vm_page_info_t **)OutP->pages) = pagesP;
1147 msgh_simple = FALSE((boolean_t) 0);
1148 }
1149
1150 OutP->pagesType.msgtl_number = 6 * pagesCnt;
1151 OutP->Head.msgh_size = 44 + ((OutP->pagesType.msgtl_header.msgt_inline) ? 24 * pagesCnt : sizeof(vm_page_info_t *));
1152
1153 if (!msgh_simple)
1154 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1155}
1156
1157/* Default implementation of mach_vm_object_pages */
1158#ifdef MIG_EOPNOTSUPP
1159kern_return_t __attribute__ ((weak))
1160mach_vm_object_pages
1161(
1162 vm_object_t object,
1163 vm_page_info_array_t *pages,
1164 mach_msg_type_number_t *pagesCnt
1165) { return MIG_EOPNOTSUPP; }
1166#endif /* MIG_EOPNOTSUPP */
1167
1168/* Routine host_slab_info */
1169mig_internalstatic void _Xhost_slab_info
1170 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1171{
1172 typedef struct {
1173 mach_msg_header_t Head;
1174 mach_msg_type_t infoCntType;
1175 mach_msg_type_number_t infoCnt;
1176 } Request;
1177
1178 typedef struct {
1179 mach_msg_header_t Head;
1180 mach_msg_type_t RetCodeType;
1181 kern_return_t RetCode;
1182 mach_msg_type_long_t infoType;
1183 cache_info_t info[26];
1184 } Reply;
1185
1186 Request *In0P = (Request *) InHeadP;
1187 Reply *OutP = (Reply *) OutHeadP;
1188 mig_external kern_return_t host_slab_info
1189 (host_t host, cache_info_array_t *info, mach_msg_type_number_t *infoCnt);
1190
1191 boolean_t msgh_simple = msgh_simple;
1192 const mach_msg_type_t infoCntCheck = {
1193 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
1194 /* msgt_size = */ 32,
1195 /* msgt_number = */ 1,
1196 /* msgt_inline = */ TRUE((boolean_t) 1),
1197 /* msgt_longform = */ FALSE((boolean_t) 0),
1198 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1199 /* msgt_unused = */ 0
1200 };
1201
1202 const mach_msg_type_long_t infoType = {
1203 {
1204 /* msgt_name = */ 0,
1205 /* msgt_size = */ 0,
1206 /* msgt_number = */ 0,
1207 /* msgt_inline = */ TRUE((boolean_t) 1),
1208 /* msgt_longform = */ TRUE((boolean_t) 1),
1209 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1210 /* msgt_unused = */ 0
1211 },
1212 /* msgtl_name = */ 2,
1213 /* msgtl_size = */ 32,
1214 /* msgtl_number = */ 494,
1215 };
1216
1217 mach_msg_type_number_t infoCnt;
1218
1219 cache_info_t *infoP;
1220
1221#if TypeCheck1
1222 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
1223 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
1224 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1225#endif /* TypeCheck */
1226
1227#if TypeCheck1
1228 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)
)
1229 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
1230#endif /* TypeCheck */
1231
1232 infoP = OutP->info;
1233 infoCnt = 26;
1234 if (In0P->infoCnt < infoCnt)
1235 infoCnt = In0P->infoCnt;
1236
1237 OutP->RetCode = host_slab_info(convert_port_to_host((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port), &infoP, &infoCnt);
1238 if (OutP->RetCode != KERN_SUCCESS0)
1239 return;
1240
1241 msgh_simple = TRUE((boolean_t) 1);
1242
1243 OutP->infoType = infoType;
1244 if (infoP != OutP->info) {
1245 OutP->infoType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
1246 OutP->infoType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
1247 *((cache_info_t **)OutP->info) = infoP;
1248 msgh_simple = FALSE((boolean_t) 0);
1249 }
1250
1251 OutP->infoType.msgtl_number = 19 * infoCnt;
1252 OutP->Head.msgh_size = 44 + ((OutP->infoType.msgtl_header.msgt_inline) ? 76 * infoCnt : sizeof(cache_info_t *));
1253
1254 if (!msgh_simple)
1255 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
1256}
1257
1258/* Default implementation of host_slab_info */
1259#ifdef MIG_EOPNOTSUPP
1260kern_return_t __attribute__ ((weak))
1261host_slab_info
1262(
1263 host_t host,
1264 cache_info_array_t *info,
1265 mach_msg_type_number_t *infoCnt
1266) { return MIG_EOPNOTSUPP; }
1267#endif /* MIG_EOPNOTSUPP */
1268
1269mig_routine_t mach_debug_server_routines[] = {
1270 0,
1271 0,
1272 0,
1273 0,
1274 0,
1275 0,
1276 0,
1277 _Xmach_port_get_srights,
1278 0,
1279 _Xhost_ipc_marequest_info,
1280 0,
1281 _Xmach_port_dnrequest_info,
1282 0,
1283 0,
1284 _Xhost_stack_usage,
1285 _Xprocessor_set_stack_usage,
1286 _Xhost_virtual_physical_table_info,
1287 _Xhost_load_symbol_table,
1288 _Xmach_port_kernel_object,
1289 _Xmach_vm_region_info,
1290 _Xmach_vm_object_info,
1291 _Xmach_vm_object_pages,
1292 _Xhost_slab_info,
1293};
1294
1295mig_external boolean_t mach_debug_server
1296 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
1297{
1298 mach_msg_header_t *InP = InHeadP;
1299 mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP;
1300
1301 const mach_msg_type_t RetCodeType = {
1302 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
1303 /* msgt_size = */ 32,
1304 /* msgt_number = */ 1,
1305 /* msgt_inline = */ TRUE((boolean_t) 1),
1306 /* msgt_longform = */ FALSE((boolean_t) 0),
1307 /* msgt_deallocate = */ FALSE((boolean_t) 0),
1308 /* msgt_unused = */ 0
1309 };
1310
1311 mig_routine_t routine;
1312
1313 OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)(((((InP->msgh_bits) & 0x0000ff00) >> 8)) | ((0)
<< 8))
;
1314 OutP->Head.msgh_size = sizeof *OutP;
1315 OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_local_port;
1316 OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0);
1317 OutP->Head.msgh_seqno = 0;
1318 OutP->Head.msgh_id = InP->msgh_id + 100;
1319
1320 OutP->RetCodeType = RetCodeType;
1321
1322 if ((InP->msgh_id > 3022) || (InP->msgh_id < 3000) ||
1323 ((routine = mach_debug_server_routines[InP->msgh_id - 3000]) == 0)) {
1324 OutP->RetCode = MIG_BAD_ID-303;
1325 return FALSE((boolean_t) 0);
1326 }
1327 (*routine) (InP, &OutP->Head);
1328 return TRUE((boolean_t) 1);
1329}
1330
1331mig_external mig_routine_t mach_debug_server_routine
1332 (const mach_msg_header_t *InHeadP)
1333{
1334 int msgh_id;
1335
1336 msgh_id = InHeadP->msgh_id - 3000;
1337
1338 if ((msgh_id > 22) || (msgh_id < 0))
1339 return 0;
1340
1341 return mach_debug_server_routines[msgh_id];
1342}
1343