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