]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2000-2019 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
25 | * | |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
27 | */ | |
28 | /* | |
29 | * @OSF_COPYRIGHT@ | |
30 | */ | |
31 | /* | |
32 | * Mach Operating System | |
33 | * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University | |
34 | * All Rights Reserved. | |
35 | * | |
36 | * Permission to use, copy, modify and distribute this software and its | |
37 | * documentation is hereby granted, provided that both the copyright | |
38 | * notice and this permission notice appear in all copies of the | |
39 | * software, derivative works or modified versions, and any portions | |
40 | * thereof, and that both notices appear in supporting documentation. | |
41 | * | |
42 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
43 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
44 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
45 | * | |
46 | * Carnegie Mellon requests users of this software to return to | |
47 | * | |
48 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
49 | * School of Computer Science | |
50 | * Carnegie Mellon University | |
51 | * Pittsburgh PA 15213-3890 | |
52 | * | |
53 | * any improvements or extensions that they make and grant Carnegie Mellon | |
54 | * the rights to redistribute these changes. | |
55 | */ | |
56 | /* | |
57 | */ | |
58 | /* | |
59 | * Definitions of general Mach system traps. | |
60 | * | |
61 | * These are the definitions as seen from user-space. | |
62 | * The kernel definitions are in <mach/syscall_sw.h>. | |
63 | * Kernel RPC functions are defined in <mach/mach_interface.h>. | |
64 | */ | |
65 | ||
66 | #ifndef _MACH_MACH_TRAPS_H_ | |
67 | #define _MACH_MACH_TRAPS_H_ | |
68 | ||
69 | #include <stdint.h> | |
70 | ||
71 | #include <mach/std_types.h> | |
72 | #include <mach/mach_types.h> | |
73 | #include <mach/kern_return.h> | |
74 | #include <mach/port.h> | |
75 | #include <mach/vm_types.h> | |
76 | #include <mach/clock_types.h> | |
77 | ||
78 | #include <machine/endian.h> | |
79 | ||
80 | #include <sys/cdefs.h> | |
81 | ||
82 | __BEGIN_DECLS | |
83 | ||
84 | #ifndef KERNEL | |
85 | ||
86 | #ifdef PRIVATE | |
87 | ||
88 | extern mach_port_name_t mach_reply_port(void); | |
89 | ||
90 | extern mach_port_name_t thread_get_special_reply_port(void); | |
91 | ||
92 | extern mach_port_name_t thread_self_trap(void); | |
93 | ||
94 | extern mach_port_name_t host_self_trap(void); | |
95 | ||
96 | extern mach_msg_return_t mach_msg_trap( | |
97 | mach_msg_header_t *msg, | |
98 | mach_msg_option_t option, | |
99 | mach_msg_size_t send_size, | |
100 | mach_msg_size_t rcv_size, | |
101 | mach_port_name_t rcv_name, | |
102 | mach_msg_timeout_t timeout, | |
103 | mach_port_name_t notify); | |
104 | ||
105 | extern mach_msg_return_t mach_msg_overwrite_trap( | |
106 | mach_msg_header_t *msg, | |
107 | mach_msg_option_t option, | |
108 | mach_msg_size_t send_size, | |
109 | mach_msg_size_t rcv_size, | |
110 | mach_port_name_t rcv_name, | |
111 | mach_msg_timeout_t timeout, | |
112 | mach_msg_priority_t priority, | |
113 | mach_msg_header_t *rcv_msg, | |
114 | mach_msg_size_t rcv_limit); | |
115 | ||
116 | extern kern_return_t semaphore_signal_trap( | |
117 | mach_port_name_t signal_name); | |
118 | ||
119 | extern kern_return_t semaphore_signal_all_trap( | |
120 | mach_port_name_t signal_name); | |
121 | ||
122 | extern kern_return_t semaphore_signal_thread_trap( | |
123 | mach_port_name_t signal_name, | |
124 | mach_port_name_t thread_name); | |
125 | ||
126 | extern kern_return_t semaphore_wait_trap( | |
127 | mach_port_name_t wait_name); | |
128 | ||
129 | extern kern_return_t semaphore_wait_signal_trap( | |
130 | mach_port_name_t wait_name, | |
131 | mach_port_name_t signal_name); | |
132 | ||
133 | extern kern_return_t semaphore_timedwait_trap( | |
134 | mach_port_name_t wait_name, | |
135 | unsigned int sec, | |
136 | clock_res_t nsec); | |
137 | ||
138 | extern kern_return_t semaphore_timedwait_signal_trap( | |
139 | mach_port_name_t wait_name, | |
140 | mach_port_name_t signal_name, | |
141 | unsigned int sec, | |
142 | clock_res_t nsec); | |
143 | ||
144 | #endif /* PRIVATE */ | |
145 | ||
146 | extern kern_return_t clock_sleep_trap( | |
147 | mach_port_name_t clock_name, | |
148 | sleep_type_t sleep_type, | |
149 | int sleep_sec, | |
150 | int sleep_nsec, | |
151 | mach_timespec_t *wakeup_time); | |
152 | ||
153 | extern kern_return_t _kernelrpc_mach_vm_allocate_trap( | |
154 | mach_port_name_t target, | |
155 | mach_vm_offset_t *addr, | |
156 | mach_vm_size_t size, | |
157 | int flags); | |
158 | ||
159 | extern kern_return_t _kernelrpc_mach_vm_deallocate_trap( | |
160 | mach_port_name_t target, | |
161 | mach_vm_address_t address, | |
162 | mach_vm_size_t size | |
163 | ); | |
164 | ||
165 | extern kern_return_t task_dyld_process_info_notify_get( | |
166 | mach_port_name_array_t names_addr, | |
167 | natural_t *names_count_addr | |
168 | ); | |
169 | ||
170 | extern kern_return_t _kernelrpc_mach_vm_protect_trap( | |
171 | mach_port_name_t target, | |
172 | mach_vm_address_t address, | |
173 | mach_vm_size_t size, | |
174 | boolean_t set_maximum, | |
175 | vm_prot_t new_protection | |
176 | ); | |
177 | ||
178 | extern kern_return_t _kernelrpc_mach_vm_map_trap( | |
179 | mach_port_name_t target, | |
180 | mach_vm_offset_t *address, | |
181 | mach_vm_size_t size, | |
182 | mach_vm_offset_t mask, | |
183 | int flags, | |
184 | vm_prot_t cur_protection | |
185 | ); | |
186 | ||
187 | extern kern_return_t _kernelrpc_mach_vm_purgable_control_trap( | |
188 | mach_port_name_t target, | |
189 | mach_vm_offset_t address, | |
190 | vm_purgable_t control, | |
191 | int *state); | |
192 | ||
193 | extern kern_return_t _kernelrpc_mach_port_allocate_trap( | |
194 | mach_port_name_t target, | |
195 | mach_port_right_t right, | |
196 | mach_port_name_t *name | |
197 | ); | |
198 | ||
199 | extern kern_return_t _kernelrpc_mach_port_deallocate_trap( | |
200 | mach_port_name_t target, | |
201 | mach_port_name_t name | |
202 | ); | |
203 | ||
204 | extern kern_return_t _kernelrpc_mach_port_mod_refs_trap( | |
205 | mach_port_name_t target, | |
206 | mach_port_name_t name, | |
207 | mach_port_right_t right, | |
208 | mach_port_delta_t delta | |
209 | ); | |
210 | ||
211 | extern kern_return_t _kernelrpc_mach_port_move_member_trap( | |
212 | mach_port_name_t target, | |
213 | mach_port_name_t member, | |
214 | mach_port_name_t after | |
215 | ); | |
216 | ||
217 | extern kern_return_t _kernelrpc_mach_port_insert_right_trap( | |
218 | mach_port_name_t target, | |
219 | mach_port_name_t name, | |
220 | mach_port_name_t poly, | |
221 | mach_msg_type_name_t polyPoly | |
222 | ); | |
223 | ||
224 | extern kern_return_t _kernelrpc_mach_port_get_attributes_trap( | |
225 | mach_port_name_t target, | |
226 | mach_port_name_t name, | |
227 | mach_port_flavor_t flavor, | |
228 | mach_port_info_t port_info_out, | |
229 | mach_msg_type_number_t *port_info_outCnt | |
230 | ); | |
231 | ||
232 | extern kern_return_t _kernelrpc_mach_port_insert_member_trap( | |
233 | mach_port_name_t target, | |
234 | mach_port_name_t name, | |
235 | mach_port_name_t pset | |
236 | ); | |
237 | ||
238 | extern kern_return_t _kernelrpc_mach_port_extract_member_trap( | |
239 | mach_port_name_t target, | |
240 | mach_port_name_t name, | |
241 | mach_port_name_t pset | |
242 | ); | |
243 | ||
244 | extern kern_return_t _kernelrpc_mach_port_construct_trap( | |
245 | mach_port_name_t target, | |
246 | mach_port_options_t *options, | |
247 | uint64_t context, | |
248 | mach_port_name_t *name | |
249 | ); | |
250 | ||
251 | extern kern_return_t _kernelrpc_mach_port_destruct_trap( | |
252 | mach_port_name_t target, | |
253 | mach_port_name_t name, | |
254 | mach_port_delta_t srdelta, | |
255 | uint64_t guard | |
256 | ); | |
257 | ||
258 | extern kern_return_t _kernelrpc_mach_port_guard_trap( | |
259 | mach_port_name_t target, | |
260 | mach_port_name_t name, | |
261 | uint64_t guard, | |
262 | boolean_t strict | |
263 | ); | |
264 | ||
265 | extern kern_return_t _kernelrpc_mach_port_unguard_trap( | |
266 | mach_port_name_t target, | |
267 | mach_port_name_t name, | |
268 | uint64_t guard | |
269 | ); | |
270 | ||
271 | extern kern_return_t mach_generate_activity_id( | |
272 | mach_port_name_t target, | |
273 | int count, | |
274 | uint64_t *activity_id | |
275 | ); | |
276 | ||
277 | extern kern_return_t macx_swapon( | |
278 | uint64_t filename, | |
279 | int flags, | |
280 | int size, | |
281 | int priority); | |
282 | ||
283 | extern kern_return_t macx_swapoff( | |
284 | uint64_t filename, | |
285 | int flags); | |
286 | ||
287 | extern kern_return_t macx_triggers( | |
288 | int hi_water, | |
289 | int low_water, | |
290 | int flags, | |
291 | mach_port_t alert_port); | |
292 | ||
293 | extern kern_return_t macx_backing_store_suspend( | |
294 | boolean_t suspend); | |
295 | ||
296 | extern kern_return_t macx_backing_store_recovery( | |
297 | int pid); | |
298 | ||
299 | extern boolean_t swtch_pri(int pri); | |
300 | ||
301 | extern boolean_t swtch(void); | |
302 | ||
303 | extern kern_return_t thread_switch( | |
304 | mach_port_name_t thread_name, | |
305 | int option, | |
306 | mach_msg_timeout_t option_time); | |
307 | ||
308 | extern mach_port_name_t task_self_trap(void); | |
309 | ||
310 | extern kern_return_t host_create_mach_voucher_trap( | |
311 | mach_port_name_t host, | |
312 | mach_voucher_attr_raw_recipe_array_t recipes, | |
313 | int recipes_size, | |
314 | mach_port_name_t *voucher); | |
315 | ||
316 | extern kern_return_t mach_voucher_extract_attr_recipe_trap( | |
317 | mach_port_name_t voucher_name, | |
318 | mach_voucher_attr_key_t key, | |
319 | mach_voucher_attr_raw_recipe_t recipe, | |
320 | mach_msg_type_number_t *recipe_size); | |
321 | ||
322 | extern kern_return_t _kernelrpc_mach_port_type_trap( | |
323 | ipc_space_t task, | |
324 | mach_port_name_t name, | |
325 | mach_port_type_t *ptype); | |
326 | ||
327 | extern kern_return_t _kernelrpc_mach_port_request_notification_trap( | |
328 | ipc_space_t task, | |
329 | mach_port_name_t name, | |
330 | mach_msg_id_t msgid, | |
331 | mach_port_mscount_t sync, | |
332 | mach_port_name_t notify, | |
333 | mach_msg_type_name_t notifyPoly, | |
334 | mach_port_name_t *previous); | |
335 | ||
336 | /* | |
337 | * Obsolete interfaces. | |
338 | */ | |
339 | ||
340 | extern kern_return_t task_for_pid( | |
341 | mach_port_name_t target_tport, | |
342 | int pid, | |
343 | mach_port_name_t *t); | |
344 | ||
345 | extern kern_return_t task_name_for_pid( | |
346 | mach_port_name_t target_tport, | |
347 | int pid, | |
348 | mach_port_name_t *tn); | |
349 | ||
350 | extern kern_return_t pid_for_task( | |
351 | mach_port_name_t t, | |
352 | int *x); | |
353 | ||
354 | extern kern_return_t debug_control_port_for_pid( | |
355 | mach_port_name_t target_tport, | |
356 | int pid, | |
357 | mach_port_name_t *t); | |
358 | ||
359 | #else /* KERNEL */ | |
360 | ||
361 | #ifdef XNU_KERNEL_PRIVATE | |
362 | ||
363 | /* Syscall data translations routines | |
364 | * | |
365 | * The kernel may support multiple userspace ABIs, and must use | |
366 | * argument structures with elements large enough for any of them. | |
367 | */ | |
368 | #if CONFIG_REQUIRES_U32_MUNGING | |
369 | #define PAD_(t) (sizeof(uint64_t) <= sizeof(t) \ | |
370 | ? 0 : sizeof(uint64_t) - sizeof(t)) | |
371 | #define PAD_ARG_8 | |
372 | #else | |
373 | #define PAD_(t) (sizeof(uint32_t) <= sizeof(t) \ | |
374 | ? 0 : sizeof(uint32_t) - sizeof(t)) | |
375 | #if __arm__ && (__BIGGEST_ALIGNMENT__ > 4) | |
376 | #define PAD_ARG_8 | |
377 | #else | |
378 | #define PAD_ARG_8 char arg8_pad_[sizeof(uint32_t)]; | |
379 | #endif | |
380 | #endif | |
381 | ||
382 | #if BYTE_ORDER == LITTLE_ENDIAN | |
383 | #define PADL_(t) 0 | |
384 | #define PADR_(t) PAD_(t) | |
385 | #else | |
386 | #define PADL_(t) PAD_(t) | |
387 | #define PADR_(t) 0 | |
388 | #endif | |
389 | ||
390 | #define PAD_ARG_(arg_type, arg_name) \ | |
391 | char arg_name##_l_[PADL_(arg_type)]; arg_type arg_name; char arg_name##_r_[PADR_(arg_type)] | |
392 | ||
393 | /* | |
394 | * To support 32-bit clients as well as 64-bit clients, argument | |
395 | * structures may need to be munged to repack the arguments. All | |
396 | * active architectures do this inline in the code to dispatch Mach | |
397 | * traps, without calling out to the BSD system call mungers. | |
398 | */ | |
399 | ||
400 | struct kern_invalid_args { | |
401 | int32_t dummy; | |
402 | }; | |
403 | extern kern_return_t kern_invalid( | |
404 | struct kern_invalid_args *args); | |
405 | ||
406 | struct mach_reply_port_args { | |
407 | int32_t dummy; | |
408 | }; | |
409 | extern mach_port_name_t mach_reply_port( | |
410 | struct mach_reply_port_args *args); | |
411 | ||
412 | struct thread_get_special_reply_port_args { | |
413 | int32_t dummy; | |
414 | }; | |
415 | extern mach_port_name_t thread_get_special_reply_port( | |
416 | struct thread_get_special_reply_port_args *args); | |
417 | ||
418 | struct thread_self_trap_args { | |
419 | int32_t dummy; | |
420 | }; | |
421 | extern mach_port_name_t thread_self_trap( | |
422 | struct thread_self_trap_args *args); | |
423 | ||
424 | struct task_self_trap_args { | |
425 | int32_t dummy; | |
426 | }; | |
427 | extern mach_port_name_t task_self_trap( | |
428 | struct task_self_trap_args *args); | |
429 | ||
430 | struct host_self_trap_args { | |
431 | int32_t dummy; | |
432 | }; | |
433 | extern mach_port_name_t host_self_trap( | |
434 | struct host_self_trap_args *args); | |
435 | ||
436 | struct mach_msg_overwrite_trap_args { | |
437 | PAD_ARG_(user_addr_t, msg); | |
438 | PAD_ARG_(mach_msg_option_t, option); | |
439 | PAD_ARG_(mach_msg_size_t, send_size); | |
440 | PAD_ARG_(mach_msg_size_t, rcv_size); | |
441 | PAD_ARG_(mach_port_name_t, rcv_name); | |
442 | PAD_ARG_(mach_msg_timeout_t, timeout); | |
443 | PAD_ARG_(mach_msg_priority_t, priority); | |
444 | PAD_ARG_8 | |
445 | PAD_ARG_(user_addr_t, rcv_msg); /* Unused on mach_msg_trap */ | |
446 | }; | |
447 | extern mach_msg_return_t mach_msg_trap( | |
448 | struct mach_msg_overwrite_trap_args *args); | |
449 | extern mach_msg_return_t mach_msg_overwrite_trap( | |
450 | struct mach_msg_overwrite_trap_args *args); | |
451 | ||
452 | struct semaphore_signal_trap_args { | |
453 | PAD_ARG_(mach_port_name_t, signal_name); | |
454 | }; | |
455 | extern kern_return_t semaphore_signal_trap( | |
456 | struct semaphore_signal_trap_args *args); | |
457 | ||
458 | struct semaphore_signal_all_trap_args { | |
459 | PAD_ARG_(mach_port_name_t, signal_name); | |
460 | }; | |
461 | extern kern_return_t semaphore_signal_all_trap( | |
462 | struct semaphore_signal_all_trap_args *args); | |
463 | ||
464 | struct semaphore_signal_thread_trap_args { | |
465 | PAD_ARG_(mach_port_name_t, signal_name); | |
466 | PAD_ARG_(mach_port_name_t, thread_name); | |
467 | }; | |
468 | extern kern_return_t semaphore_signal_thread_trap( | |
469 | struct semaphore_signal_thread_trap_args *args); | |
470 | ||
471 | struct semaphore_wait_trap_args { | |
472 | PAD_ARG_(mach_port_name_t, wait_name); | |
473 | }; | |
474 | extern kern_return_t semaphore_wait_trap( | |
475 | struct semaphore_wait_trap_args *args); | |
476 | ||
477 | struct semaphore_wait_signal_trap_args { | |
478 | PAD_ARG_(mach_port_name_t, wait_name); | |
479 | PAD_ARG_(mach_port_name_t, signal_name); | |
480 | }; | |
481 | extern kern_return_t semaphore_wait_signal_trap( | |
482 | struct semaphore_wait_signal_trap_args *args); | |
483 | ||
484 | struct semaphore_timedwait_trap_args { | |
485 | PAD_ARG_(mach_port_name_t, wait_name); | |
486 | PAD_ARG_(unsigned int, sec); | |
487 | PAD_ARG_(clock_res_t, nsec); | |
488 | }; | |
489 | extern kern_return_t semaphore_timedwait_trap( | |
490 | struct semaphore_timedwait_trap_args *args); | |
491 | ||
492 | struct semaphore_timedwait_signal_trap_args { | |
493 | PAD_ARG_(mach_port_name_t, wait_name); | |
494 | PAD_ARG_(mach_port_name_t, signal_name); | |
495 | PAD_ARG_(unsigned int, sec); | |
496 | PAD_ARG_(clock_res_t, nsec); | |
497 | }; | |
498 | extern kern_return_t semaphore_timedwait_signal_trap( | |
499 | struct semaphore_timedwait_signal_trap_args *args); | |
500 | ||
501 | struct task_for_pid_args { | |
502 | PAD_ARG_(mach_port_name_t, target_tport); | |
503 | PAD_ARG_(int, pid); | |
504 | PAD_ARG_(user_addr_t, t); | |
505 | }; | |
506 | extern kern_return_t task_for_pid( | |
507 | struct task_for_pid_args *args); | |
508 | ||
509 | struct task_name_for_pid_args { | |
510 | PAD_ARG_(mach_port_name_t, target_tport); | |
511 | PAD_ARG_(int, pid); | |
512 | PAD_ARG_(user_addr_t, t); | |
513 | }; | |
514 | extern kern_return_t task_name_for_pid( | |
515 | struct task_name_for_pid_args *args); | |
516 | ||
517 | struct pid_for_task_args { | |
518 | PAD_ARG_(mach_port_name_t, t); | |
519 | PAD_ARG_(user_addr_t, pid); | |
520 | }; | |
521 | extern kern_return_t pid_for_task( | |
522 | struct pid_for_task_args *args); | |
523 | ||
524 | struct debug_control_port_for_pid_args { | |
525 | PAD_ARG_(mach_port_name_t, target_tport); | |
526 | PAD_ARG_(int, pid); | |
527 | PAD_ARG_(user_addr_t, t); | |
528 | }; | |
529 | extern kern_return_t debug_control_port_for_pid( | |
530 | struct debug_control_port_for_pid_args *args); | |
531 | ||
532 | struct macx_swapon_args { | |
533 | PAD_ARG_(uint64_t, filename); | |
534 | PAD_ARG_(int, flags); | |
535 | PAD_ARG_(int, size); | |
536 | PAD_ARG_(int, priority); | |
537 | }; | |
538 | extern kern_return_t macx_swapon( | |
539 | struct macx_swapon_args *args); | |
540 | ||
541 | struct macx_swapoff_args { | |
542 | PAD_ARG_(uint64_t, filename); | |
543 | PAD_ARG_(int, flags); | |
544 | }; | |
545 | extern kern_return_t macx_swapoff( | |
546 | struct macx_swapoff_args *args); | |
547 | ||
548 | struct macx_triggers_args { | |
549 | PAD_ARG_(int, hi_water); | |
550 | PAD_ARG_(int, low_water); | |
551 | PAD_ARG_(int, flags); | |
552 | PAD_ARG_(mach_port_t, alert_port); | |
553 | }; | |
554 | extern kern_return_t macx_triggers( | |
555 | struct macx_triggers_args *args); | |
556 | ||
557 | struct macx_backing_store_suspend_args { | |
558 | PAD_ARG_(boolean_t, suspend); | |
559 | }; | |
560 | extern kern_return_t macx_backing_store_suspend( | |
561 | struct macx_backing_store_suspend_args *args); | |
562 | ||
563 | struct macx_backing_store_recovery_args { | |
564 | PAD_ARG_(int, pid); | |
565 | }; | |
566 | extern kern_return_t macx_backing_store_recovery( | |
567 | struct macx_backing_store_recovery_args *args); | |
568 | ||
569 | struct swtch_pri_args { | |
570 | PAD_ARG_(int, pri); | |
571 | }; | |
572 | extern boolean_t swtch_pri( | |
573 | struct swtch_pri_args *args); | |
574 | ||
575 | struct pfz_exit_args { | |
576 | int32_t dummy; | |
577 | }; | |
578 | extern kern_return_t pfz_exit( | |
579 | struct pfz_exit_args *args); | |
580 | ||
581 | struct swtch_args { | |
582 | int32_t dummy; | |
583 | }; | |
584 | extern boolean_t swtch( | |
585 | struct swtch_args *args); | |
586 | ||
587 | struct clock_sleep_trap_args { | |
588 | PAD_ARG_(mach_port_name_t, clock_name); | |
589 | PAD_ARG_(sleep_type_t, sleep_type); | |
590 | PAD_ARG_(int, sleep_sec); | |
591 | PAD_ARG_(int, sleep_nsec); | |
592 | PAD_ARG_(user_addr_t, wakeup_time); | |
593 | }; | |
594 | extern kern_return_t clock_sleep_trap( | |
595 | struct clock_sleep_trap_args *args); | |
596 | ||
597 | struct thread_switch_args { | |
598 | PAD_ARG_(mach_port_name_t, thread_name); | |
599 | PAD_ARG_(int, option); | |
600 | PAD_ARG_(mach_msg_timeout_t, option_time); | |
601 | }; | |
602 | extern kern_return_t thread_switch( | |
603 | struct thread_switch_args *args); | |
604 | ||
605 | struct mach_timebase_info_trap_args { | |
606 | PAD_ARG_(user_addr_t, info); | |
607 | }; | |
608 | extern kern_return_t mach_timebase_info_trap( | |
609 | struct mach_timebase_info_trap_args *args); | |
610 | ||
611 | struct mach_wait_until_trap_args { | |
612 | PAD_ARG_(uint64_t, deadline); | |
613 | }; | |
614 | extern kern_return_t mach_wait_until_trap( | |
615 | struct mach_wait_until_trap_args *args); | |
616 | ||
617 | struct mk_timer_create_trap_args { | |
618 | int32_t dummy; | |
619 | }; | |
620 | extern mach_port_name_t mk_timer_create_trap( | |
621 | struct mk_timer_create_trap_args *args); | |
622 | ||
623 | struct mk_timer_destroy_trap_args { | |
624 | PAD_ARG_(mach_port_name_t, name); | |
625 | }; | |
626 | extern kern_return_t mk_timer_destroy_trap( | |
627 | struct mk_timer_destroy_trap_args *args); | |
628 | ||
629 | struct mk_timer_arm_trap_args { | |
630 | PAD_ARG_(mach_port_name_t, name); | |
631 | PAD_ARG_(uint64_t, expire_time); | |
632 | }; | |
633 | extern kern_return_t mk_timer_arm_trap( | |
634 | struct mk_timer_arm_trap_args *args); | |
635 | ||
636 | struct mk_timer_arm_leeway_trap_args { | |
637 | PAD_ARG_(mach_port_name_t, name); | |
638 | PAD_ARG_(uint64_t, mk_timer_flags); | |
639 | PAD_ARG_(uint64_t, expire_time); | |
640 | PAD_ARG_(uint64_t, mk_leeway); | |
641 | }; | |
642 | extern kern_return_t mk_timer_arm_leeway_trap( | |
643 | struct mk_timer_arm_leeway_trap_args *args); | |
644 | ||
645 | struct mk_timer_cancel_trap_args { | |
646 | PAD_ARG_(mach_port_name_t, name); | |
647 | PAD_ARG_(user_addr_t, result_time); | |
648 | }; | |
649 | extern kern_return_t mk_timer_cancel_trap( | |
650 | struct mk_timer_cancel_trap_args *args); | |
651 | ||
652 | struct _kernelrpc_mach_vm_allocate_trap_args { | |
653 | PAD_ARG_(mach_port_name_t, target); /* 1 word */ | |
654 | PAD_ARG_(user_addr_t, addr); /* 1 word */ | |
655 | PAD_ARG_(mach_vm_size_t, size); /* 2 words */ | |
656 | PAD_ARG_(int, flags); /* 1 word */ | |
657 | }; /* Total: 5 */ | |
658 | ||
659 | extern kern_return_t _kernelrpc_mach_vm_allocate_trap( | |
660 | struct _kernelrpc_mach_vm_allocate_trap_args *args); | |
661 | ||
662 | struct _kernelrpc_mach_vm_deallocate_args { | |
663 | PAD_ARG_(mach_port_name_t, target); /* 1 word */ | |
664 | PAD_ARG_(mach_vm_address_t, address); /* 2 words */ | |
665 | PAD_ARG_(mach_vm_size_t, size); /* 2 words */ | |
666 | }; /* Total: 5 */ | |
667 | extern kern_return_t _kernelrpc_mach_vm_deallocate_trap( | |
668 | struct _kernelrpc_mach_vm_deallocate_args *args); | |
669 | ||
670 | struct task_dyld_process_info_notify_get_trap_args { | |
671 | PAD_ARG_(mach_vm_address_t, names_addr); /* 2 words */ | |
672 | PAD_ARG_(mach_vm_address_t, names_count_addr); /* 2 words */ | |
673 | }; /* Total: 4 */ | |
674 | ||
675 | extern kern_return_t task_dyld_process_info_notify_get_trap( | |
676 | struct task_dyld_process_info_notify_get_trap_args *args); | |
677 | ||
678 | struct _kernelrpc_mach_vm_protect_args { | |
679 | PAD_ARG_(mach_port_name_t, target); /* 1 word */ | |
680 | PAD_ARG_(mach_vm_address_t, address); /* 2 words */ | |
681 | PAD_ARG_(mach_vm_size_t, size); /* 2 words */ | |
682 | PAD_ARG_(boolean_t, set_maximum); /* 1 word */ | |
683 | PAD_ARG_(vm_prot_t, new_protection); /* 1 word */ | |
684 | }; /* Total: 7 */ | |
685 | extern kern_return_t _kernelrpc_mach_vm_protect_trap( | |
686 | struct _kernelrpc_mach_vm_protect_args *args); | |
687 | ||
688 | struct _kernelrpc_mach_vm_map_trap_args { | |
689 | PAD_ARG_(mach_port_name_t, target); | |
690 | PAD_ARG_(user_addr_t, addr); | |
691 | PAD_ARG_(mach_vm_size_t, size); | |
692 | PAD_ARG_(mach_vm_offset_t, mask); | |
693 | PAD_ARG_(int, flags); | |
694 | PAD_ARG_8 | |
695 | PAD_ARG_(vm_prot_t, cur_protection); | |
696 | }; | |
697 | extern kern_return_t _kernelrpc_mach_vm_map_trap( | |
698 | struct _kernelrpc_mach_vm_map_trap_args *args); | |
699 | ||
700 | struct _kernelrpc_mach_vm_purgable_control_trap_args { | |
701 | PAD_ARG_(mach_port_name_t, target); /* 1 word */ | |
702 | PAD_ARG_(mach_vm_offset_t, address); /* 2 words */ | |
703 | PAD_ARG_(vm_purgable_t, control); /* 1 word */ | |
704 | PAD_ARG_(user_addr_t, state); /* 1 word */ | |
705 | }; /* Total: 5 */ | |
706 | ||
707 | extern kern_return_t _kernelrpc_mach_vm_purgable_control_trap( | |
708 | struct _kernelrpc_mach_vm_purgable_control_trap_args *args); | |
709 | ||
710 | struct _kernelrpc_mach_port_allocate_args { | |
711 | PAD_ARG_(mach_port_name_t, target); | |
712 | PAD_ARG_(mach_port_right_t, right); | |
713 | PAD_ARG_(user_addr_t, name); | |
714 | }; | |
715 | extern kern_return_t _kernelrpc_mach_port_allocate_trap( | |
716 | struct _kernelrpc_mach_port_allocate_args *args); | |
717 | ||
718 | struct _kernelrpc_mach_port_deallocate_args { | |
719 | PAD_ARG_(mach_port_name_t, target); | |
720 | PAD_ARG_(mach_port_name_t, name); | |
721 | }; | |
722 | extern kern_return_t _kernelrpc_mach_port_deallocate_trap( | |
723 | struct _kernelrpc_mach_port_deallocate_args *args); | |
724 | ||
725 | struct _kernelrpc_mach_port_mod_refs_args { | |
726 | PAD_ARG_(mach_port_name_t, target); | |
727 | PAD_ARG_(mach_port_name_t, name); | |
728 | PAD_ARG_(mach_port_right_t, right); | |
729 | PAD_ARG_(mach_port_delta_t, delta); | |
730 | }; | |
731 | extern kern_return_t _kernelrpc_mach_port_mod_refs_trap( | |
732 | struct _kernelrpc_mach_port_mod_refs_args *args); | |
733 | ||
734 | struct _kernelrpc_mach_port_move_member_args { | |
735 | PAD_ARG_(mach_port_name_t, target); | |
736 | PAD_ARG_(mach_port_name_t, member); | |
737 | PAD_ARG_(mach_port_name_t, after); | |
738 | }; | |
739 | extern kern_return_t _kernelrpc_mach_port_move_member_trap( | |
740 | struct _kernelrpc_mach_port_move_member_args *args); | |
741 | ||
742 | struct _kernelrpc_mach_port_insert_right_args { | |
743 | PAD_ARG_(mach_port_name_t, target); | |
744 | PAD_ARG_(mach_port_name_t, name); | |
745 | PAD_ARG_(mach_port_name_t, poly); | |
746 | PAD_ARG_(mach_msg_type_name_t, polyPoly); | |
747 | }; | |
748 | extern kern_return_t _kernelrpc_mach_port_insert_right_trap( | |
749 | struct _kernelrpc_mach_port_insert_right_args *args); | |
750 | ||
751 | struct _kernelrpc_mach_port_get_attributes_args { | |
752 | PAD_ARG_(mach_port_name_t, target); | |
753 | PAD_ARG_(mach_port_name_t, name); | |
754 | PAD_ARG_(mach_port_flavor_t, flavor); | |
755 | PAD_ARG_(user_addr_t, info); | |
756 | PAD_ARG_(user_addr_t, count); | |
757 | }; | |
758 | extern kern_return_t _kernelrpc_mach_port_get_attributes_trap( | |
759 | struct _kernelrpc_mach_port_get_attributes_args *args); | |
760 | ||
761 | struct _kernelrpc_mach_port_insert_member_args { | |
762 | PAD_ARG_(mach_port_name_t, target); | |
763 | PAD_ARG_(mach_port_name_t, name); | |
764 | PAD_ARG_(mach_port_name_t, pset); | |
765 | }; | |
766 | extern kern_return_t _kernelrpc_mach_port_insert_member_trap( | |
767 | struct _kernelrpc_mach_port_insert_member_args *args); | |
768 | ||
769 | struct _kernelrpc_mach_port_extract_member_args { | |
770 | PAD_ARG_(mach_port_name_t, target); | |
771 | PAD_ARG_(mach_port_name_t, name); | |
772 | PAD_ARG_(mach_port_name_t, pset); | |
773 | }; | |
774 | extern kern_return_t _kernelrpc_mach_port_extract_member_trap( | |
775 | struct _kernelrpc_mach_port_extract_member_args *args); | |
776 | ||
777 | struct _kernelrpc_mach_port_construct_args { | |
778 | PAD_ARG_(mach_port_name_t, target); | |
779 | PAD_ARG_(user_addr_t, options); | |
780 | PAD_ARG_(uint64_t, context); | |
781 | PAD_ARG_(user_addr_t, name); | |
782 | }; | |
783 | extern kern_return_t _kernelrpc_mach_port_construct_trap( | |
784 | struct _kernelrpc_mach_port_construct_args *args); | |
785 | ||
786 | struct _kernelrpc_mach_port_destruct_args { | |
787 | PAD_ARG_(mach_port_name_t, target); | |
788 | PAD_ARG_(mach_port_name_t, name); | |
789 | PAD_ARG_(mach_port_delta_t, srdelta); | |
790 | PAD_ARG_(uint64_t, guard); | |
791 | }; | |
792 | extern kern_return_t _kernelrpc_mach_port_destruct_trap( | |
793 | struct _kernelrpc_mach_port_destruct_args *args); | |
794 | ||
795 | struct _kernelrpc_mach_port_guard_args { | |
796 | PAD_ARG_(mach_port_name_t, target); | |
797 | PAD_ARG_(mach_port_name_t, name); | |
798 | PAD_ARG_(uint64_t, guard); | |
799 | PAD_ARG_(boolean_t, strict); | |
800 | }; | |
801 | extern kern_return_t _kernelrpc_mach_port_guard_trap( | |
802 | struct _kernelrpc_mach_port_guard_args *args); | |
803 | ||
804 | struct _kernelrpc_mach_port_unguard_args { | |
805 | PAD_ARG_(mach_port_name_t, target); | |
806 | PAD_ARG_(mach_port_name_t, name); | |
807 | PAD_ARG_(uint64_t, guard); | |
808 | }; | |
809 | extern kern_return_t _kernelrpc_mach_port_unguard_trap( | |
810 | struct _kernelrpc_mach_port_unguard_args *args); | |
811 | ||
812 | struct mach_generate_activity_id_args { | |
813 | PAD_ARG_(mach_port_name_t, target); | |
814 | PAD_ARG_(int, count); | |
815 | PAD_ARG_(user_addr_t, activity_id); | |
816 | }; | |
817 | extern kern_return_t mach_generate_activity_id( | |
818 | struct mach_generate_activity_id_args *args); | |
819 | ||
820 | /* | |
821 | * Voucher trap interfaces | |
822 | */ | |
823 | ||
824 | struct host_create_mach_voucher_args { | |
825 | PAD_ARG_(mach_port_name_t, host); | |
826 | PAD_ARG_(mach_voucher_attr_raw_recipe_array_t, recipes); | |
827 | PAD_ARG_(int, recipes_size); | |
828 | PAD_ARG_(user_addr_t, voucher); | |
829 | }; | |
830 | extern kern_return_t host_create_mach_voucher_trap( | |
831 | struct host_create_mach_voucher_args *args); | |
832 | ||
833 | struct mach_voucher_extract_attr_recipe_args { | |
834 | PAD_ARG_(mach_port_name_t, voucher_name); | |
835 | PAD_ARG_(mach_voucher_attr_key_t, key); | |
836 | PAD_ARG_(mach_voucher_attr_raw_recipe_t, recipe); | |
837 | PAD_ARG_(user_addr_t, recipe_size); | |
838 | }; | |
839 | ||
840 | extern kern_return_t mach_voucher_extract_attr_recipe_trap( | |
841 | struct mach_voucher_extract_attr_recipe_args *args); | |
842 | ||
843 | struct _kernelrpc_mach_port_type_args { | |
844 | PAD_ARG_(mach_port_name_t, target); | |
845 | PAD_ARG_(mach_port_right_t, name); | |
846 | PAD_ARG_(user_addr_t, ptype); | |
847 | }; | |
848 | extern kern_return_t _kernelrpc_mach_port_type_trap( | |
849 | struct _kernelrpc_mach_port_type_args *args); | |
850 | ||
851 | struct _kernelrpc_mach_port_request_notification_args { | |
852 | PAD_ARG_(mach_port_name_t, target); | |
853 | PAD_ARG_(mach_port_name_t, name); | |
854 | PAD_ARG_(mach_msg_id_t, msgid); | |
855 | PAD_ARG_(mach_port_mscount_t, sync); | |
856 | PAD_ARG_(mach_port_name_t, notify); | |
857 | PAD_ARG_(mach_msg_type_name_t, notifyPoly); | |
858 | PAD_ARG_(user_addr_t, previous); | |
859 | }; | |
860 | extern kern_return_t _kernelrpc_mach_port_request_notification_trap( | |
861 | struct _kernelrpc_mach_port_request_notification_args *args); | |
862 | ||
863 | ||
864 | /* not published to LP64 clients yet */ | |
865 | struct iokit_user_client_trap_args { | |
866 | PAD_ARG_(void *, userClientRef); | |
867 | PAD_ARG_(uint32_t, index); | |
868 | PAD_ARG_(void *, p1); | |
869 | PAD_ARG_(void *, p2); | |
870 | PAD_ARG_(void *, p3); | |
871 | PAD_ARG_(void *, p4); | |
872 | PAD_ARG_(void *, p5); | |
873 | PAD_ARG_8 | |
874 | PAD_ARG_(void *, p6); | |
875 | }; | |
876 | kern_return_t iokit_user_client_trap( | |
877 | struct iokit_user_client_trap_args *args); | |
878 | ||
879 | #undef PAD_ | |
880 | #undef PADL_ | |
881 | #undef PADR_ | |
882 | #undef PAD_ARG_ | |
883 | #undef PAD_ARG_8 | |
884 | ||
885 | #endif /* XNU_KERNEL_PRIVATE */ | |
886 | ||
887 | #endif /* KERNEL */ | |
888 | ||
889 | __END_DECLS | |
890 | ||
891 | #endif /* _MACH_MACH_TRAPS_H_ */ |