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 | #if defined(__LP64__) || defined(__arm64__) |
106 | extern mach_msg_return_t mach_msg2_trap( |
107 | void *data, |
108 | mach_msg_option64_t options, |
109 | uint64_t msgh_bits_and_send_size, |
110 | uint64_t msgh_remote_and_local_port, |
111 | uint64_t msgh_voucher_and_id, |
112 | uint64_t desc_count_and_rcv_name, |
113 | uint64_t rcv_size_and_priority, |
114 | uint64_t timeout); |
115 | #endif |
116 | |
117 | extern mach_msg_return_t mach_msg_overwrite_trap( |
118 | mach_msg_header_t *msg, |
119 | mach_msg_option_t option, |
120 | mach_msg_size_t send_size, |
121 | mach_msg_size_t rcv_size, |
122 | mach_port_name_t rcv_name, |
123 | mach_msg_timeout_t timeout, |
124 | mach_msg_priority_t priority, |
125 | mach_msg_header_t *rcv_msg, |
126 | mach_msg_size_t rcv_limit); |
127 | |
128 | extern kern_return_t semaphore_signal_trap( |
129 | mach_port_name_t signal_name); |
130 | |
131 | extern kern_return_t semaphore_signal_all_trap( |
132 | mach_port_name_t signal_name); |
133 | |
134 | extern kern_return_t semaphore_signal_thread_trap( |
135 | mach_port_name_t signal_name, |
136 | mach_port_name_t thread_name); |
137 | |
138 | extern kern_return_t semaphore_wait_trap( |
139 | mach_port_name_t wait_name); |
140 | |
141 | extern kern_return_t semaphore_wait_signal_trap( |
142 | mach_port_name_t wait_name, |
143 | mach_port_name_t signal_name); |
144 | |
145 | extern kern_return_t semaphore_timedwait_trap( |
146 | mach_port_name_t wait_name, |
147 | unsigned int sec, |
148 | clock_res_t nsec); |
149 | |
150 | extern kern_return_t semaphore_timedwait_signal_trap( |
151 | mach_port_name_t wait_name, |
152 | mach_port_name_t signal_name, |
153 | unsigned int sec, |
154 | clock_res_t nsec); |
155 | |
156 | #endif /* PRIVATE */ |
157 | |
158 | extern kern_return_t clock_sleep_trap( |
159 | mach_port_name_t clock_name, |
160 | sleep_type_t sleep_type, |
161 | int sleep_sec, |
162 | int sleep_nsec, |
163 | mach_timespec_t *wakeup_time); |
164 | |
165 | extern kern_return_t _kernelrpc_mach_vm_allocate_trap( |
166 | mach_port_name_t target, |
167 | mach_vm_offset_t *addr, |
168 | mach_vm_size_t size, |
169 | int flags); |
170 | |
171 | extern kern_return_t _kernelrpc_mach_vm_deallocate_trap( |
172 | mach_port_name_t target, |
173 | mach_vm_address_t address, |
174 | mach_vm_size_t size |
175 | ); |
176 | |
177 | extern kern_return_t task_dyld_process_info_notify_get( |
178 | mach_port_name_array_t names_addr, |
179 | natural_t *names_count_addr |
180 | ); |
181 | |
182 | extern kern_return_t _kernelrpc_mach_vm_protect_trap( |
183 | mach_port_name_t target, |
184 | mach_vm_address_t address, |
185 | mach_vm_size_t size, |
186 | boolean_t set_maximum, |
187 | vm_prot_t new_protection |
188 | ); |
189 | |
190 | extern kern_return_t _kernelrpc_mach_vm_map_trap( |
191 | mach_port_name_t target, |
192 | mach_vm_offset_t *address, |
193 | mach_vm_size_t size, |
194 | mach_vm_offset_t mask, |
195 | int flags, |
196 | vm_prot_t cur_protection |
197 | ); |
198 | |
199 | extern kern_return_t _kernelrpc_mach_vm_purgable_control_trap( |
200 | mach_port_name_t target, |
201 | mach_vm_offset_t address, |
202 | vm_purgable_t control, |
203 | int *state); |
204 | |
205 | extern kern_return_t _kernelrpc_mach_port_allocate_trap( |
206 | mach_port_name_t target, |
207 | mach_port_right_t right, |
208 | mach_port_name_t *name |
209 | ); |
210 | |
211 | extern kern_return_t _kernelrpc_mach_port_deallocate_trap( |
212 | mach_port_name_t target, |
213 | mach_port_name_t name |
214 | ); |
215 | |
216 | extern kern_return_t _kernelrpc_mach_port_mod_refs_trap( |
217 | mach_port_name_t target, |
218 | mach_port_name_t name, |
219 | mach_port_right_t right, |
220 | mach_port_delta_t delta |
221 | ); |
222 | |
223 | extern kern_return_t _kernelrpc_mach_port_move_member_trap( |
224 | mach_port_name_t target, |
225 | mach_port_name_t member, |
226 | mach_port_name_t after |
227 | ); |
228 | |
229 | extern kern_return_t _kernelrpc_mach_port_insert_right_trap( |
230 | mach_port_name_t target, |
231 | mach_port_name_t name, |
232 | mach_port_name_t poly, |
233 | mach_msg_type_name_t polyPoly |
234 | ); |
235 | |
236 | extern kern_return_t _kernelrpc_mach_port_get_attributes_trap( |
237 | mach_port_name_t target, |
238 | mach_port_name_t name, |
239 | mach_port_flavor_t flavor, |
240 | mach_port_info_t port_info_out, |
241 | mach_msg_type_number_t *port_info_outCnt |
242 | ); |
243 | |
244 | extern kern_return_t _kernelrpc_mach_port_insert_member_trap( |
245 | mach_port_name_t target, |
246 | mach_port_name_t name, |
247 | mach_port_name_t pset |
248 | ); |
249 | |
250 | extern kern_return_t _kernelrpc_mach_port_extract_member_trap( |
251 | mach_port_name_t target, |
252 | mach_port_name_t name, |
253 | mach_port_name_t pset |
254 | ); |
255 | |
256 | extern kern_return_t _kernelrpc_mach_port_construct_trap( |
257 | mach_port_name_t target, |
258 | mach_port_options_t *options, |
259 | uint64_t context, |
260 | mach_port_name_t *name |
261 | ); |
262 | |
263 | extern kern_return_t _kernelrpc_mach_port_destruct_trap( |
264 | mach_port_name_t target, |
265 | mach_port_name_t name, |
266 | mach_port_delta_t srdelta, |
267 | uint64_t guard |
268 | ); |
269 | |
270 | extern kern_return_t _kernelrpc_mach_port_guard_trap( |
271 | mach_port_name_t target, |
272 | mach_port_name_t name, |
273 | uint64_t guard, |
274 | boolean_t strict |
275 | ); |
276 | |
277 | extern kern_return_t _kernelrpc_mach_port_unguard_trap( |
278 | mach_port_name_t target, |
279 | mach_port_name_t name, |
280 | uint64_t guard |
281 | ); |
282 | |
283 | extern kern_return_t mach_generate_activity_id( |
284 | mach_port_name_t target, |
285 | int count, |
286 | uint64_t *activity_id |
287 | ); |
288 | |
289 | extern kern_return_t macx_swapon( |
290 | uint64_t filename, |
291 | int flags, |
292 | int size, |
293 | int priority); |
294 | |
295 | extern kern_return_t macx_swapoff( |
296 | uint64_t filename, |
297 | int flags); |
298 | |
299 | extern kern_return_t macx_triggers( |
300 | int hi_water, |
301 | int low_water, |
302 | int flags, |
303 | mach_port_t alert_port); |
304 | |
305 | extern kern_return_t macx_backing_store_suspend( |
306 | boolean_t suspend); |
307 | |
308 | extern kern_return_t macx_backing_store_recovery( |
309 | int pid); |
310 | |
311 | extern boolean_t swtch_pri(int pri); |
312 | |
313 | extern boolean_t swtch(void); |
314 | |
315 | extern kern_return_t thread_switch( |
316 | mach_port_name_t thread_name, |
317 | int option, |
318 | mach_msg_timeout_t option_time); |
319 | |
320 | extern mach_port_name_t task_self_trap(void); |
321 | |
322 | extern kern_return_t host_create_mach_voucher_trap( |
323 | mach_port_name_t host, |
324 | mach_voucher_attr_raw_recipe_array_t recipes, |
325 | int recipes_size, |
326 | mach_port_name_t *voucher); |
327 | |
328 | extern kern_return_t mach_voucher_extract_attr_recipe_trap( |
329 | mach_port_name_t voucher_name, |
330 | mach_voucher_attr_key_t key, |
331 | mach_voucher_attr_raw_recipe_t recipe, |
332 | mach_msg_type_number_t *recipe_size); |
333 | |
334 | extern kern_return_t _kernelrpc_mach_port_type_trap( |
335 | ipc_space_t task, |
336 | mach_port_name_t name, |
337 | mach_port_type_t *ptype); |
338 | |
339 | extern kern_return_t _kernelrpc_mach_port_request_notification_trap( |
340 | ipc_space_t task, |
341 | mach_port_name_t name, |
342 | mach_msg_id_t msgid, |
343 | mach_port_mscount_t sync, |
344 | mach_port_name_t notify, |
345 | mach_msg_type_name_t notifyPoly, |
346 | mach_port_name_t *previous); |
347 | |
348 | /* |
349 | * Obsolete interfaces. |
350 | */ |
351 | |
352 | extern kern_return_t task_for_pid( |
353 | mach_port_name_t target_tport, |
354 | int pid, |
355 | mach_port_name_t *t); |
356 | |
357 | extern kern_return_t task_name_for_pid( |
358 | mach_port_name_t target_tport, |
359 | int pid, |
360 | mach_port_name_t *tn); |
361 | |
362 | extern kern_return_t pid_for_task( |
363 | mach_port_name_t t, |
364 | int *x); |
365 | |
366 | extern kern_return_t debug_control_port_for_pid( |
367 | mach_port_name_t target_tport, |
368 | int pid, |
369 | mach_port_name_t *t); |
370 | |
371 | #else /* KERNEL */ |
372 | |
373 | #ifdef XNU_KERNEL_PRIVATE |
374 | |
375 | /* Syscall data translations routines |
376 | * |
377 | * The kernel may support multiple userspace ABIs, and must use |
378 | * argument structures with elements large enough for any of them. |
379 | */ |
380 | #if CONFIG_REQUIRES_U32_MUNGING |
381 | #define PAD_(t) (sizeof(uint64_t) <= sizeof(t) \ |
382 | ? 0 : sizeof(uint64_t) - sizeof(t)) |
383 | #define PAD_ARG_8 |
384 | #else |
385 | #define PAD_(t) (sizeof(uint32_t) <= sizeof(t) \ |
386 | ? 0 : sizeof(uint32_t) - sizeof(t)) |
387 | #if __arm__ && (__BIGGEST_ALIGNMENT__ > 4) |
388 | #define PAD_ARG_8 |
389 | #else |
390 | #define PAD_ARG_8 char arg8_pad_[sizeof(uint32_t)]; |
391 | #endif |
392 | #endif |
393 | |
394 | #if BYTE_ORDER == LITTLE_ENDIAN |
395 | #define PADL_(t) 0 |
396 | #define PADR_(t) PAD_(t) |
397 | #else |
398 | #define PADL_(t) PAD_(t) |
399 | #define PADR_(t) 0 |
400 | #endif |
401 | |
402 | #define PAD_ARG_(arg_type, arg_name) \ |
403 | char arg_name##_l_[PADL_(arg_type)]; arg_type arg_name; char arg_name##_r_[PADR_(arg_type)] |
404 | |
405 | /* |
406 | * To support 32-bit clients as well as 64-bit clients, argument |
407 | * structures may need to be munged to repack the arguments. All |
408 | * active architectures do this inline in the code to dispatch Mach |
409 | * traps, without calling out to the BSD system call mungers. |
410 | */ |
411 | |
412 | struct kern_invalid_args { |
413 | int32_t dummy; |
414 | }; |
415 | extern kern_return_t kern_invalid( |
416 | struct kern_invalid_args *args); |
417 | |
418 | struct mach_reply_port_args { |
419 | int32_t dummy; |
420 | }; |
421 | extern mach_port_name_t mach_reply_port( |
422 | struct mach_reply_port_args *args); |
423 | |
424 | struct thread_get_special_reply_port_args { |
425 | int32_t dummy; |
426 | }; |
427 | extern mach_port_name_t thread_get_special_reply_port( |
428 | struct thread_get_special_reply_port_args *args); |
429 | |
430 | struct thread_self_trap_args { |
431 | int32_t dummy; |
432 | }; |
433 | extern mach_port_name_t thread_self_trap( |
434 | struct thread_self_trap_args *args); |
435 | |
436 | struct task_self_trap_args { |
437 | int32_t dummy; |
438 | }; |
439 | extern mach_port_name_t task_self_trap( |
440 | struct task_self_trap_args *args); |
441 | |
442 | struct host_self_trap_args { |
443 | int32_t dummy; |
444 | }; |
445 | extern mach_port_name_t host_self_trap( |
446 | struct host_self_trap_args *args); |
447 | |
448 | struct mach_msg_overwrite_trap_args { |
449 | PAD_ARG_(user_addr_t, msg); |
450 | PAD_ARG_(mach_msg_option_t, option); |
451 | PAD_ARG_(mach_msg_size_t, send_size); |
452 | PAD_ARG_(mach_msg_size_t, rcv_size); |
453 | PAD_ARG_(mach_port_name_t, rcv_name); |
454 | PAD_ARG_(mach_msg_timeout_t, timeout); |
455 | PAD_ARG_(mach_msg_priority_t, priority); |
456 | PAD_ARG_8 |
457 | PAD_ARG_(user_addr_t, rcv_msg); /* Unused on mach_msg_trap */ |
458 | }; |
459 | extern mach_msg_return_t mach_msg_trap( |
460 | struct mach_msg_overwrite_trap_args *args); |
461 | extern mach_msg_return_t mach_msg_overwrite_trap( |
462 | struct mach_msg_overwrite_trap_args *args); |
463 | |
464 | #if defined(__LP64__) || defined(__arm64__) |
465 | struct mach_msg2_trap_args { |
466 | PAD_ARG_(mach_vm_address_t, data); |
467 | PAD_ARG_(mach_msg_option64_t, options); |
468 | PAD_ARG_(uint64_t, msgh_bits_and_send_size); |
469 | PAD_ARG_(uint64_t, msgh_remote_and_local_port); |
470 | PAD_ARG_(uint64_t, msgh_voucher_and_id); |
471 | PAD_ARG_(uint64_t, desc_count_and_rcv_name); |
472 | PAD_ARG_(uint64_t, rcv_size_and_priority); |
473 | PAD_ARG_(uint64_t, timeout); |
474 | }; |
475 | |
476 | extern mach_msg_return_t mach_msg2_trap( |
477 | struct mach_msg2_trap_args *args); |
478 | #endif |
479 | |
480 | struct semaphore_signal_trap_args { |
481 | PAD_ARG_(mach_port_name_t, signal_name); |
482 | }; |
483 | extern kern_return_t semaphore_signal_trap( |
484 | struct semaphore_signal_trap_args *args); |
485 | |
486 | struct semaphore_signal_all_trap_args { |
487 | PAD_ARG_(mach_port_name_t, signal_name); |
488 | }; |
489 | extern kern_return_t semaphore_signal_all_trap( |
490 | struct semaphore_signal_all_trap_args *args); |
491 | |
492 | struct semaphore_signal_thread_trap_args { |
493 | PAD_ARG_(mach_port_name_t, signal_name); |
494 | PAD_ARG_(mach_port_name_t, thread_name); |
495 | }; |
496 | extern kern_return_t semaphore_signal_thread_trap( |
497 | struct semaphore_signal_thread_trap_args *args); |
498 | |
499 | struct semaphore_wait_trap_args { |
500 | PAD_ARG_(mach_port_name_t, wait_name); |
501 | }; |
502 | extern kern_return_t semaphore_wait_trap( |
503 | struct semaphore_wait_trap_args *args); |
504 | |
505 | struct semaphore_wait_signal_trap_args { |
506 | PAD_ARG_(mach_port_name_t, wait_name); |
507 | PAD_ARG_(mach_port_name_t, signal_name); |
508 | }; |
509 | extern kern_return_t semaphore_wait_signal_trap( |
510 | struct semaphore_wait_signal_trap_args *args); |
511 | |
512 | struct semaphore_timedwait_trap_args { |
513 | PAD_ARG_(mach_port_name_t, wait_name); |
514 | PAD_ARG_(unsigned int, sec); |
515 | PAD_ARG_(clock_res_t, nsec); |
516 | }; |
517 | extern kern_return_t semaphore_timedwait_trap( |
518 | struct semaphore_timedwait_trap_args *args); |
519 | |
520 | struct semaphore_timedwait_signal_trap_args { |
521 | PAD_ARG_(mach_port_name_t, wait_name); |
522 | PAD_ARG_(mach_port_name_t, signal_name); |
523 | PAD_ARG_(unsigned int, sec); |
524 | PAD_ARG_(clock_res_t, nsec); |
525 | }; |
526 | extern kern_return_t semaphore_timedwait_signal_trap( |
527 | struct semaphore_timedwait_signal_trap_args *args); |
528 | |
529 | struct task_for_pid_args { |
530 | PAD_ARG_(mach_port_name_t, target_tport); |
531 | PAD_ARG_(int, pid); |
532 | PAD_ARG_(user_addr_t, t); |
533 | }; |
534 | extern kern_return_t task_for_pid( |
535 | struct task_for_pid_args *args); |
536 | |
537 | struct task_name_for_pid_args { |
538 | PAD_ARG_(mach_port_name_t, target_tport); |
539 | PAD_ARG_(int, pid); |
540 | PAD_ARG_(user_addr_t, t); |
541 | }; |
542 | extern kern_return_t task_name_for_pid( |
543 | struct task_name_for_pid_args *args); |
544 | |
545 | struct pid_for_task_args { |
546 | PAD_ARG_(mach_port_name_t, t); |
547 | PAD_ARG_(user_addr_t, pid); |
548 | }; |
549 | extern kern_return_t pid_for_task( |
550 | struct pid_for_task_args *args); |
551 | |
552 | struct debug_control_port_for_pid_args { |
553 | PAD_ARG_(mach_port_name_t, target_tport); |
554 | PAD_ARG_(int, pid); |
555 | PAD_ARG_(user_addr_t, t); |
556 | }; |
557 | extern kern_return_t debug_control_port_for_pid( |
558 | struct debug_control_port_for_pid_args *args); |
559 | |
560 | struct macx_swapon_args { |
561 | PAD_ARG_(uint64_t, filename); |
562 | PAD_ARG_(int, flags); |
563 | PAD_ARG_(int, size); |
564 | PAD_ARG_(int, priority); |
565 | }; |
566 | extern kern_return_t macx_swapon( |
567 | struct macx_swapon_args *args); |
568 | |
569 | struct macx_swapoff_args { |
570 | PAD_ARG_(uint64_t, filename); |
571 | PAD_ARG_(int, flags); |
572 | }; |
573 | extern kern_return_t macx_swapoff( |
574 | struct macx_swapoff_args *args); |
575 | |
576 | struct macx_triggers_args { |
577 | PAD_ARG_(int, hi_water); |
578 | PAD_ARG_(int, low_water); |
579 | PAD_ARG_(int, flags); |
580 | PAD_ARG_(mach_port_t, alert_port); |
581 | }; |
582 | extern kern_return_t macx_triggers( |
583 | struct macx_triggers_args *args); |
584 | |
585 | struct macx_backing_store_suspend_args { |
586 | PAD_ARG_(boolean_t, suspend); |
587 | }; |
588 | extern kern_return_t macx_backing_store_suspend( |
589 | struct macx_backing_store_suspend_args *args); |
590 | |
591 | struct macx_backing_store_recovery_args { |
592 | PAD_ARG_(int, pid); |
593 | }; |
594 | extern kern_return_t macx_backing_store_recovery( |
595 | struct macx_backing_store_recovery_args *args); |
596 | |
597 | struct swtch_pri_args { |
598 | PAD_ARG_(int, pri); |
599 | }; |
600 | extern boolean_t swtch_pri( |
601 | struct swtch_pri_args *args); |
602 | |
603 | struct pfz_exit_args { |
604 | int32_t dummy; |
605 | }; |
606 | extern kern_return_t pfz_exit( |
607 | struct pfz_exit_args *args); |
608 | |
609 | struct swtch_args { |
610 | int32_t dummy; |
611 | }; |
612 | extern boolean_t swtch( |
613 | struct swtch_args *args); |
614 | |
615 | struct clock_sleep_trap_args { |
616 | PAD_ARG_(mach_port_name_t, clock_name); |
617 | PAD_ARG_(sleep_type_t, sleep_type); |
618 | PAD_ARG_(int, sleep_sec); |
619 | PAD_ARG_(int, sleep_nsec); |
620 | PAD_ARG_(user_addr_t, wakeup_time); |
621 | }; |
622 | extern kern_return_t clock_sleep_trap( |
623 | struct clock_sleep_trap_args *args); |
624 | |
625 | struct thread_switch_args { |
626 | PAD_ARG_(mach_port_name_t, thread_name); |
627 | PAD_ARG_(int, option); |
628 | PAD_ARG_(mach_msg_timeout_t, option_time); |
629 | }; |
630 | extern kern_return_t thread_switch( |
631 | struct thread_switch_args *args); |
632 | |
633 | struct exclaves_ctl_trap_args { |
634 | PAD_ARG_(mach_port_name_t, name); |
635 | PAD_ARG_(uint32_t, operation_and_flags); |
636 | PAD_ARG_(uint64_t, identifier); |
637 | PAD_ARG_(mach_vm_address_t, buffer); |
638 | PAD_ARG_(mach_vm_size_t, size); |
639 | PAD_ARG_(mach_vm_size_t, size2); |
640 | PAD_ARG_(mach_vm_size_t, offset); |
641 | }; |
642 | extern kern_return_t _exclaves_ctl_trap( |
643 | struct exclaves_ctl_trap_args *args); |
644 | |
645 | struct mach_timebase_info_trap_args { |
646 | PAD_ARG_(user_addr_t, info); |
647 | }; |
648 | extern kern_return_t mach_timebase_info_trap( |
649 | struct mach_timebase_info_trap_args *args); |
650 | |
651 | struct mach_wait_until_trap_args { |
652 | PAD_ARG_(uint64_t, deadline); |
653 | }; |
654 | extern kern_return_t mach_wait_until_trap( |
655 | struct mach_wait_until_trap_args *args); |
656 | |
657 | struct mk_timer_create_trap_args { |
658 | int32_t dummy; |
659 | }; |
660 | extern mach_port_name_t mk_timer_create_trap( |
661 | struct mk_timer_create_trap_args *args); |
662 | |
663 | struct mk_timer_destroy_trap_args { |
664 | PAD_ARG_(mach_port_name_t, name); |
665 | }; |
666 | extern kern_return_t mk_timer_destroy_trap( |
667 | struct mk_timer_destroy_trap_args *args); |
668 | |
669 | struct mk_timer_arm_trap_args { |
670 | PAD_ARG_(mach_port_name_t, name); |
671 | PAD_ARG_(uint64_t, expire_time); |
672 | }; |
673 | extern kern_return_t mk_timer_arm_trap( |
674 | struct mk_timer_arm_trap_args *args); |
675 | |
676 | struct mk_timer_arm_leeway_trap_args { |
677 | PAD_ARG_(mach_port_name_t, name); |
678 | PAD_ARG_(uint64_t, mk_timer_flags); |
679 | PAD_ARG_(uint64_t, expire_time); |
680 | PAD_ARG_(uint64_t, mk_leeway); |
681 | }; |
682 | extern kern_return_t mk_timer_arm_leeway_trap( |
683 | struct mk_timer_arm_leeway_trap_args *args); |
684 | |
685 | struct mk_timer_cancel_trap_args { |
686 | PAD_ARG_(mach_port_name_t, name); |
687 | PAD_ARG_(user_addr_t, result_time); |
688 | }; |
689 | extern kern_return_t mk_timer_cancel_trap( |
690 | struct mk_timer_cancel_trap_args *args); |
691 | |
692 | struct _kernelrpc_mach_vm_allocate_trap_args { |
693 | PAD_ARG_(mach_port_name_t, target); /* 1 word */ |
694 | PAD_ARG_(user_addr_t, addr); /* 1 word */ |
695 | PAD_ARG_(mach_vm_size_t, size); /* 2 words */ |
696 | PAD_ARG_(int, flags); /* 1 word */ |
697 | }; /* Total: 5 */ |
698 | |
699 | extern kern_return_t _kernelrpc_mach_vm_allocate_trap( |
700 | struct _kernelrpc_mach_vm_allocate_trap_args *args); |
701 | |
702 | struct _kernelrpc_mach_vm_deallocate_args { |
703 | PAD_ARG_(mach_port_name_t, target); /* 1 word */ |
704 | PAD_ARG_(mach_vm_address_t, address); /* 2 words */ |
705 | PAD_ARG_(mach_vm_size_t, size); /* 2 words */ |
706 | }; /* Total: 5 */ |
707 | extern kern_return_t _kernelrpc_mach_vm_deallocate_trap( |
708 | struct _kernelrpc_mach_vm_deallocate_args *args); |
709 | |
710 | struct task_dyld_process_info_notify_get_trap_args { |
711 | PAD_ARG_(mach_vm_address_t, names_addr); /* 2 words */ |
712 | PAD_ARG_(mach_vm_address_t, names_count_addr); /* 2 words */ |
713 | }; /* Total: 4 */ |
714 | |
715 | extern kern_return_t task_dyld_process_info_notify_get_trap( |
716 | struct task_dyld_process_info_notify_get_trap_args *args); |
717 | |
718 | struct _kernelrpc_mach_vm_protect_args { |
719 | PAD_ARG_(mach_port_name_t, target); /* 1 word */ |
720 | PAD_ARG_(mach_vm_address_t, address); /* 2 words */ |
721 | PAD_ARG_(mach_vm_size_t, size); /* 2 words */ |
722 | PAD_ARG_(boolean_t, set_maximum); /* 1 word */ |
723 | PAD_ARG_(vm_prot_t, new_protection); /* 1 word */ |
724 | }; /* Total: 7 */ |
725 | extern kern_return_t _kernelrpc_mach_vm_protect_trap( |
726 | struct _kernelrpc_mach_vm_protect_args *args); |
727 | |
728 | struct _kernelrpc_mach_vm_map_trap_args { |
729 | PAD_ARG_(mach_port_name_t, target); |
730 | PAD_ARG_(user_addr_t, addr); |
731 | PAD_ARG_(mach_vm_size_t, size); |
732 | PAD_ARG_(mach_vm_offset_t, mask); |
733 | PAD_ARG_(int, flags); |
734 | PAD_ARG_8 |
735 | PAD_ARG_(vm_prot_t, cur_protection); |
736 | }; |
737 | extern kern_return_t _kernelrpc_mach_vm_map_trap( |
738 | struct _kernelrpc_mach_vm_map_trap_args *args); |
739 | |
740 | struct _kernelrpc_mach_vm_purgable_control_trap_args { |
741 | PAD_ARG_(mach_port_name_t, target); /* 1 word */ |
742 | PAD_ARG_(mach_vm_offset_t, address); /* 2 words */ |
743 | PAD_ARG_(vm_purgable_t, control); /* 1 word */ |
744 | PAD_ARG_(user_addr_t, state); /* 1 word */ |
745 | }; /* Total: 5 */ |
746 | |
747 | extern kern_return_t _kernelrpc_mach_vm_purgable_control_trap( |
748 | struct _kernelrpc_mach_vm_purgable_control_trap_args *args); |
749 | |
750 | struct _kernelrpc_mach_port_allocate_args { |
751 | PAD_ARG_(mach_port_name_t, target); |
752 | PAD_ARG_(mach_port_right_t, right); |
753 | PAD_ARG_(user_addr_t, name); |
754 | }; |
755 | extern kern_return_t _kernelrpc_mach_port_allocate_trap( |
756 | struct _kernelrpc_mach_port_allocate_args *args); |
757 | |
758 | struct _kernelrpc_mach_port_deallocate_args { |
759 | PAD_ARG_(mach_port_name_t, target); |
760 | PAD_ARG_(mach_port_name_t, name); |
761 | }; |
762 | extern kern_return_t _kernelrpc_mach_port_deallocate_trap( |
763 | struct _kernelrpc_mach_port_deallocate_args *args); |
764 | |
765 | struct _kernelrpc_mach_port_mod_refs_args { |
766 | PAD_ARG_(mach_port_name_t, target); |
767 | PAD_ARG_(mach_port_name_t, name); |
768 | PAD_ARG_(mach_port_right_t, right); |
769 | PAD_ARG_(mach_port_delta_t, delta); |
770 | }; |
771 | extern kern_return_t _kernelrpc_mach_port_mod_refs_trap( |
772 | struct _kernelrpc_mach_port_mod_refs_args *args); |
773 | |
774 | struct _kernelrpc_mach_port_move_member_args { |
775 | PAD_ARG_(mach_port_name_t, target); |
776 | PAD_ARG_(mach_port_name_t, member); |
777 | PAD_ARG_(mach_port_name_t, after); |
778 | }; |
779 | extern kern_return_t _kernelrpc_mach_port_move_member_trap( |
780 | struct _kernelrpc_mach_port_move_member_args *args); |
781 | |
782 | struct _kernelrpc_mach_port_insert_right_args { |
783 | PAD_ARG_(mach_port_name_t, target); |
784 | PAD_ARG_(mach_port_name_t, name); |
785 | PAD_ARG_(mach_port_name_t, poly); |
786 | PAD_ARG_(mach_msg_type_name_t, polyPoly); |
787 | }; |
788 | extern kern_return_t _kernelrpc_mach_port_insert_right_trap( |
789 | struct _kernelrpc_mach_port_insert_right_args *args); |
790 | |
791 | struct _kernelrpc_mach_port_get_attributes_args { |
792 | PAD_ARG_(mach_port_name_t, target); |
793 | PAD_ARG_(mach_port_name_t, name); |
794 | PAD_ARG_(mach_port_flavor_t, flavor); |
795 | PAD_ARG_(user_addr_t, info); |
796 | PAD_ARG_(user_addr_t, count); |
797 | }; |
798 | extern kern_return_t _kernelrpc_mach_port_get_attributes_trap( |
799 | struct _kernelrpc_mach_port_get_attributes_args *args); |
800 | |
801 | struct _kernelrpc_mach_port_insert_member_args { |
802 | PAD_ARG_(mach_port_name_t, target); |
803 | PAD_ARG_(mach_port_name_t, name); |
804 | PAD_ARG_(mach_port_name_t, pset); |
805 | }; |
806 | extern kern_return_t _kernelrpc_mach_port_insert_member_trap( |
807 | struct _kernelrpc_mach_port_insert_member_args *args); |
808 | |
809 | struct { |
810 | PAD_ARG_(mach_port_name_t, ); |
811 | PAD_ARG_(mach_port_name_t, ); |
812 | PAD_ARG_(mach_port_name_t, ); |
813 | }; |
814 | extern kern_return_t ( |
815 | struct _kernelrpc_mach_port_extract_member_args *args); |
816 | |
817 | struct _kernelrpc_mach_port_construct_args { |
818 | PAD_ARG_(mach_port_name_t, target); |
819 | PAD_ARG_(user_addr_t, options); |
820 | PAD_ARG_(uint64_t, context); |
821 | PAD_ARG_(user_addr_t, name); |
822 | }; |
823 | extern kern_return_t _kernelrpc_mach_port_construct_trap( |
824 | struct _kernelrpc_mach_port_construct_args *args); |
825 | |
826 | struct _kernelrpc_mach_port_destruct_args { |
827 | PAD_ARG_(mach_port_name_t, target); |
828 | PAD_ARG_(mach_port_name_t, name); |
829 | PAD_ARG_(mach_port_delta_t, srdelta); |
830 | PAD_ARG_(uint64_t, guard); |
831 | }; |
832 | extern kern_return_t _kernelrpc_mach_port_destruct_trap( |
833 | struct _kernelrpc_mach_port_destruct_args *args); |
834 | |
835 | struct _kernelrpc_mach_port_guard_args { |
836 | PAD_ARG_(mach_port_name_t, target); |
837 | PAD_ARG_(mach_port_name_t, name); |
838 | PAD_ARG_(uint64_t, guard); |
839 | PAD_ARG_(boolean_t, strict); |
840 | }; |
841 | extern kern_return_t _kernelrpc_mach_port_guard_trap( |
842 | struct _kernelrpc_mach_port_guard_args *args); |
843 | |
844 | struct _kernelrpc_mach_port_unguard_args { |
845 | PAD_ARG_(mach_port_name_t, target); |
846 | PAD_ARG_(mach_port_name_t, name); |
847 | PAD_ARG_(uint64_t, guard); |
848 | }; |
849 | extern kern_return_t _kernelrpc_mach_port_unguard_trap( |
850 | struct _kernelrpc_mach_port_unguard_args *args); |
851 | |
852 | struct mach_generate_activity_id_args { |
853 | PAD_ARG_(mach_port_name_t, target); |
854 | PAD_ARG_(int, count); |
855 | PAD_ARG_(user_addr_t, activity_id); |
856 | }; |
857 | extern kern_return_t mach_generate_activity_id( |
858 | struct mach_generate_activity_id_args *args); |
859 | |
860 | /* |
861 | * Voucher trap interfaces |
862 | */ |
863 | |
864 | struct host_create_mach_voucher_args { |
865 | PAD_ARG_(mach_port_name_t, host); |
866 | PAD_ARG_(mach_voucher_attr_raw_recipe_array_t, recipes); |
867 | PAD_ARG_(int, recipes_size); |
868 | PAD_ARG_(user_addr_t, voucher); |
869 | }; |
870 | extern kern_return_t host_create_mach_voucher_trap( |
871 | struct host_create_mach_voucher_args *args); |
872 | |
873 | struct { |
874 | PAD_ARG_(mach_port_name_t, ); |
875 | PAD_ARG_(mach_voucher_attr_key_t, ); |
876 | PAD_ARG_(mach_voucher_attr_raw_recipe_t, ); |
877 | PAD_ARG_(user_addr_t, ); |
878 | }; |
879 | |
880 | extern kern_return_t ( |
881 | struct mach_voucher_extract_attr_recipe_args *args); |
882 | |
883 | struct _kernelrpc_mach_port_type_args { |
884 | PAD_ARG_(mach_port_name_t, target); |
885 | PAD_ARG_(mach_port_right_t, name); |
886 | PAD_ARG_(user_addr_t, ptype); |
887 | }; |
888 | extern kern_return_t _kernelrpc_mach_port_type_trap( |
889 | struct _kernelrpc_mach_port_type_args *args); |
890 | |
891 | struct _kernelrpc_mach_port_request_notification_args { |
892 | PAD_ARG_(mach_port_name_t, target); |
893 | PAD_ARG_(mach_port_name_t, name); |
894 | PAD_ARG_(mach_msg_id_t, msgid); |
895 | PAD_ARG_(mach_port_mscount_t, sync); |
896 | PAD_ARG_(mach_port_name_t, notify); |
897 | PAD_ARG_(mach_msg_type_name_t, notifyPoly); |
898 | PAD_ARG_(user_addr_t, previous); |
899 | }; |
900 | extern kern_return_t _kernelrpc_mach_port_request_notification_trap( |
901 | struct _kernelrpc_mach_port_request_notification_args *args); |
902 | |
903 | |
904 | /* not published to LP64 clients yet */ |
905 | struct iokit_user_client_trap_args { |
906 | PAD_ARG_(void *, userClientRef); |
907 | PAD_ARG_(uint32_t, index); |
908 | PAD_ARG_(void *, p1); |
909 | PAD_ARG_(void *, p2); |
910 | PAD_ARG_(void *, p3); |
911 | PAD_ARG_(void *, p4); |
912 | PAD_ARG_(void *, p5); |
913 | PAD_ARG_8 |
914 | PAD_ARG_(void *, p6); |
915 | }; |
916 | kern_return_t iokit_user_client_trap( |
917 | struct iokit_user_client_trap_args *args); |
918 | |
919 | #undef PAD_ |
920 | #undef PADL_ |
921 | #undef PADR_ |
922 | #undef PAD_ARG_ |
923 | #undef PAD_ARG_8 |
924 | |
925 | #endif /* XNU_KERNEL_PRIVATE */ |
926 | |
927 | #endif /* KERNEL */ |
928 | |
929 | __END_DECLS |
930 | |
931 | #endif /* _MACH_MACH_TRAPS_H_ */ |
932 | |