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
88extern mach_port_name_t mach_reply_port(void);
89
90extern mach_port_name_t thread_get_special_reply_port(void);
91
92extern mach_port_name_t thread_self_trap(void);
93
94extern mach_port_name_t host_self_trap(void);
95
96extern 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__)
106extern 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
117extern 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
128extern kern_return_t semaphore_signal_trap(
129 mach_port_name_t signal_name);
130
131extern kern_return_t semaphore_signal_all_trap(
132 mach_port_name_t signal_name);
133
134extern kern_return_t semaphore_signal_thread_trap(
135 mach_port_name_t signal_name,
136 mach_port_name_t thread_name);
137
138extern kern_return_t semaphore_wait_trap(
139 mach_port_name_t wait_name);
140
141extern kern_return_t semaphore_wait_signal_trap(
142 mach_port_name_t wait_name,
143 mach_port_name_t signal_name);
144
145extern kern_return_t semaphore_timedwait_trap(
146 mach_port_name_t wait_name,
147 unsigned int sec,
148 clock_res_t nsec);
149
150extern 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
158extern 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
165extern 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
171extern 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
177extern 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
182extern 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
190extern 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
199extern 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
205extern 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
211extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
212 mach_port_name_t target,
213 mach_port_name_t name
214 );
215
216extern 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
223extern 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
229extern 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
236extern 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
244extern 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
250extern 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
256extern 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
263extern 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
270extern 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
277extern 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
283extern kern_return_t mach_generate_activity_id(
284 mach_port_name_t target,
285 int count,
286 uint64_t *activity_id
287 );
288
289extern kern_return_t macx_swapon(
290 uint64_t filename,
291 int flags,
292 int size,
293 int priority);
294
295extern kern_return_t macx_swapoff(
296 uint64_t filename,
297 int flags);
298
299extern kern_return_t macx_triggers(
300 int hi_water,
301 int low_water,
302 int flags,
303 mach_port_t alert_port);
304
305extern kern_return_t macx_backing_store_suspend(
306 boolean_t suspend);
307
308extern kern_return_t macx_backing_store_recovery(
309 int pid);
310
311extern boolean_t swtch_pri(int pri);
312
313extern boolean_t swtch(void);
314
315extern kern_return_t thread_switch(
316 mach_port_name_t thread_name,
317 int option,
318 mach_msg_timeout_t option_time);
319
320extern mach_port_name_t task_self_trap(void);
321
322extern 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
328extern 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
334extern 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
339extern 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
352extern kern_return_t task_for_pid(
353 mach_port_name_t target_tport,
354 int pid,
355 mach_port_name_t *t);
356
357extern kern_return_t task_name_for_pid(
358 mach_port_name_t target_tport,
359 int pid,
360 mach_port_name_t *tn);
361
362extern kern_return_t pid_for_task(
363 mach_port_name_t t,
364 int *x);
365
366extern 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
412struct kern_invalid_args {
413 int32_t dummy;
414};
415extern kern_return_t kern_invalid(
416 struct kern_invalid_args *args);
417
418struct mach_reply_port_args {
419 int32_t dummy;
420};
421extern mach_port_name_t mach_reply_port(
422 struct mach_reply_port_args *args);
423
424struct thread_get_special_reply_port_args {
425 int32_t dummy;
426};
427extern mach_port_name_t thread_get_special_reply_port(
428 struct thread_get_special_reply_port_args *args);
429
430struct thread_self_trap_args {
431 int32_t dummy;
432};
433extern mach_port_name_t thread_self_trap(
434 struct thread_self_trap_args *args);
435
436struct task_self_trap_args {
437 int32_t dummy;
438};
439extern mach_port_name_t task_self_trap(
440 struct task_self_trap_args *args);
441
442struct host_self_trap_args {
443 int32_t dummy;
444};
445extern mach_port_name_t host_self_trap(
446 struct host_self_trap_args *args);
447
448struct 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};
459extern mach_msg_return_t mach_msg_trap(
460 struct mach_msg_overwrite_trap_args *args);
461extern mach_msg_return_t mach_msg_overwrite_trap(
462 struct mach_msg_overwrite_trap_args *args);
463
464#if defined(__LP64__) || defined(__arm64__)
465struct 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
476extern mach_msg_return_t mach_msg2_trap(
477 struct mach_msg2_trap_args *args);
478#endif
479
480struct semaphore_signal_trap_args {
481 PAD_ARG_(mach_port_name_t, signal_name);
482};
483extern kern_return_t semaphore_signal_trap(
484 struct semaphore_signal_trap_args *args);
485
486struct semaphore_signal_all_trap_args {
487 PAD_ARG_(mach_port_name_t, signal_name);
488};
489extern kern_return_t semaphore_signal_all_trap(
490 struct semaphore_signal_all_trap_args *args);
491
492struct semaphore_signal_thread_trap_args {
493 PAD_ARG_(mach_port_name_t, signal_name);
494 PAD_ARG_(mach_port_name_t, thread_name);
495};
496extern kern_return_t semaphore_signal_thread_trap(
497 struct semaphore_signal_thread_trap_args *args);
498
499struct semaphore_wait_trap_args {
500 PAD_ARG_(mach_port_name_t, wait_name);
501};
502extern kern_return_t semaphore_wait_trap(
503 struct semaphore_wait_trap_args *args);
504
505struct semaphore_wait_signal_trap_args {
506 PAD_ARG_(mach_port_name_t, wait_name);
507 PAD_ARG_(mach_port_name_t, signal_name);
508};
509extern kern_return_t semaphore_wait_signal_trap(
510 struct semaphore_wait_signal_trap_args *args);
511
512struct 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};
517extern kern_return_t semaphore_timedwait_trap(
518 struct semaphore_timedwait_trap_args *args);
519
520struct 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};
526extern kern_return_t semaphore_timedwait_signal_trap(
527 struct semaphore_timedwait_signal_trap_args *args);
528
529struct 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};
534extern kern_return_t task_for_pid(
535 struct task_for_pid_args *args);
536
537struct 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};
542extern kern_return_t task_name_for_pid(
543 struct task_name_for_pid_args *args);
544
545struct pid_for_task_args {
546 PAD_ARG_(mach_port_name_t, t);
547 PAD_ARG_(user_addr_t, pid);
548};
549extern kern_return_t pid_for_task(
550 struct pid_for_task_args *args);
551
552struct 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};
557extern kern_return_t debug_control_port_for_pid(
558 struct debug_control_port_for_pid_args *args);
559
560struct 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};
566extern kern_return_t macx_swapon(
567 struct macx_swapon_args *args);
568
569struct macx_swapoff_args {
570 PAD_ARG_(uint64_t, filename);
571 PAD_ARG_(int, flags);
572};
573extern kern_return_t macx_swapoff(
574 struct macx_swapoff_args *args);
575
576struct 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};
582extern kern_return_t macx_triggers(
583 struct macx_triggers_args *args);
584
585struct macx_backing_store_suspend_args {
586 PAD_ARG_(boolean_t, suspend);
587};
588extern kern_return_t macx_backing_store_suspend(
589 struct macx_backing_store_suspend_args *args);
590
591struct macx_backing_store_recovery_args {
592 PAD_ARG_(int, pid);
593};
594extern kern_return_t macx_backing_store_recovery(
595 struct macx_backing_store_recovery_args *args);
596
597struct swtch_pri_args {
598 PAD_ARG_(int, pri);
599};
600extern boolean_t swtch_pri(
601 struct swtch_pri_args *args);
602
603struct pfz_exit_args {
604 int32_t dummy;
605};
606extern kern_return_t pfz_exit(
607 struct pfz_exit_args *args);
608
609struct swtch_args {
610 int32_t dummy;
611};
612extern boolean_t swtch(
613 struct swtch_args *args);
614
615struct 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};
622extern kern_return_t clock_sleep_trap(
623 struct clock_sleep_trap_args *args);
624
625struct 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};
630extern kern_return_t thread_switch(
631 struct thread_switch_args *args);
632
633struct 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};
642extern kern_return_t _exclaves_ctl_trap(
643 struct exclaves_ctl_trap_args *args);
644
645struct mach_timebase_info_trap_args {
646 PAD_ARG_(user_addr_t, info);
647};
648extern kern_return_t mach_timebase_info_trap(
649 struct mach_timebase_info_trap_args *args);
650
651struct mach_wait_until_trap_args {
652 PAD_ARG_(uint64_t, deadline);
653};
654extern kern_return_t mach_wait_until_trap(
655 struct mach_wait_until_trap_args *args);
656
657struct mk_timer_create_trap_args {
658 int32_t dummy;
659};
660extern mach_port_name_t mk_timer_create_trap(
661 struct mk_timer_create_trap_args *args);
662
663struct mk_timer_destroy_trap_args {
664 PAD_ARG_(mach_port_name_t, name);
665};
666extern kern_return_t mk_timer_destroy_trap(
667 struct mk_timer_destroy_trap_args *args);
668
669struct mk_timer_arm_trap_args {
670 PAD_ARG_(mach_port_name_t, name);
671 PAD_ARG_(uint64_t, expire_time);
672};
673extern kern_return_t mk_timer_arm_trap(
674 struct mk_timer_arm_trap_args *args);
675
676struct 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};
682extern kern_return_t mk_timer_arm_leeway_trap(
683 struct mk_timer_arm_leeway_trap_args *args);
684
685struct mk_timer_cancel_trap_args {
686 PAD_ARG_(mach_port_name_t, name);
687 PAD_ARG_(user_addr_t, result_time);
688};
689extern kern_return_t mk_timer_cancel_trap(
690 struct mk_timer_cancel_trap_args *args);
691
692struct _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
699extern kern_return_t _kernelrpc_mach_vm_allocate_trap(
700 struct _kernelrpc_mach_vm_allocate_trap_args *args);
701
702struct _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 */
707extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(
708 struct _kernelrpc_mach_vm_deallocate_args *args);
709
710struct 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
715extern kern_return_t task_dyld_process_info_notify_get_trap(
716 struct task_dyld_process_info_notify_get_trap_args *args);
717
718struct _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 */
725extern kern_return_t _kernelrpc_mach_vm_protect_trap(
726 struct _kernelrpc_mach_vm_protect_args *args);
727
728struct _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};
737extern kern_return_t _kernelrpc_mach_vm_map_trap(
738 struct _kernelrpc_mach_vm_map_trap_args *args);
739
740struct _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
747extern kern_return_t _kernelrpc_mach_vm_purgable_control_trap(
748 struct _kernelrpc_mach_vm_purgable_control_trap_args *args);
749
750struct _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};
755extern kern_return_t _kernelrpc_mach_port_allocate_trap(
756 struct _kernelrpc_mach_port_allocate_args *args);
757
758struct _kernelrpc_mach_port_deallocate_args {
759 PAD_ARG_(mach_port_name_t, target);
760 PAD_ARG_(mach_port_name_t, name);
761};
762extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
763 struct _kernelrpc_mach_port_deallocate_args *args);
764
765struct _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};
771extern kern_return_t _kernelrpc_mach_port_mod_refs_trap(
772 struct _kernelrpc_mach_port_mod_refs_args *args);
773
774struct _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};
779extern kern_return_t _kernelrpc_mach_port_move_member_trap(
780 struct _kernelrpc_mach_port_move_member_args *args);
781
782struct _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};
788extern kern_return_t _kernelrpc_mach_port_insert_right_trap(
789 struct _kernelrpc_mach_port_insert_right_args *args);
790
791struct _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};
798extern kern_return_t _kernelrpc_mach_port_get_attributes_trap(
799 struct _kernelrpc_mach_port_get_attributes_args *args);
800
801struct _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};
806extern kern_return_t _kernelrpc_mach_port_insert_member_trap(
807 struct _kernelrpc_mach_port_insert_member_args *args);
808
809struct _kernelrpc_mach_port_extract_member_args {
810 PAD_ARG_(mach_port_name_t, target);
811 PAD_ARG_(mach_port_name_t, name);
812 PAD_ARG_(mach_port_name_t, pset);
813};
814extern kern_return_t _kernelrpc_mach_port_extract_member_trap(
815 struct _kernelrpc_mach_port_extract_member_args *args);
816
817struct _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};
823extern kern_return_t _kernelrpc_mach_port_construct_trap(
824 struct _kernelrpc_mach_port_construct_args *args);
825
826struct _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};
832extern kern_return_t _kernelrpc_mach_port_destruct_trap(
833 struct _kernelrpc_mach_port_destruct_args *args);
834
835struct _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};
841extern kern_return_t _kernelrpc_mach_port_guard_trap(
842 struct _kernelrpc_mach_port_guard_args *args);
843
844struct _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};
849extern kern_return_t _kernelrpc_mach_port_unguard_trap(
850 struct _kernelrpc_mach_port_unguard_args *args);
851
852struct 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};
857extern kern_return_t mach_generate_activity_id(
858 struct mach_generate_activity_id_args *args);
859
860/*
861 * Voucher trap interfaces
862 */
863
864struct 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};
870extern kern_return_t host_create_mach_voucher_trap(
871 struct host_create_mach_voucher_args *args);
872
873struct mach_voucher_extract_attr_recipe_args {
874 PAD_ARG_(mach_port_name_t, voucher_name);
875 PAD_ARG_(mach_voucher_attr_key_t, key);
876 PAD_ARG_(mach_voucher_attr_raw_recipe_t, recipe);
877 PAD_ARG_(user_addr_t, recipe_size);
878};
879
880extern kern_return_t mach_voucher_extract_attr_recipe_trap(
881 struct mach_voucher_extract_attr_recipe_args *args);
882
883struct _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};
888extern kern_return_t _kernelrpc_mach_port_type_trap(
889 struct _kernelrpc_mach_port_type_args *args);
890
891struct _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};
900extern 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 */
905struct 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};
916kern_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