]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/mach/mach_traps.h
xnu-3247.1.106.tar.gz
[apple/xnu.git] / osfmk / mach / mach_traps.h
index 37ab3277fda194ceb75d0fecddd2bfd59861a323..c33a308f451224607a99c4cc6fdb02eeb22e3d01 100644 (file)
@@ -139,6 +139,8 @@ extern kern_return_t semaphore_timedwait_signal_trap(
                                unsigned int sec,
                                clock_res_t nsec);
 
+#endif /* PRIVATE */
+
 extern kern_return_t clock_sleep_trap(
                                mach_port_name_t clock_name,
                                sleep_type_t sleep_type,
@@ -146,7 +148,110 @@ extern kern_return_t clock_sleep_trap(
                                int sleep_nsec,
                                mach_timespec_t *wakeup_time);
 
-#endif /* PRIVATE */
+extern kern_return_t _kernelrpc_mach_vm_allocate_trap(
+                               mach_port_name_t target,
+                               mach_vm_offset_t *addr,
+                               mach_vm_size_t size,
+                               int flags);
+
+extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(
+                               mach_port_name_t target,
+                               mach_vm_address_t address,
+                               mach_vm_size_t size
+);
+
+extern kern_return_t _kernelrpc_mach_vm_protect_trap(
+                               mach_port_name_t target,
+                               mach_vm_address_t address,
+                               mach_vm_size_t size,
+                               boolean_t set_maximum,
+                               vm_prot_t new_protection
+);
+
+extern kern_return_t _kernelrpc_mach_vm_map_trap(
+                               mach_port_name_t target,
+                               mach_vm_offset_t *address,
+                               mach_vm_size_t size,
+                               mach_vm_offset_t mask,
+                               int flags,
+                               vm_prot_t cur_protection
+);
+
+extern kern_return_t _kernelrpc_mach_port_allocate_trap(
+                               mach_port_name_t target,
+                               mach_port_right_t right,
+                               mach_port_name_t *name
+);
+
+
+extern kern_return_t _kernelrpc_mach_port_destroy_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t name
+);
+
+extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t name
+);
+
+extern kern_return_t _kernelrpc_mach_port_mod_refs_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t name,
+                               mach_port_right_t right,
+                               mach_port_delta_t delta
+);
+
+extern kern_return_t _kernelrpc_mach_port_move_member_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t member,
+                               mach_port_name_t after
+);
+
+extern kern_return_t _kernelrpc_mach_port_insert_right_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t name,
+                               mach_port_name_t poly,
+                               mach_msg_type_name_t polyPoly
+);
+
+extern kern_return_t _kernelrpc_mach_port_insert_member_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t name,
+                               mach_port_name_t pset
+);
+
+extern kern_return_t _kernelrpc_mach_port_extract_member_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t name,
+                               mach_port_name_t pset
+);
+
+extern kern_return_t _kernelrpc_mach_port_construct_trap(
+                               mach_port_name_t target,
+                               mach_port_options_t *options,
+                               uint64_t context,
+                               mach_port_name_t *name
+);
+
+extern kern_return_t _kernelrpc_mach_port_destruct_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t name,
+                               mach_port_delta_t srdelta,
+                               uint64_t guard
+);
+
+extern kern_return_t _kernelrpc_mach_port_guard_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t name,
+                               uint64_t guard,
+                               boolean_t strict
+);
+
+extern kern_return_t _kernelrpc_mach_port_unguard_trap(
+                               mach_port_name_t target,
+                               mach_port_name_t name,
+                               uint64_t guard
+);
 
 extern kern_return_t macx_swapon(
                                uint64_t filename,
@@ -199,18 +304,6 @@ extern kern_return_t pid_for_task(
                                mach_port_name_t t,
                                int *x);
 
-#if            !defined(__LP64__) && !defined(__arm__)
-/* these should go away altogether - so no 64 legacy please */
-
-extern kern_return_t map_fd(
-                               int fd,
-                               vm_offset_t offset,
-                               vm_offset_t *va,
-                               boolean_t findspace,
-                               vm_size_t size);
-
-#endif /* !defined(__LP64__) && !defined(__arm__) */
-
 #else  /* KERNEL */
 
 #ifdef XNU_KERNEL_PRIVATE
@@ -220,9 +313,15 @@ extern kern_return_t map_fd(
  * The kernel may support multiple userspace ABIs, and must use
  * argument structures with elements large enough for any of them.
  */
+#if CONFIG_REQUIRES_U32_MUNGING
 #define        PAD_(t) (sizeof(uint64_t) <= sizeof(t) \
                ? 0 : sizeof(uint64_t) - sizeof(t))
 #define PAD_ARG_8
+#else
+#define        PAD_(t) (sizeof(uint32_t) <= sizeof(t) \
+               ? 0 : sizeof(uint32_t) - sizeof(t))
+#define PAD_ARG_8 char arg8_pad_[sizeof(uint32_t)];
+#endif
 
 #if BYTE_ORDER == LITTLE_ENDIAN
 #define        PADL_(t)        0
