]> git.saurik.com Git - apple/libc.git/blobdiff - libdarwin/h/mach_utils.h
Libc-1439.100.3.tar.gz
[apple/libc.git] / libdarwin / h / mach_utils.h
index 45ea439dd16248e0ba990aea9a1f1eaefa659fff..8b9575162b1e39e03b58dbcf1629581f163f30b6 100644 (file)
 #include <mach/mach_port.h>
 #include <mach/kern_return.h>
 
+#if DARWIN_TAPI
+#include "tapi.h"
+#endif
+
 /*!
  * @define OS_MIG_SUBSYSTEM_MAXSIZE
  * A macro that evaluates to the maximum size of a request or reply message in
 
 __BEGIN_DECLS;
 
+/*!
+ * @function os_vm_address_from_ptr
+ * Converts the given pointer to a vm_address_t.
+ *
+ * @param p
+ * The pointer to convert.
+ *
+ * @result
+ * The pointer as a vm_address_t.
+ */
+DARWIN_API_AVAILABLE_20190830
+OS_ALWAYS_INLINE OS_WARN_RESULT
+static inline vm_address_t
+os_vm_address_from_ptr(const void *p)
+{
+       return (vm_address_t)(uintptr_t)p;
+}
+
+/*!
+ * @function os_mach_vm_address_from_ptr
+ * Converts the given pointer to a mach_vm_address_t.
+ *
+ * @param p
+ * The pointer to convert.
+ *
+ * @result
+ * The pointer as a mach_vm_address_t.
+ */
+DARWIN_API_AVAILABLE_20190830
+OS_ALWAYS_INLINE OS_WARN_RESULT
+static inline mach_vm_address_t
+os_mach_vm_address_from_ptr(const void *p)
+{
+       return (mach_vm_address_t)(uintptr_t)p;
+}
+
 /*!
  * @function os_mach_msg_get_trailer
  * Obtains the trailer for the received Mach message.