summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-02-12 18:54:58 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-02-13 01:00:32 +0100
commitea2646b6d6f2dc02a59a2693d08957596c84e9d3 (patch)
tree7a6c0e61eec61c4b7231fd2f35ff6c226b53b5c5 /include
parent7170cfbfb70cdce12ea6ec6697ed95c557aa1989 (diff)
Make mach_msg_header_t have the same size for both 64 bit kernel and userland.
This has several advantages: 1) We don't need to resize mach_msg_header_t, it is just a copy. 2) Mig won't require any changes because it statically computes the size of mach_msg_header_t, otherwise we would need two sizes (28 vs 32 bytes). Message-Id: <Y+l8UhXXX9Qo9tVA@jupiter.tail36e24.ts.net>
Diffstat (limited to 'include')
-rw-r--r--include/mach/message.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/mach/message.h b/include/mach/message.h
index 63341e6f..eb3b34c0 100644
--- a/include/mach/message.h
+++ b/include/mach/message.h
@@ -139,7 +139,15 @@ typedef integer_t mach_msg_id_t;
typedef struct mach_msg_header {
mach_msg_bits_t msgh_bits;
mach_msg_size_t msgh_size;
- mach_port_t msgh_remote_port;
+ union {
+ mach_port_t msgh_remote_port;
+ /*
+ * Ensure msgh_remote_port is wide enough to hold a kernel pointer
+ * to avoid message resizing for the 64 bits case. This field should
+ * not be used since it is here just for padding purposes.
+ */
+ rpc_uintptr_t msgh_remote_port_do_not_use;
+ };
union {
mach_port_t msgh_local_port;
rpc_uintptr_t msgh_protected_payload;
@@ -153,7 +161,10 @@ typedef struct mach_msg_header {
typedef struct {
mach_msg_bits_t msgh_bits;
mach_msg_size_t msgh_size;
- mach_port_name_t msgh_remote_port;
+ union {
+ mach_port_name_t msgh_remote_port;
+ rpc_uintptr_t msgh_remote_port_do_not_use;
+ };
union {
mach_port_name_t msgh_local_port;
rpc_uintptr_t msgh_protected_payload;