@@ -242,33 +341,6 @@ extern kern_return_t map_fd(
  * 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 *);  
-void munge_wwww(const void *, void *);  
-void munge_wwwww(const void *, void *);  
-void munge_wwwwww(const void *, void *);  
-void munge_wwwwwww(const void *, void *);  
-void munge_wwwwwwww(const void *, void *);  
-void munge_d(const void *, void *);  
-void munge_dd(const void *, void *);  
-void munge_ddd(const void *, void *);  
-void munge_dddd(const void *, void *);  
-void munge_ddddd(const void *, void *);  
-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 *);  
-#endif /* 0 */
-
 struct kern_invalid_args {
        int32_t dummy;
 };
@@ -300,7 +372,7 @@ extern mach_port_name_t host_self_trap(
                                struct host_self_trap_args *args);
 
 struct mach_msg_overwrite_trap_args {
-       PAD_ARG_(mach_vm_address_t, msg);
+       PAD_ARG_(user_addr_t, msg);
        PAD_ARG_(mach_msg_option_t, option);
        PAD_ARG_(mach_msg_size_t, send_size);
        PAD_ARG_(mach_msg_size_t, rcv_size);
@@ -308,7 +380,7 @@ struct mach_msg_overwrite_trap_args {
        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 */
+       PAD_ARG_(user_addr_t, rcv_msg);  /* Unused on mach_msg_trap */
 };
 extern mach_msg_return_t mach_msg_trap(
                                struct mach_msg_overwrite_trap_args *args);
@@ -364,18 +436,6 @@ struct semaphore_timedwait_signal_trap_args {
 extern kern_return_t semaphore_timedwait_signal_trap(
                                struct semaphore_timedwait_signal_trap_args *args);
 
-#if            !defined(CONFIG_EMBEDDED)
-struct map_fd_args {
-       PAD_ARG_(int, fd);
-       PAD_ARG_(vm_offset_t, offset);
-       PAD_ARG_(vm_offset_t *, va);
-       PAD_ARG_(boolean_t, findspace);
-       PAD_ARG_(vm_size_t, size);
-};
-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);
        PAD_ARG_(int, pid);
@@ -459,7 +519,7 @@ struct clock_sleep_trap_args{
        PAD_ARG_(sleep_type_t, sleep_type);
        PAD_ARG_(int, sleep_sec);
        PAD_ARG_(int, sleep_nsec);
-       PAD_ARG_(mach_vm_address_t, wakeup_time);
+       PAD_ARG_(user_addr_t, wakeup_time);
 };
 extern kern_return_t clock_sleep_trap(
                                struct clock_sleep_trap_args *args);
@@ -473,7 +533,7 @@ extern kern_return_t thread_switch(
                                struct thread_switch_args *args);
 
 struct mach_timebase_info_trap_args {
-       PAD_ARG_(mach_vm_address_t, info);
+       PAD_ARG_(user_addr_t, info);
 };
 extern kern_return_t mach_timebase_info_trap(
                                struct mach_timebase_info_trap_args *args);
@@ -505,11 +565,152 @@ extern kern_return_t mk_timer_arm_trap(
 
 struct mk_timer_cancel_trap_args {
     PAD_ARG_(mach_port_name_t, name);
-    PAD_ARG_(mach_vm_address_t, result_time);
+    PAD_ARG_(user_addr_t, result_time);
 };
 extern kern_return_t mk_timer_cancel_trap(
                                struct mk_timer_cancel_trap_args *args);
 
+struct _kernelrpc_mach_vm_allocate_trap_args {
+       PAD_ARG_(mach_port_name_t, target);     /* 1 word */
+       PAD_ARG_(user_addr_t, addr);            /* 1 word */
+       PAD_ARG_(mach_vm_size_t, size);         /* 2 words */
+       PAD_ARG_(int, flags);                   /* 1 word */
+};                                             /* Total: 5 */
+
+extern kern_return_t _kernelrpc_mach_vm_allocate_trap(
+                               struct _kernelrpc_mach_vm_allocate_trap_args *args);
+
+struct _kernelrpc_mach_vm_deallocate_args {
+       PAD_ARG_(mach_port_name_t, target);     /* 1 word */
+       PAD_ARG_(mach_vm_address_t, address);   /* 2 words */
+       PAD_ARG_(mach_vm_size_t, size);         /* 2 words */
+};                                             /* Total: 5 */
+extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(
+                               struct _kernelrpc_mach_vm_deallocate_args *args);
+
+struct _kernelrpc_mach_vm_protect_args {
+       PAD_ARG_(mach_port_name_t, target);     /* 1 word */
+       PAD_ARG_(mach_vm_address_t, address);   /* 2 words */
+       PAD_ARG_(mach_vm_size_t, size);         /* 2 words */
+       PAD_ARG_(boolean_t, set_maximum);       /* 1 word */
+       PAD_ARG_(vm_prot_t, new_protection);    /* 1 word */
+};                                             /* Total: 7 */
+extern kern_return_t _kernelrpc_mach_vm_protect_trap(
+                               struct _kernelrpc_mach_vm_protect_args *args);
+
+struct _kernelrpc_mach_vm_map_trap_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(user_addr_t, addr);
+       PAD_ARG_(mach_vm_size_t, size);
+       PAD_ARG_(mach_vm_offset_t, mask);
+       PAD_ARG_(int, flags);
+       PAD_ARG_8
+       PAD_ARG_(vm_prot_t, cur_protection);
+};
+extern kern_return_t _kernelrpc_mach_vm_map_trap(
+                               struct _kernelrpc_mach_vm_map_trap_args *args);
+
+struct _kernelrpc_mach_port_allocate_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_right_t, right);
+       PAD_ARG_(user_addr_t, name);
+};
+extern kern_return_t _kernelrpc_mach_port_allocate_trap(
+                               struct _kernelrpc_mach_port_allocate_args *args);
+
+
+struct _kernelrpc_mach_port_destroy_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, name);
+};
+extern kern_return_t _kernelrpc_mach_port_destroy_trap(
+                               struct _kernelrpc_mach_port_destroy_args *args);
+
+struct _kernelrpc_mach_port_deallocate_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, name);
+};
+extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
+                               struct _kernelrpc_mach_port_deallocate_args *args);
+
+struct _kernelrpc_mach_port_mod_refs_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, name);
+       PAD_ARG_(mach_port_right_t, right);
+       PAD_ARG_(mach_port_delta_t, delta);
+};
+extern kern_return_t _kernelrpc_mach_port_mod_refs_trap(
+                               struct _kernelrpc_mach_port_mod_refs_args *args);
+
+struct _kernelrpc_mach_port_move_member_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, member);
+       PAD_ARG_(mach_port_name_t, after);
+};
+extern kern_return_t _kernelrpc_mach_port_move_member_trap(
+                               struct _kernelrpc_mach_port_move_member_args *args);
+
+struct _kernelrpc_mach_port_insert_right_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, name);
+       PAD_ARG_(mach_port_name_t, poly);
+       PAD_ARG_(mach_msg_type_name_t, polyPoly);
+};
+extern kern_return_t _kernelrpc_mach_port_insert_right_trap(
+                               struct _kernelrpc_mach_port_insert_right_args *args);
+
+struct _kernelrpc_mach_port_insert_member_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, name);
+       PAD_ARG_(mach_port_name_t, pset);
+};
+extern kern_return_t _kernelrpc_mach_port_insert_member_trap(
+                               struct _kernelrpc_mach_port_insert_member_args *args);
+
+struct _kernelrpc_mach_port_extract_member_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, name);
+       PAD_ARG_(mach_port_name_t, pset);
+};
+extern kern_return_t _kernelrpc_mach_port_extract_member_trap(
+                               struct _kernelrpc_mach_port_extract_member_args *args);
+
+struct _kernelrpc_mach_port_construct_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(user_addr_t, options);
+       PAD_ARG_(uint64_t, context);
+       PAD_ARG_(user_addr_t, name);
+};
+extern kern_return_t _kernelrpc_mach_port_construct_trap(
+                               struct _kernelrpc_mach_port_construct_args *args);
+
+struct _kernelrpc_mach_port_destruct_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, name);
+       PAD_ARG_(mach_port_delta_t, srdelta);
+       PAD_ARG_(uint64_t, guard);
+};
+extern kern_return_t _kernelrpc_mach_port_destruct_trap(
+                               struct _kernelrpc_mach_port_destruct_args *args);
+
+struct _kernelrpc_mach_port_guard_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, name);
+       PAD_ARG_(uint64_t, guard);
+       PAD_ARG_(boolean_t, strict);
+};
+extern kern_return_t _kernelrpc_mach_port_guard_trap(
+                               struct _kernelrpc_mach_port_guard_args *args);
+
+struct _kernelrpc_mach_port_unguard_args {
+       PAD_ARG_(mach_port_name_t, target);
+       PAD_ARG_(mach_port_name_t, name);
+       PAD_ARG_(uint64_t, guard);
+};
+extern kern_return_t _kernelrpc_mach_port_unguard_trap(
+                               struct _kernelrpc_mach_port_unguard_args *args);
+
+
 /* not published to LP64 clients yet */
 struct iokit_user_client_trap_args {
        PAD_ARG_(void *, userClientRef);