summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-11-30 02:08:01 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-12-03 01:01:41 +0100
commit29d4bcaafc4c2040df27a6247603c68e7757205c (patch)
treee690beca8fd1b0ff00645798dab866df6e77a67c /include
parent2db6b9b7b23b3bab944665b3b6012d24dd425d97 (diff)
x86_64: Support 8 byte inlined port rights to avoid message resizing.
If a port is inlined in a message, the user has to use mach_port_name_inlined_t to define each port. Out of line memory continues to use mach_port_name_t since that memory has to be copied to the kernel anyway. Both copyinmsg and copyoutmsg can be reduced to nothing (if we ignore USER32) as a follow up but kept this patch simple for ease of review. Message-ID: <ZWg00XzFPqqL1yF-@jupiter.tail36e24.ts.net>
Diffstat (limited to 'include')
-rw-r--r--include/mach/message.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/mach/message.h b/include/mach/message.h
index 906ae797..0b8b34d4 100644
--- a/include/mach/message.h
+++ b/include/mach/message.h
@@ -221,6 +221,24 @@ typedef unsigned int mach_msg_type_name_t;
typedef unsigned int mach_msg_type_size_t;
typedef natural_t mach_msg_type_number_t;
+/**
+ * Structure used for inlined port rights in messages.
+ *
+ * We use this to avoid having to perform message resizing in the kernel
+ * since userspace port rights might be smaller than kernel ports in 64 bit
+ * architectures.
+ */
+typedef struct {
+ union {
+ mach_port_name_t name;
+#ifdef KERNEL
+ mach_port_t kernel_port;
+#else
+ uintptr_t kernel_port_do_not_use;
+#endif /* KERNEL */
+ };
+} mach_port_name_inlined_t;
+
typedef struct {
#ifdef __x86_64__
/*