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