X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8ad349bb6ed4a0be06e34c92be0d98b92e078db4..7ddcb079202367355dddccdfa4318e57d50318be:/osfmk/mach/mach_traps.h?ds=inline diff --git a/osfmk/mach/mach_traps.h b/osfmk/mach/mach_traps.h index 855cc1f89..37ab3277f 100644 --- a/osfmk/mach/mach_traps.h +++ b/osfmk/mach/mach_traps.h @@ -1,31 +1,29 @@ /* - * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. * - * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the - * License may not be used to create, or enable the creation or - * redistribution of, unlawful or unlicensed copies of an Apple operating - * system, or to circumvent, violate, or enable the circumvention or - * violation of, any terms of an Apple operating system software license - * agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and * limitations under the License. - * - * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ @@ -141,24 +139,23 @@ extern kern_return_t semaphore_timedwait_signal_trap( unsigned int sec, clock_res_t nsec); -#if !defined(__LP64__) -/* these should go away altogether - so no 64 legacy please */ - -extern kern_return_t init_process(void); - -#endif /* !defined(__LP64__) */ +extern kern_return_t clock_sleep_trap( + mach_port_name_t clock_name, + sleep_type_t sleep_type, + int sleep_sec, + int sleep_nsec, + mach_timespec_t *wakeup_time); -#if !defined(__LP64__) +#endif /* PRIVATE */ -/* more that should go away so no 64-bit legacy please */ extern kern_return_t macx_swapon( - char *filename, + uint64_t filename, int flags, int size, int priority); extern kern_return_t macx_swapoff( - char *filename, + uint64_t filename, int flags); extern kern_return_t macx_triggers( @@ -173,17 +170,6 @@ extern kern_return_t macx_backing_store_suspend( extern kern_return_t macx_backing_store_recovery( int pid); -#endif /* !defined(__LP64__) */ - -extern kern_return_t clock_sleep_trap( - mach_port_name_t clock_name, - sleep_type_t sleep_type, - int sleep_sec, - int sleep_nsec, - mach_timespec_t *wakeup_time); - -#endif /* PRIVATE */ - extern boolean_t swtch_pri(int pri); extern boolean_t swtch(void); @@ -204,11 +190,16 @@ extern kern_return_t task_for_pid( int pid, mach_port_name_t *t); +extern kern_return_t task_name_for_pid( + mach_port_name_t target_tport, + int pid, + mach_port_name_t *tn); + extern kern_return_t pid_for_task( mach_port_name_t t, int *x); -#if !defined(__LP64__) +#if !defined(__LP64__) && !defined(__arm__) /* these should go away altogether - so no 64 legacy please */ extern kern_return_t map_fd( @@ -218,20 +209,20 @@ extern kern_return_t map_fd( boolean_t findspace, vm_size_t size); -#endif /* !defined(__LP64__) */ +#endif /* !defined(__LP64__) && !defined(__arm__) */ #else /* KERNEL */ #ifdef XNU_KERNEL_PRIVATE -/* Syscall data translations routines */ -#ifdef __ppc__ +/* Syscall data translations routines + * + * The kernel may support multiple userspace ABIs, and must use + * argument structures with elements large enough for any of them. + */ #define PAD_(t) (sizeof(uint64_t) <= sizeof(t) \ ? 0 : sizeof(uint64_t) - sizeof(t)) -#else -#define PAD_(t) (sizeof(register_t) <= sizeof(t) \ - ? 0 : sizeof(register_t) - sizeof(t)) -#endif +#define PAD_ARG_8 #if BYTE_ORDER == LITTLE_ENDIAN #define PADL_(t) 0 @@ -244,9 +235,14 @@ extern kern_return_t map_fd( #define PAD_ARG_(arg_type, arg_name) \ char arg_name##_l_[PADL_(arg_type)]; arg_type arg_name; char arg_name##_r_[PADR_(arg_type)]; -#ifndef __MUNGE_ONCE -#define __MUNGE_ONCE -#ifdef __ppc__ +/* + * To support 32-bit clients as well as 64-bit clients, argument + * structures may need to be munged to repack the arguments. All + * active architectures do this inline in the code to dispatch Mach + * traps, without calling out to the BSD system call mungers. + */ + +#if 0 /* no active architectures use this */ void munge_w(const void *, void *); void munge_ww(const void *, void *); void munge_www(const void *, void *); @@ -264,63 +260,41 @@ void munge_dddddd(const void *, void *); void munge_ddddddd(const void *, void *); void munge_dddddddd(const void *, void *); void munge_l(const void *, void *); +void munge_lw(const void *, void *); +void munge_lwww(const void *, void *); void munge_wl(const void *, void *); void munge_wlw(const void *, void *); void munge_wwwl(const void *, void *); void munge_wwwwl(const void *, void *); void munge_wwwwwl(const void *, void *); -#else -#define munge_w NULL -#define munge_ww NULL -#define munge_www NULL -#define munge_wwww NULL -#define munge_wwwww NULL -#define munge_wwwwww NULL -#define munge_wwwwwww NULL -#define munge_wwwwwwww NULL -#define munge_d NULL -#define munge_dd NULL -#define munge_ddd NULL -#define munge_dddd NULL -#define munge_ddddd NULL -#define munge_dddddd NULL -#define munge_ddddddd NULL -#define munge_dddddddd NULL -#define munge_l NULL -#define munge_wl NULL -#define munge_wlw NULL -#define munge_wwwl NULL -#define munge_wwwwl NULL -#define munge_wwwwwl NULL -#endif /* __ppc__ */ -#endif /* !__MUNGE_ONCE */ +#endif /* 0 */ struct kern_invalid_args { - register_t dummy; + int32_t dummy; }; extern kern_return_t kern_invalid( struct kern_invalid_args *args); struct mach_reply_port_args { - register_t dummy; + int32_t dummy; }; extern mach_port_name_t mach_reply_port( struct mach_reply_port_args *args); struct thread_self_trap_args { - register_t dummy; + int32_t dummy; }; extern mach_port_name_t thread_self_trap( struct thread_self_trap_args *args); struct task_self_trap_args { - register_t dummy; + int32_t dummy; }; extern mach_port_name_t task_self_trap( struct task_self_trap_args *args); struct host_self_trap_args { - register_t dummy; + int32_t dummy; }; extern mach_port_name_t host_self_trap( struct host_self_trap_args *args); @@ -333,6 +307,7 @@ struct mach_msg_overwrite_trap_args { PAD_ARG_(mach_port_name_t, rcv_name); PAD_ARG_(mach_msg_timeout_t, timeout); PAD_ARG_(mach_port_name_t, notify); + PAD_ARG_8 PAD_ARG_(mach_vm_address_t, rcv_msg); /* Unused on mach_msg_trap */ }; extern mach_msg_return_t mach_msg_trap( @@ -389,13 +364,7 @@ struct semaphore_timedwait_signal_trap_args { extern kern_return_t semaphore_timedwait_signal_trap( struct semaphore_timedwait_signal_trap_args *args); -/* not published to LP64 clients */ -struct init_process_args { - register_t dummy; -}; -extern kern_return_t init_process( - struct init_process_args *args); - +#if !defined(CONFIG_EMBEDDED) struct map_fd_args { PAD_ARG_(int, fd); PAD_ARG_(vm_offset_t, offset); @@ -405,6 +374,7 @@ struct map_fd_args { }; extern kern_return_t map_fd( struct map_fd_args *args); +#endif /* !defined(CONFIG_EMBEDDED) */ struct task_for_pid_args { PAD_ARG_(mach_port_name_t, target_tport); @@ -414,6 +384,14 @@ struct task_for_pid_args { extern kern_return_t task_for_pid( struct task_for_pid_args *args); +struct task_name_for_pid_args { + PAD_ARG_(mach_port_name_t, target_tport); + PAD_ARG_(int, pid); + PAD_ARG_(user_addr_t, t); +}; +extern kern_return_t task_name_for_pid( + struct task_name_for_pid_args *args); + struct pid_for_task_args { PAD_ARG_(mach_port_name_t, t); PAD_ARG_(user_addr_t, pid); @@ -421,9 +399,8 @@ struct pid_for_task_args { extern kern_return_t pid_for_task( struct pid_for_task_args *args); -/* not published to LP64 clients*/ struct macx_swapon_args { - PAD_ARG_(char *, filename); + PAD_ARG_(uint64_t, filename); PAD_ARG_(int, flags); PAD_ARG_(int, size); PAD_ARG_(int, priority); @@ -432,7 +409,7 @@ extern kern_return_t macx_swapon( struct macx_swapon_args *args); struct macx_swapoff_args { - PAD_ARG_(char *, filename); + PAD_ARG_(uint64_t, filename); PAD_ARG_(int, flags); }; extern kern_return_t macx_swapoff( @@ -465,8 +442,14 @@ struct swtch_pri_args { extern boolean_t swtch_pri( struct swtch_pri_args *args); +struct pfz_exit_args { + int32_t dummy; +}; +extern kern_return_t pfz_exit( + struct pfz_exit_args *args); + struct swtch_args { - register_t dummy; + int32_t dummy; }; extern boolean_t swtch( struct swtch_args *args); @@ -502,7 +485,7 @@ extern kern_return_t mach_wait_until_trap( struct mach_wait_until_trap_args *args); struct mk_timer_create_trap_args { - register_t dummy; + int32_t dummy; }; extern mach_port_name_t mk_timer_create_trap( struct mk_timer_create_trap_args *args); @@ -527,17 +510,6 @@ struct mk_timer_cancel_trap_args { extern kern_return_t mk_timer_cancel_trap( struct mk_timer_cancel_trap_args *args); -/* no user-level prototype for this one */ -struct mk_timebase_info_trap_args { - PAD_ARG_(uint32_t *, delta); - PAD_ARG_(uint32_t *, abs_to_ns_numer); - PAD_ARG_(uint32_t *, abs_to_ns_denom); - PAD_ARG_(uint32_t *, proc_to_abs_numer); - PAD_ARG_(uint32_t *, proc_to_abs_denom); -}; -extern void mk_timebase_info_trap( - struct mk_timebase_info_trap_args *args); - /* not published to LP64 clients yet */ struct iokit_user_client_trap_args { PAD_ARG_(void *, userClientRef); @@ -547,6 +519,7 @@ struct iokit_user_client_trap_args { PAD_ARG_(void *, p3); PAD_ARG_(void *, p4); PAD_ARG_(void *, p5); + PAD_ARG_8 PAD_ARG_(void *, p6); }; kern_return_t iokit_user_client_trap( @@ -556,6 +529,7 @@ kern_return_t iokit_user_client_trap( #undef PADL_ #undef PADR_ #undef PAD_ARG_ +#undef PAD_ARG_8 #endif /* XNU_KERNEL_PRIVATE */