1 | /* |
2 | * IDENTIFICATION: |
3 | * stub generated by bootstrap_cmds-133 |
4 | * OPTIONS: |
5 | * KernelServer |
6 | */ |
7 | |
8 | /* Module task_restartable */ |
9 | |
10 | #define __MIG_check__Request__task_restartable_subsystem__ 1 |
11 | |
12 | #include "restartable_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 _Xtask_restartable_ranges_register |
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 _Xtask_restartable_ranges_synchronize |
105 | (mach_msg_header_t *InHeadP, void *InDataP, mach_msg_max_trailer_t *InTrailerP, mach_msg_header_t *OutHeadP, void *OutDataP); |
106 | |
107 | |
108 | #if ( __MigTypeCheck ) |
109 | #if __MIG_check__Request__task_restartable_subsystem__ |
110 | #if !defined(__MIG_check__Request__task_restartable_ranges_register_t__defined) |
111 | #define __MIG_check__Request__task_restartable_ranges_register_t__defined |
112 | |
113 | mig_internal kern_return_t __MIG_check__Request__task_restartable_ranges_register_t( |
114 | __attribute__((__unused__)) __RequestKData__task_restartable_ranges_register_t *InKP, |
115 | __attribute__((__unused__)) __RequestUData__task_restartable_ranges_register_t *In0UP, |
116 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP) |
117 | { |
118 | |
119 | typedef __Request__task_restartable_ranges_register_t __Request; |
120 | typedef __RequestUData__task_restartable_ranges_register_t __RequestU __attribute__((unused)); |
121 | #if __MigTypeCheck |
122 | unsigned int msgh_size; |
123 | #endif /* __MigTypeCheck */ |
124 | |
125 | #if __MigTypeCheck |
126 | msgh_size = InKP->Head.msgh_size; |
127 | if ((InKP->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
128 | (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 1024)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) |
129 | return MIG_BAD_ARGUMENTS; |
130 | #endif /* __MigTypeCheck */ |
131 | |
132 | #if defined(__NDR_convert__int_rep__Request__task_restartable_ranges_register_t__rangesCnt__defined) |
133 | if (In0UP->NDR.int_rep != NDR_record.int_rep) |
134 | __NDR_convert__int_rep__Request__task_restartable_ranges_register_t__rangesCnt(&In0UP->rangesCnt, In0UP->NDR.int_rep); |
135 | #endif /* __NDR_convert__int_rep__Request__task_restartable_ranges_register_t__rangesCnt__defined */ |
136 | #if __MigTypeCheck |
137 | if (In0UP->rangesCnt > 64) |
138 | return MIG_BAD_ARGUMENTS; |
139 | if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 1024)) / 16 < In0UP->rangesCnt) || |
140 | (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 1024) + (16 * In0UP->rangesCnt))) |
141 | return MIG_BAD_ARGUMENTS; |
142 | #endif /* __MigTypeCheck */ |
143 | |
144 | return MACH_MSG_SUCCESS; |
145 | } |
146 | #endif /* !defined(__MIG_check__Request__task_restartable_ranges_register_t__defined) */ |
147 | #endif /* __MIG_check__Request__task_restartable_subsystem__ */ |
148 | #endif /* ( __MigTypeCheck ) */ |
149 | |
150 | |
151 | /* Routine task_restartable_ranges_register */ |
152 | mig_internal novalue _Xtask_restartable_ranges_register |
153 | (mach_msg_header_t *InHeadP, __attribute__((__unused__)) void *InDataP, |
154 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP, |
155 | mach_msg_header_t *OutHeadP, __attribute__((__unused__)) void *OutDataP) |
156 | { |
157 | |
158 | #ifdef __MigPackStructs |
159 | #pragma pack(push, 4) |
160 | #endif |
161 | typedef struct { |
162 | NDR_record_t NDR; |
163 | mach_msg_type_number_t rangesCnt; |
164 | task_restartable_range_t ranges[64]; |
165 | mach_msg_trailer_t trailer; |
166 | char padding[0]; /* Avoid generating empty UData structs */ |
167 | } RequestU __attribute__((unused)); |
168 | #ifdef __MigPackStructs |
169 | #pragma pack(pop) |
170 | #endif |
171 | typedef __RequestKData__task_restartable_ranges_register_t RequestK; |
172 | typedef __RequestUData__task_restartable_ranges_register_t __RequestU; |
173 | typedef __ReplyKData__task_restartable_ranges_register_t ReplyK __attribute__((unused)); |
174 | typedef __ReplyUData__task_restartable_ranges_register_t ReplyU __attribute__((unused)); |
175 | typedef __Reply__task_restartable_ranges_register_t Reply __attribute__((unused)); |
176 | typedef __Request__task_restartable_ranges_register_t __Request __attribute__((unused)); |
177 | |
178 | /* |
179 | * typedef struct { |
180 | * mach_msg_header_t Head; |
181 | * NDR_record_t NDR; |
182 | * kern_return_t RetCode; |
183 | * } mig_reply_error_t; |
184 | */ |
185 | |
186 | RequestK *InKP = (RequestK *) InHeadP; |
187 | RequestU *In0UP = (RequestU *) InDataP; |
188 | ReplyK *OutKP = (ReplyK *) OutHeadP; |
189 | ReplyU *OutUP = (ReplyU *) OutDataP; |
190 | (void)OutUP; |
191 | #ifdef __MIG_check__Request__task_restartable_ranges_register_t__defined |
192 | kern_return_t check_result; |
193 | #endif /* __MIG_check__Request__task_restartable_ranges_register_t__defined */ |
194 | |
195 | #if __MigKernelSpecificCode |
196 | #else |
197 | #endif /* __MigKernelSpecificCode */ |
198 | task_t target_task; |
199 | |
200 | __DeclareRcvRpc(8000, "task_restartable_ranges_register" ) |
201 | __BeforeRcvRpc(8000, "task_restartable_ranges_register" ) |
202 | |
203 | #if defined(__MIG_check__Request__task_restartable_ranges_register_t__defined) |
204 | check_result = __MIG_check__Request__task_restartable_ranges_register_t(InKP: (RequestK *)InKP, In0UP: (__RequestU *)In0UP, InTrailerP); |
205 | if (check_result != MACH_MSG_SUCCESS) |
206 | { MIG_RETURN_ERROR(OutKP, check_result); } |
207 | #endif /* defined(__MIG_check__Request__task_restartable_ranges_register_t__defined) */ |
208 | |
209 | target_task = convert_port_to_task_mig(port: InKP->Head.msgh_request_port); |
210 | |
211 | OutUP->RetCode = task_restartable_ranges_register(target_task, ranges: In0UP->ranges, rangesCnt: In0UP->rangesCnt); |
212 | task_deallocate_mig(target_task); |
213 | #if __MigKernelSpecificCode |
214 | #endif /* __MigKernelSpecificCode */ |
215 | |
216 | OutUP->NDR = NDR_record; |
217 | |
218 | |
219 | __AfterRcvRpc(8000, "task_restartable_ranges_register" ) |
220 | } |
221 | |
222 | #if ( __MigTypeCheck ) |
223 | #if __MIG_check__Request__task_restartable_subsystem__ |
224 | #if !defined(__MIG_check__Request__task_restartable_ranges_synchronize_t__defined) |
225 | #define __MIG_check__Request__task_restartable_ranges_synchronize_t__defined |
226 | |
227 | mig_internal kern_return_t __MIG_check__Request__task_restartable_ranges_synchronize_t( |
228 | __attribute__((__unused__)) __RequestKData__task_restartable_ranges_synchronize_t *InKP, |
229 | __attribute__((__unused__)) __RequestUData__task_restartable_ranges_synchronize_t *In0UP, |
230 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP) |
231 | { |
232 | |
233 | typedef __Request__task_restartable_ranges_synchronize_t __Request; |
234 | typedef __RequestUData__task_restartable_ranges_synchronize_t __RequestU __attribute__((unused)); |
235 | #if __MigTypeCheck |
236 | if ((InKP->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
237 | (InKP->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
238 | return MIG_BAD_ARGUMENTS; |
239 | #endif /* __MigTypeCheck */ |
240 | |
241 | return MACH_MSG_SUCCESS; |
242 | } |
243 | #endif /* !defined(__MIG_check__Request__task_restartable_ranges_synchronize_t__defined) */ |
244 | #endif /* __MIG_check__Request__task_restartable_subsystem__ */ |
245 | #endif /* ( __MigTypeCheck ) */ |
246 | |
247 | |
248 | /* Routine task_restartable_ranges_synchronize */ |
249 | mig_internal novalue _Xtask_restartable_ranges_synchronize |
250 | (mach_msg_header_t *InHeadP, __attribute__((__unused__)) void *InDataP, |
251 | __attribute__((__unused__)) mach_msg_max_trailer_t *InTrailerP, |
252 | mach_msg_header_t *OutHeadP, __attribute__((__unused__)) void *OutDataP) |
253 | { |
254 | |
255 | #ifdef __MigPackStructs |
256 | #pragma pack(push, 4) |
257 | #endif |
258 | typedef struct { |
259 | mach_msg_trailer_t trailer; |
260 | char padding[0]; /* Avoid generating empty UData structs */ |
261 | } RequestU __attribute__((unused)); |
262 | #ifdef __MigPackStructs |
263 | #pragma pack(pop) |
264 | #endif |
265 | typedef __RequestKData__task_restartable_ranges_synchronize_t RequestK; |
266 | typedef __RequestUData__task_restartable_ranges_synchronize_t __RequestU; |
267 | typedef __ReplyKData__task_restartable_ranges_synchronize_t ReplyK __attribute__((unused)); |
268 | typedef __ReplyUData__task_restartable_ranges_synchronize_t ReplyU __attribute__((unused)); |
269 | typedef __Reply__task_restartable_ranges_synchronize_t Reply __attribute__((unused)); |
270 | typedef __Request__task_restartable_ranges_synchronize_t __Request __attribute__((unused)); |
271 | |
272 | /* |
273 | * typedef struct { |
274 | * mach_msg_header_t Head; |
275 | * NDR_record_t NDR; |
276 | * kern_return_t RetCode; |
277 | * } mig_reply_error_t; |
278 | */ |
279 | |
280 | RequestK *InKP = (RequestK *) InHeadP; |
281 | RequestU *In0UP = (RequestU *) InDataP; |
282 | ReplyK *OutKP = (ReplyK *) OutHeadP; |
283 | ReplyU *OutUP = (ReplyU *) OutDataP; |
284 | (void)OutUP; |
285 | #ifdef __MIG_check__Request__task_restartable_ranges_synchronize_t__defined |
286 | kern_return_t check_result; |
287 | #endif /* __MIG_check__Request__task_restartable_ranges_synchronize_t__defined */ |
288 | |
289 | #if __MigKernelSpecificCode |
290 | #else |
291 | #endif /* __MigKernelSpecificCode */ |
292 | task_t target_task; |
293 | |
294 | __DeclareRcvRpc(8001, "task_restartable_ranges_synchronize" ) |
295 | __BeforeRcvRpc(8001, "task_restartable_ranges_synchronize" ) |
296 | |
297 | #if defined(__MIG_check__Request__task_restartable_ranges_synchronize_t__defined) |
298 | check_result = __MIG_check__Request__task_restartable_ranges_synchronize_t(InKP: (RequestK *)InKP, In0UP: (__RequestU *)In0UP, InTrailerP); |
299 | if (check_result != MACH_MSG_SUCCESS) |
300 | { MIG_RETURN_ERROR(OutKP, check_result); } |
301 | #endif /* defined(__MIG_check__Request__task_restartable_ranges_synchronize_t__defined) */ |
302 | |
303 | target_task = convert_port_to_task_mig(port: InKP->Head.msgh_request_port); |
304 | |
305 | OutUP->RetCode = task_restartable_ranges_synchronize(target_task); |
306 | task_deallocate_mig(target_task); |
307 | #if __MigKernelSpecificCode |
308 | #endif /* __MigKernelSpecificCode */ |
309 | |
310 | OutUP->NDR = NDR_record; |
311 | |
312 | |
313 | __AfterRcvRpc(8001, "task_restartable_ranges_synchronize" ) |
314 | } |
315 | |
316 | |
317 | |
318 | /* Description of this kernel subsystem, for use in direct RPC */ |
319 | const struct task_restartable_subsystem task_restartable_subsystem = { |
320 | task_restartable_server_routine, |
321 | 8000, |
322 | 8002, |
323 | (mach_msg_size_t)sizeof(union __ReplyUnion__task_restartable_subsystem), |
324 | (vm_address_t)0, |
325 | { |
326 | { (mig_impl_routine_t) 0, |
327 | (mig_stub_kern_routine_t) _Xtask_restartable_ranges_register, 3, 0, 0, (mach_msg_size_t)sizeof(__Reply__task_restartable_ranges_register_t)}, |
328 | { .impl_routine: (mig_impl_routine_t) 0, |
329 | .kstub_routine: (mig_stub_kern_routine_t) _Xtask_restartable_ranges_synchronize, .argc: 1, .descr_count: 0, .reply_descr_count: 0, .max_reply_msg: (mach_msg_size_t)sizeof(__Reply__task_restartable_ranges_synchronize_t)}, |
330 | } |
331 | }; |
332 | |
333 | mig_external boolean_t task_restartable_server |
334 | (mach_msg_header_t *InHeadP, void *InDataP, mach_msg_max_trailer_t *InTrailerP, mach_msg_header_t *OutHeadP, void *OutDataP) |
335 | { |
336 | /* |
337 | * typedef struct { |
338 | * mach_msg_header_t Head; |
339 | * NDR_record_t NDR; |
340 | * kern_return_t RetCode; |
341 | * } mig_reply_error_t; |
342 | */ |
343 | |
344 | mig_kern_routine_t routine; |
345 | |
346 | OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0); |
347 | OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port; |
348 | /* Minimal size: routine() will update it if different */ |
349 | OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t); |
350 | OutHeadP->msgh_local_port = MACH_PORT_NULL; |
351 | OutHeadP->msgh_id = InHeadP->msgh_id + 100; |
352 | OutHeadP->msgh_reserved = 0; |
353 | |
354 | if ((InHeadP->msgh_id > 8001) || (InHeadP->msgh_id < 8000) || |
355 | ((routine = task_restartable_subsystem.kroutine[InHeadP->msgh_id - 8000].kstub_routine) == 0)) { |
356 | ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record; |
357 | ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID; |
358 | return FALSE; |
359 | } |
360 | (*routine) (InHeadP, InDataP, InTrailerP, OutHeadP, OutDataP); |
361 | return TRUE; |
362 | } |
363 | |
364 | mig_external mig_kern_routine_t task_restartable_server_routine |
365 | (mach_msg_header_t *InHeadP) |
366 | { |
367 | int msgh_id; |
368 | |
369 | msgh_id = InHeadP->msgh_id - 8000; |
370 | |
371 | if ((msgh_id > 1) || (msgh_id < 0)) |
372 | return 0; |
373 | |
374 | return task_restartable_subsystem.kroutine[msgh_id].kstub_routine; |
375 | } |
376 | |