1 | /* |
2 | * IDENTIFICATION: |
3 | * stub generated Tue Apr 9 11:33:41 2019 |
4 | * with a MiG generated by bootstrap_cmds-96.20.2.200.4 |
5 | * OPTIONS: |
6 | * KernelServer |
7 | */ |
8 | |
9 | /* Module processor */ |
10 | |
11 | #define __MIG_check__Request__processor_subsystem__ 1 |
12 | |
13 | #include "processor_server.h" |
14 | |
15 | #ifndef mig_internal |
16 | #define mig_internal static __inline__ |
17 | #endif /* mig_internal */ |
18 | |
19 | #ifndef mig_external |
20 | #define mig_external |
21 | #endif /* mig_external */ |
22 | |
23 | #if !defined(__MigTypeCheck) && defined(TypeCheck) |
24 | #define __MigTypeCheck TypeCheck /* Legacy setting */ |
25 | #endif /* !defined(__MigTypeCheck) */ |
26 | |
27 | #if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) |
28 | #define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ |
29 | #endif /* !defined(__MigKernelSpecificCode) */ |
30 | |
31 | #ifndef LimitCheck |
32 | #define LimitCheck 0 |
33 | #endif /* LimitCheck */ |
34 | |
35 | #ifndef min |
36 | #define min(a,b) ( ((a) < (b))? (a): (b) ) |
37 | #endif /* min */ |
38 | |
39 | #if !defined(_WALIGN_) |
40 | #define _WALIGN_(x) (((x) + 3) & ~3) |
41 | #endif /* !defined(_WALIGN_) */ |
42 | |
43 | #if !defined(_WALIGNSZ_) |
44 | #define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) |
45 | #endif /* !defined(_WALIGNSZ_) */ |
46 | |
47 | #ifndef UseStaticTemplates |
48 | #define UseStaticTemplates 0 |
49 | #endif /* UseStaticTemplates */ |
50 | |
51 | #ifndef __DeclareRcvRpc |
52 | #define __DeclareRcvRpc(_NUM_, _NAME_) |
53 | #endif /* __DeclareRcvRpc */ |
54 | |
55 | #ifndef __BeforeRcvRpc |
56 | #define __BeforeRcvRpc(_NUM_, _NAME_) |
57 | #endif /* __BeforeRcvRpc */ |
58 | |
59 | #ifndef __AfterRcvRpc |
60 | #define __AfterRcvRpc(_NUM_, _NAME_) |
61 | #endif /* __AfterRcvRpc */ |
62 | |
63 | #ifndef __DeclareRcvSimple |
64 | #define __DeclareRcvSimple(_NUM_, _NAME_) |
65 | #endif /* __DeclareRcvSimple */ |
66 | |
67 | #ifndef __BeforeRcvSimple |
68 | #define __BeforeRcvSimple(_NUM_, _NAME_) |
69 | #endif /* __BeforeRcvSimple */ |
70 | |
71 | #ifndef __AfterRcvSimple |
72 | #define __AfterRcvSimple(_NUM_, _NAME_) |
73 | #endif /* __AfterRcvSimple */ |
74 | |
75 | #define novalue void |
76 | |
77 | #if __MigKernelSpecificCode |
78 | #define msgh_request_port msgh_remote_port |
79 | #define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_REMOTE(bits) |
80 | #define msgh_reply_port msgh_local_port |
81 | #define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_LOCAL(bits) |
82 | #else |
83 | #define msgh_request_port msgh_local_port |
84 | #define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits) |
85 | #define msgh_reply_port msgh_remote_port |
86 | #define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits) |
87 | #endif /* __MigKernelSpecificCode */ |
88 | |
89 | #define MIG_RETURN_ERROR(X, code) {\ |
90 | ((mig_reply_error_t *)X)->RetCode = code;\ |
91 | ((mig_reply_error_t *)X)->NDR = NDR_record;\ |
92 | return;\ |
93 | } |
94 | |
95 | /* Forward Declarations */ |
96 | |
97 | |
98 | mig_internal novalue _Xprocessor_start |
99 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); |
100 | |
101 | mig_internal novalue _Xprocessor_exit |
102 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); |
103 | |
104 | mig_internal novalue _Xprocessor_info |
105 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); |
106 | |
107 | mig_internal novalue _Xprocessor_control |
108 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); |
109 | |
110 | mig_internal novalue _Xprocessor_assign |
111 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); |
112 | |
113 | mig_internal novalue _Xprocessor_get_assignment |
114 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); |
115 | |
116 | |
117 | #if ( __MigTypeCheck ) |
118 | #if __MIG_check__Request__processor_subsystem__ |
119 | #if !defined(__MIG_check__Request__processor_start_t__defined) |
120 | #define __MIG_check__Request__processor_start_t__defined |
121 | |
122 | mig_internal kern_return_t __MIG_check__Request__processor_start_t(__attribute__((__unused__)) __Request__processor_start_t *In0P) |
123 | { |
124 | |
125 | typedef __Request__processor_start_t __Request; |
126 | #if __MigTypeCheck |
127 | if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
128 | (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
129 | return MIG_BAD_ARGUMENTS; |
130 | #endif /* __MigTypeCheck */ |
131 | |
132 | return MACH_MSG_SUCCESS; |
133 | } |
134 | #endif /* !defined(__MIG_check__Request__processor_start_t__defined) */ |
135 | #endif /* __MIG_check__Request__processor_subsystem__ */ |
136 | #endif /* ( __MigTypeCheck ) */ |
137 | |
138 | |
139 | /* Routine processor_start */ |
140 | mig_internal novalue _Xprocessor_start |
141 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
142 | { |
143 | |
144 | #ifdef __MigPackStructs |
145 | #pragma pack(4) |
146 | #endif |
147 | typedef struct { |
148 | mach_msg_header_t Head; |
149 | mach_msg_trailer_t trailer; |
150 | } Request __attribute__((unused)); |
151 | #ifdef __MigPackStructs |
152 | #pragma pack() |
153 | #endif |
154 | typedef __Request__processor_start_t __Request; |
155 | typedef __Reply__processor_start_t Reply __attribute__((unused)); |
156 | |
157 | /* |
158 | * typedef struct { |
159 | * mach_msg_header_t Head; |
160 | * NDR_record_t NDR; |
161 | * kern_return_t RetCode; |
162 | * } mig_reply_error_t; |
163 | */ |
164 | |
165 | Request *In0P = (Request *) InHeadP; |
166 | Reply *OutP = (Reply *) OutHeadP; |
167 | #ifdef __MIG_check__Request__processor_start_t__defined |
168 | kern_return_t check_result; |
169 | #endif /* __MIG_check__Request__processor_start_t__defined */ |
170 | |
171 | #if __MigKernelSpecificCode |
172 | #else |
173 | #endif /* __MigKernelSpecificCode */ |
174 | __DeclareRcvRpc(3000, "processor_start" ) |
175 | __BeforeRcvRpc(3000, "processor_start" ) |
176 | |
177 | #if defined(__MIG_check__Request__processor_start_t__defined) |
178 | check_result = __MIG_check__Request__processor_start_t((__Request *)In0P); |
179 | if (check_result != MACH_MSG_SUCCESS) |
180 | { MIG_RETURN_ERROR(OutP, check_result); } |
181 | #endif /* defined(__MIG_check__Request__processor_start_t__defined) */ |
182 | |
183 | OutP->RetCode = processor_start(convert_port_to_processor(In0P->Head.msgh_request_port)); |
184 | #if __MigKernelSpecificCode |
185 | #endif /* __MigKernelSpecificCode */ |
186 | |
187 | OutP->NDR = NDR_record; |
188 | |
189 | |
190 | __AfterRcvRpc(3000, "processor_start" ) |
191 | } |
192 | |
193 | #if ( __MigTypeCheck ) |
194 | #if __MIG_check__Request__processor_subsystem__ |
195 | #if !defined(__MIG_check__Request__processor_exit_t__defined) |
196 | #define __MIG_check__Request__processor_exit_t__defined |
197 | |
198 | mig_internal kern_return_t __MIG_check__Request__processor_exit_t(__attribute__((__unused__)) __Request__processor_exit_t *In0P) |
199 | { |
200 | |
201 | typedef __Request__processor_exit_t __Request; |
202 | #if __MigTypeCheck |
203 | if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
204 | (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
205 | return MIG_BAD_ARGUMENTS; |
206 | #endif /* __MigTypeCheck */ |
207 | |
208 | return MACH_MSG_SUCCESS; |
209 | } |
210 | #endif /* !defined(__MIG_check__Request__processor_exit_t__defined) */ |
211 | #endif /* __MIG_check__Request__processor_subsystem__ */ |
212 | #endif /* ( __MigTypeCheck ) */ |
213 | |
214 | |
215 | /* Routine processor_exit */ |
216 | mig_internal novalue _Xprocessor_exit |
217 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
218 | { |
219 | |
220 | #ifdef __MigPackStructs |
221 | #pragma pack(4) |
222 | #endif |
223 | typedef struct { |
224 | mach_msg_header_t Head; |
225 | mach_msg_trailer_t trailer; |
226 | } Request __attribute__((unused)); |
227 | #ifdef __MigPackStructs |
228 | #pragma pack() |
229 | #endif |
230 | typedef __Request__processor_exit_t __Request; |
231 | typedef __Reply__processor_exit_t Reply __attribute__((unused)); |
232 | |
233 | /* |
234 | * typedef struct { |
235 | * mach_msg_header_t Head; |
236 | * NDR_record_t NDR; |
237 | * kern_return_t RetCode; |
238 | * } mig_reply_error_t; |
239 | */ |
240 | |
241 | Request *In0P = (Request *) InHeadP; |
242 | Reply *OutP = (Reply *) OutHeadP; |
243 | #ifdef __MIG_check__Request__processor_exit_t__defined |
244 | kern_return_t check_result; |
245 | #endif /* __MIG_check__Request__processor_exit_t__defined */ |
246 | |
247 | #if __MigKernelSpecificCode |
248 | #else |
249 | #endif /* __MigKernelSpecificCode */ |
250 | __DeclareRcvRpc(3001, "processor_exit" ) |
251 | __BeforeRcvRpc(3001, "processor_exit" ) |
252 | |
253 | #if defined(__MIG_check__Request__processor_exit_t__defined) |
254 | check_result = __MIG_check__Request__processor_exit_t((__Request *)In0P); |
255 | if (check_result != MACH_MSG_SUCCESS) |
256 | { MIG_RETURN_ERROR(OutP, check_result); } |
257 | #endif /* defined(__MIG_check__Request__processor_exit_t__defined) */ |
258 | |
259 | OutP->RetCode = processor_exit(convert_port_to_processor(In0P->Head.msgh_request_port)); |
260 | #if __MigKernelSpecificCode |
261 | #endif /* __MigKernelSpecificCode */ |
262 | |
263 | OutP->NDR = NDR_record; |
264 | |
265 | |
266 | __AfterRcvRpc(3001, "processor_exit" ) |
267 | } |
268 | |
269 | #if ( __MigTypeCheck ) |
270 | #if __MIG_check__Request__processor_subsystem__ |
271 | #if !defined(__MIG_check__Request__processor_info_t__defined) |
272 | #define __MIG_check__Request__processor_info_t__defined |
273 | |
274 | mig_internal kern_return_t __MIG_check__Request__processor_info_t(__attribute__((__unused__)) __Request__processor_info_t *In0P) |
275 | { |
276 | |
277 | typedef __Request__processor_info_t __Request; |
278 | #if __MigTypeCheck |
279 | if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
280 | (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
281 | return MIG_BAD_ARGUMENTS; |
282 | #endif /* __MigTypeCheck */ |
283 | |
284 | return MACH_MSG_SUCCESS; |
285 | } |
286 | #endif /* !defined(__MIG_check__Request__processor_info_t__defined) */ |
287 | #endif /* __MIG_check__Request__processor_subsystem__ */ |
288 | #endif /* ( __MigTypeCheck ) */ |
289 | |
290 | |
291 | /* Routine processor_info */ |
292 | mig_internal novalue _Xprocessor_info |
293 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
294 | { |
295 | |
296 | #ifdef __MigPackStructs |
297 | #pragma pack(4) |
298 | #endif |
299 | typedef struct { |
300 | mach_msg_header_t Head; |
301 | NDR_record_t NDR; |
302 | processor_flavor_t flavor; |
303 | mach_msg_type_number_t processor_info_outCnt; |
304 | mach_msg_trailer_t trailer; |
305 | } Request __attribute__((unused)); |
306 | #ifdef __MigPackStructs |
307 | #pragma pack() |
308 | #endif |
309 | typedef __Request__processor_info_t __Request; |
310 | typedef __Reply__processor_info_t Reply __attribute__((unused)); |
311 | |
312 | /* |
313 | * typedef struct { |
314 | * mach_msg_header_t Head; |
315 | * NDR_record_t NDR; |
316 | * kern_return_t RetCode; |
317 | * } mig_reply_error_t; |
318 | */ |
319 | |
320 | Request *In0P = (Request *) InHeadP; |
321 | Reply *OutP = (Reply *) OutHeadP; |
322 | #ifdef __MIG_check__Request__processor_info_t__defined |
323 | kern_return_t check_result; |
324 | #endif /* __MIG_check__Request__processor_info_t__defined */ |
325 | |
326 | #if __MigKernelSpecificCode |
327 | #if UseStaticTemplates |
328 | const static mach_msg_port_descriptor_t hostTemplate = { |
329 | /* name = */ MACH_PORT_NULL, |
330 | /* pad1 = */ 0, |
331 | /* pad2 = */ 0, |
332 | /* disp = */ 17, |
333 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
334 | }; |
335 | #endif /* UseStaticTemplates */ |
336 | |
337 | #else |
338 | #if UseStaticTemplates |
339 | const static mach_msg_port_descriptor_t hostTemplate = { |
340 | /* name = */ MACH_PORT_NULL, |
341 | /* pad1 = */ 0, |
342 | /* pad2 = */ 0, |
343 | /* disp = */ 19, |
344 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
345 | }; |
346 | #endif /* UseStaticTemplates */ |
347 | |
348 | #endif /* __MigKernelSpecificCode */ |
349 | kern_return_t RetCode; |
350 | host_t host; |
351 | |
352 | __DeclareRcvRpc(3002, "processor_info" ) |
353 | __BeforeRcvRpc(3002, "processor_info" ) |
354 | |
355 | #if defined(__MIG_check__Request__processor_info_t__defined) |
356 | check_result = __MIG_check__Request__processor_info_t((__Request *)In0P); |
357 | if (check_result != MACH_MSG_SUCCESS) |
358 | { MIG_RETURN_ERROR(OutP, check_result); } |
359 | #endif /* defined(__MIG_check__Request__processor_info_t__defined) */ |
360 | |
361 | #if UseStaticTemplates |
362 | OutP->host = hostTemplate; |
363 | #else /* UseStaticTemplates */ |
364 | #if __MigKernelSpecificCode |
365 | OutP->host.disposition = 17; |
366 | #else |
367 | OutP->host.disposition = 19; |
368 | #endif /* __MigKernelSpecificCode */ |
369 | #if !(defined(KERNEL) && defined(__LP64__)) |
370 | OutP->host.pad1 = 0; |
371 | #endif |
372 | OutP->host.pad2 = 0; |
373 | OutP->host.type = MACH_MSG_PORT_DESCRIPTOR; |
374 | #if defined(KERNEL) |
375 | OutP->host.pad_end = 0; |
376 | #endif |
377 | #endif /* UseStaticTemplates */ |
378 | |
379 | |
380 | OutP->processor_info_outCnt = 12; |
381 | if (In0P->processor_info_outCnt < OutP->processor_info_outCnt) |
382 | OutP->processor_info_outCnt = In0P->processor_info_outCnt; |
383 | |
384 | RetCode = processor_info(convert_port_to_processor(In0P->Head.msgh_request_port), In0P->flavor, &host, OutP->processor_info_out, &OutP->processor_info_outCnt); |
385 | if (RetCode != KERN_SUCCESS) { |
386 | MIG_RETURN_ERROR(OutP, RetCode); |
387 | } |
388 | #if __MigKernelSpecificCode |
389 | #endif /* __MigKernelSpecificCode */ |
390 | OutP->host.name = (mach_port_t)convert_host_to_port(host); |
391 | |
392 | |
393 | OutP->NDR = NDR_record; |
394 | |
395 | OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply) - 48) + (((4 * OutP->processor_info_outCnt))); |
396 | |
397 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; |
398 | OutP->msgh_body.msgh_descriptor_count = 1; |
399 | __AfterRcvRpc(3002, "processor_info" ) |
400 | } |
401 | |
402 | #if ( __MigTypeCheck ) |
403 | #if __MIG_check__Request__processor_subsystem__ |
404 | #if !defined(__MIG_check__Request__processor_control_t__defined) |
405 | #define __MIG_check__Request__processor_control_t__defined |
406 | |
407 | mig_internal kern_return_t __MIG_check__Request__processor_control_t(__attribute__((__unused__)) __Request__processor_control_t *In0P) |
408 | { |
409 | |
410 | typedef __Request__processor_control_t __Request; |
411 | #if __MigTypeCheck |
412 | unsigned int msgh_size; |
413 | #endif /* __MigTypeCheck */ |
414 | |
415 | #if __MigTypeCheck |
416 | msgh_size = In0P->Head.msgh_size; |
417 | if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
418 | (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 48)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) |
419 | return MIG_BAD_ARGUMENTS; |
420 | #endif /* __MigTypeCheck */ |
421 | |
422 | #if defined(__NDR_convert__int_rep__Request__processor_control_t__processor_cmdCnt__defined) |
423 | if (In0P->NDR.int_rep != NDR_record.int_rep) |
424 | __NDR_convert__int_rep__Request__processor_control_t__processor_cmdCnt(&In0P->processor_cmdCnt, In0P->NDR.int_rep); |
425 | #endif /* __NDR_convert__int_rep__Request__processor_control_t__processor_cmdCnt__defined */ |
426 | #if __MigTypeCheck |
427 | if ( In0P->processor_cmdCnt > 12 ) |
428 | return MIG_BAD_ARGUMENTS; |
429 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 48)) / 4 < In0P->processor_cmdCnt) || |
430 | (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 48) + (4 * In0P->processor_cmdCnt))) |
431 | return MIG_BAD_ARGUMENTS; |
432 | #endif /* __MigTypeCheck */ |
433 | |
434 | return MACH_MSG_SUCCESS; |
435 | } |
436 | #endif /* !defined(__MIG_check__Request__processor_control_t__defined) */ |
437 | #endif /* __MIG_check__Request__processor_subsystem__ */ |
438 | #endif /* ( __MigTypeCheck ) */ |
439 | |
440 | |
441 | /* Routine processor_control */ |
442 | mig_internal novalue _Xprocessor_control |
443 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
444 | { |
445 | |
446 | #ifdef __MigPackStructs |
447 | #pragma pack(4) |
448 | #endif |
449 | typedef struct { |
450 | mach_msg_header_t Head; |
451 | NDR_record_t NDR; |
452 | mach_msg_type_number_t processor_cmdCnt; |
453 | integer_t processor_cmd[12]; |
454 | mach_msg_trailer_t trailer; |
455 | } Request __attribute__((unused)); |
456 | #ifdef __MigPackStructs |
457 | #pragma pack() |
458 | #endif |
459 | typedef __Request__processor_control_t __Request; |
460 | typedef __Reply__processor_control_t Reply __attribute__((unused)); |
461 | |
462 | /* |
463 | * typedef struct { |
464 | * mach_msg_header_t Head; |
465 | * NDR_record_t NDR; |
466 | * kern_return_t RetCode; |
467 | * } mig_reply_error_t; |
468 | */ |
469 | |
470 | Request *In0P = (Request *) InHeadP; |
471 | Reply *OutP = (Reply *) OutHeadP; |
472 | #ifdef __MIG_check__Request__processor_control_t__defined |
473 | kern_return_t check_result; |
474 | #endif /* __MIG_check__Request__processor_control_t__defined */ |
475 | |
476 | #if __MigKernelSpecificCode |
477 | #else |
478 | #endif /* __MigKernelSpecificCode */ |
479 | __DeclareRcvRpc(3003, "processor_control" ) |
480 | __BeforeRcvRpc(3003, "processor_control" ) |
481 | |
482 | #if defined(__MIG_check__Request__processor_control_t__defined) |
483 | check_result = __MIG_check__Request__processor_control_t((__Request *)In0P); |
484 | if (check_result != MACH_MSG_SUCCESS) |
485 | { MIG_RETURN_ERROR(OutP, check_result); } |
486 | #endif /* defined(__MIG_check__Request__processor_control_t__defined) */ |
487 | |
488 | OutP->RetCode = processor_control(convert_port_to_processor(In0P->Head.msgh_request_port), In0P->processor_cmd, In0P->processor_cmdCnt); |
489 | #if __MigKernelSpecificCode |
490 | #endif /* __MigKernelSpecificCode */ |
491 | |
492 | OutP->NDR = NDR_record; |
493 | |
494 | |
495 | __AfterRcvRpc(3003, "processor_control" ) |
496 | } |
497 | |
498 | #if ( __MigTypeCheck ) |
499 | #if __MIG_check__Request__processor_subsystem__ |
500 | #if !defined(__MIG_check__Request__processor_assign_t__defined) |
501 | #define __MIG_check__Request__processor_assign_t__defined |
502 | |
503 | mig_internal kern_return_t __MIG_check__Request__processor_assign_t(__attribute__((__unused__)) __Request__processor_assign_t *In0P) |
504 | { |
505 | |
506 | typedef __Request__processor_assign_t __Request; |
507 | #if __MigTypeCheck |
508 | if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
509 | (In0P->msgh_body.msgh_descriptor_count != 1) || |
510 | (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
511 | return MIG_BAD_ARGUMENTS; |
512 | #endif /* __MigTypeCheck */ |
513 | |
514 | #if __MigTypeCheck |
515 | if (In0P->new_set.type != MACH_MSG_PORT_DESCRIPTOR || |
516 | In0P->new_set.disposition != 17) |
517 | return MIG_TYPE_ERROR; |
518 | #endif /* __MigTypeCheck */ |
519 | |
520 | return MACH_MSG_SUCCESS; |
521 | } |
522 | #endif /* !defined(__MIG_check__Request__processor_assign_t__defined) */ |
523 | #endif /* __MIG_check__Request__processor_subsystem__ */ |
524 | #endif /* ( __MigTypeCheck ) */ |
525 | |
526 | |
527 | /* Routine processor_assign */ |
528 | mig_internal novalue _Xprocessor_assign |
529 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
530 | { |
531 | |
532 | #ifdef __MigPackStructs |
533 | #pragma pack(4) |
534 | #endif |
535 | typedef struct { |
536 | mach_msg_header_t Head; |
537 | /* start of the kernel processed data */ |
538 | mach_msg_body_t msgh_body; |
539 | mach_msg_port_descriptor_t new_set; |
540 | /* end of the kernel processed data */ |
541 | NDR_record_t NDR; |
542 | boolean_t wait; |
543 | mach_msg_trailer_t trailer; |
544 | } Request __attribute__((unused)); |
545 | #ifdef __MigPackStructs |
546 | #pragma pack() |
547 | #endif |
548 | typedef __Request__processor_assign_t __Request; |
549 | typedef __Reply__processor_assign_t Reply __attribute__((unused)); |
550 | |
551 | /* |
552 | * typedef struct { |
553 | * mach_msg_header_t Head; |
554 | * NDR_record_t NDR; |
555 | * kern_return_t RetCode; |
556 | * } mig_reply_error_t; |
557 | */ |
558 | |
559 | Request *In0P = (Request *) InHeadP; |
560 | Reply *OutP = (Reply *) OutHeadP; |
561 | #ifdef __MIG_check__Request__processor_assign_t__defined |
562 | kern_return_t check_result; |
563 | #endif /* __MIG_check__Request__processor_assign_t__defined */ |
564 | |
565 | #if __MigKernelSpecificCode |
566 | #else |
567 | #endif /* __MigKernelSpecificCode */ |
568 | processor_set_t new_set; |
569 | |
570 | __DeclareRcvRpc(3004, "processor_assign" ) |
571 | __BeforeRcvRpc(3004, "processor_assign" ) |
572 | |
573 | #if defined(__MIG_check__Request__processor_assign_t__defined) |
574 | check_result = __MIG_check__Request__processor_assign_t((__Request *)In0P); |
575 | if (check_result != MACH_MSG_SUCCESS) |
576 | { MIG_RETURN_ERROR(OutP, check_result); } |
577 | #endif /* defined(__MIG_check__Request__processor_assign_t__defined) */ |
578 | |
579 | new_set = convert_port_to_pset(In0P->new_set.name); |
580 | |
581 | OutP->RetCode = processor_assign(convert_port_to_processor(In0P->Head.msgh_request_port), new_set, In0P->wait); |
582 | pset_deallocate(new_set); |
583 | #if __MigKernelSpecificCode |
584 | if (OutP->RetCode != KERN_SUCCESS) { |
585 | MIG_RETURN_ERROR(OutP, OutP->RetCode); |
586 | } |
587 | |
588 | if (IP_VALID((ipc_port_t)In0P->new_set.name)) |
589 | ipc_port_release_send((ipc_port_t)In0P->new_set.name); |
590 | #endif /* __MigKernelSpecificCode */ |
591 | |
592 | OutP->NDR = NDR_record; |
593 | |
594 | |
595 | __AfterRcvRpc(3004, "processor_assign" ) |
596 | } |
597 | |
598 | #if ( __MigTypeCheck ) |
599 | #if __MIG_check__Request__processor_subsystem__ |
600 | #if !defined(__MIG_check__Request__processor_get_assignment_t__defined) |
601 | #define __MIG_check__Request__processor_get_assignment_t__defined |
602 | |
603 | mig_internal kern_return_t __MIG_check__Request__processor_get_assignment_t(__attribute__((__unused__)) __Request__processor_get_assignment_t *In0P) |
604 | { |
605 | |
606 | typedef __Request__processor_get_assignment_t __Request; |
607 | #if __MigTypeCheck |
608 | if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
609 | (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
610 | return MIG_BAD_ARGUMENTS; |
611 | #endif /* __MigTypeCheck */ |
612 | |
613 | return MACH_MSG_SUCCESS; |
614 | } |
615 | #endif /* !defined(__MIG_check__Request__processor_get_assignment_t__defined) */ |
616 | #endif /* __MIG_check__Request__processor_subsystem__ */ |
617 | #endif /* ( __MigTypeCheck ) */ |
618 | |
619 | |
620 | /* Routine processor_get_assignment */ |
621 | mig_internal novalue _Xprocessor_get_assignment |
622 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
623 | { |
624 | |
625 | #ifdef __MigPackStructs |
626 | #pragma pack(4) |
627 | #endif |
628 | typedef struct { |
629 | mach_msg_header_t Head; |
630 | mach_msg_trailer_t trailer; |
631 | } Request __attribute__((unused)); |
632 | #ifdef __MigPackStructs |
633 | #pragma pack() |
634 | #endif |
635 | typedef __Request__processor_get_assignment_t __Request; |
636 | typedef __Reply__processor_get_assignment_t Reply __attribute__((unused)); |
637 | |
638 | /* |
639 | * typedef struct { |
640 | * mach_msg_header_t Head; |
641 | * NDR_record_t NDR; |
642 | * kern_return_t RetCode; |
643 | * } mig_reply_error_t; |
644 | */ |
645 | |
646 | Request *In0P = (Request *) InHeadP; |
647 | Reply *OutP = (Reply *) OutHeadP; |
648 | #ifdef __MIG_check__Request__processor_get_assignment_t__defined |
649 | kern_return_t check_result; |
650 | #endif /* __MIG_check__Request__processor_get_assignment_t__defined */ |
651 | |
652 | #if __MigKernelSpecificCode |
653 | #if UseStaticTemplates |
654 | const static mach_msg_port_descriptor_t assigned_setTemplate = { |
655 | /* name = */ MACH_PORT_NULL, |
656 | /* pad1 = */ 0, |
657 | /* pad2 = */ 0, |
658 | /* disp = */ 17, |
659 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
660 | }; |
661 | #endif /* UseStaticTemplates */ |
662 | |
663 | #else |
664 | #if UseStaticTemplates |
665 | const static mach_msg_port_descriptor_t assigned_setTemplate = { |
666 | /* name = */ MACH_PORT_NULL, |
667 | /* pad1 = */ 0, |
668 | /* pad2 = */ 0, |
669 | /* disp = */ 19, |
670 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
671 | }; |
672 | #endif /* UseStaticTemplates */ |
673 | |
674 | #endif /* __MigKernelSpecificCode */ |
675 | kern_return_t RetCode; |
676 | processor_set_name_t assigned_set; |
677 | |
678 | __DeclareRcvRpc(3005, "processor_get_assignment" ) |
679 | __BeforeRcvRpc(3005, "processor_get_assignment" ) |
680 | |
681 | #if defined(__MIG_check__Request__processor_get_assignment_t__defined) |
682 | check_result = __MIG_check__Request__processor_get_assignment_t((__Request *)In0P); |
683 | if (check_result != MACH_MSG_SUCCESS) |
684 | { MIG_RETURN_ERROR(OutP, check_result); } |
685 | #endif /* defined(__MIG_check__Request__processor_get_assignment_t__defined) */ |
686 | |
687 | #if UseStaticTemplates |
688 | OutP->assigned_set = assigned_setTemplate; |
689 | #else /* UseStaticTemplates */ |
690 | #if __MigKernelSpecificCode |
691 | OutP->assigned_set.disposition = 17; |
692 | #else |
693 | OutP->assigned_set.disposition = 19; |
694 | #endif /* __MigKernelSpecificCode */ |
695 | #if !(defined(KERNEL) && defined(__LP64__)) |
696 | OutP->assigned_set.pad1 = 0; |
697 | #endif |
698 | OutP->assigned_set.pad2 = 0; |
699 | OutP->assigned_set.type = MACH_MSG_PORT_DESCRIPTOR; |
700 | #if defined(KERNEL) |
701 | OutP->assigned_set.pad_end = 0; |
702 | #endif |
703 | #endif /* UseStaticTemplates */ |
704 | |
705 | |
706 | RetCode = processor_get_assignment(convert_port_to_processor(In0P->Head.msgh_request_port), &assigned_set); |
707 | if (RetCode != KERN_SUCCESS) { |
708 | MIG_RETURN_ERROR(OutP, RetCode); |
709 | } |
710 | #if __MigKernelSpecificCode |
711 | #endif /* __MigKernelSpecificCode */ |
712 | OutP->assigned_set.name = (mach_port_t)convert_pset_name_to_port(assigned_set); |
713 | |
714 | |
715 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; |
716 | OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); |
717 | OutP->msgh_body.msgh_descriptor_count = 1; |
718 | __AfterRcvRpc(3005, "processor_get_assignment" ) |
719 | } |
720 | |
721 | |
722 | |
723 | /* Description of this subsystem, for use in direct RPC */ |
724 | const struct processor_subsystem processor_subsystem = { |
725 | processor_server_routine, |
726 | 3000, |
727 | 3006, |
728 | (mach_msg_size_t)sizeof(union __ReplyUnion__processor_subsystem), |
729 | (vm_address_t)0, |
730 | { |
731 | { (mig_impl_routine_t) 0, |
732 | (mig_stub_routine_t) _Xprocessor_start, 1, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__processor_start_t)}, |
733 | { (mig_impl_routine_t) 0, |
734 | (mig_stub_routine_t) _Xprocessor_exit, 1, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__processor_exit_t)}, |
735 | { (mig_impl_routine_t) 0, |
736 | (mig_stub_routine_t) _Xprocessor_info, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__processor_info_t)}, |
737 | { (mig_impl_routine_t) 0, |
738 | (mig_stub_routine_t) _Xprocessor_control, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__processor_control_t)}, |
739 | { (mig_impl_routine_t) 0, |
740 | (mig_stub_routine_t) _Xprocessor_assign, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__processor_assign_t)}, |
741 | { (mig_impl_routine_t) 0, |
742 | (mig_stub_routine_t) _Xprocessor_get_assignment, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__processor_get_assignment_t)}, |
743 | } |
744 | }; |
745 | |
746 | mig_external boolean_t processor_server |
747 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
748 | { |
749 | /* |
750 | * typedef struct { |
751 | * mach_msg_header_t Head; |
752 | * NDR_record_t NDR; |
753 | * kern_return_t RetCode; |
754 | * } mig_reply_error_t; |
755 | */ |
756 | |
757 | register mig_routine_t routine; |
758 | |
759 | OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0); |
760 | OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port; |
761 | /* Minimal size: routine() will update it if different */ |
762 | OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t); |
763 | OutHeadP->msgh_local_port = MACH_PORT_NULL; |
764 | OutHeadP->msgh_id = InHeadP->msgh_id + 100; |
765 | OutHeadP->msgh_reserved = 0; |
766 | |
767 | if ((InHeadP->msgh_id > 3005) || (InHeadP->msgh_id < 3000) || |
768 | ((routine = processor_subsystem.routine[InHeadP->msgh_id - 3000].stub_routine) == 0)) { |
769 | ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record; |
770 | ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID; |
771 | return FALSE; |
772 | } |
773 | (*routine) (InHeadP, OutHeadP); |
774 | return TRUE; |
775 | } |
776 | |
777 | mig_external mig_routine_t processor_server_routine |
778 | (mach_msg_header_t *InHeadP) |
779 | { |
780 | register int msgh_id; |
781 | |
782 | msgh_id = InHeadP->msgh_id - 3000; |
783 | |
784 | if ((msgh_id > 5) || (msgh_id < 0)) |
785 | return 0; |
786 | |
787 | return processor_subsystem.routine[msgh_id].stub_routine; |
788 | } |
789 | |