diff options
author | Luca Dariz <luca@orpolo.org> | 2023-01-16 11:58:52 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-18 02:20:37 +0100 |
commit | 8ddf8e991c0d271d2681627fab08e6730ae73ae0 (patch) | |
tree | 77890e44218b0f75d1067c61f04df8cf6ad189d5 /include/mach/message.h | |
parent | cc05ed085b731232a2436efcaf03aa1e92ad20be (diff) | |
download | gnumach-8ddf8e991c0d271d2681627fab08e6730ae73ae0.tar.gz gnumach-8ddf8e991c0d271d2681627fab08e6730ae73ae0.tar.bz2 gnumach-8ddf8e991c0d271d2681627fab08e6730ae73ae0.zip |
x86_64: expand and shrink messages in copy{in, out}msg routines
* i386/i386/copy_user.h: new file to handle 32/64 bit differences
- add msg_usize() to recontruct the user-space message size
- add copyin/copyout helpers for addresses and ports
* include/mach/message.h: add msg alignment macros
* ipc/ipc_kmsg.c:
- copyin/out ports names instead of using pointer magic
* ipc/ipc_mqueue.c: use msg_usize() to check if we can actually
receive the message
* ipc/mach_msg.c: Likewise for continuations in receive path
* x86_64/Makefrag.am: add x86_64/copy_user.c
* x86_64/copy_user.c: new file to handle message expansion and
shrinking during copyinmsg/copyoutmsg for 64 bit kernels.
- port names -> port pointers on all 64-bit builds
- 32-bit pointer -> 64 bit pointer when using 32-bit userspace
* x86_64/locore.S: remove copyinmsg() and copyoutmsg()
Message-Id: <20230116105857.240210-3-luca@orpolo.org>
Diffstat (limited to 'include/mach/message.h')
-rw-r--r-- | include/mach/message.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/mach/message.h b/include/mach/message.h index c3081e66..16788fef 100644 --- a/include/mach/message.h +++ b/include/mach/message.h @@ -316,6 +316,19 @@ typedef integer_t mach_msg_option_t; #define MACH_SEND_ALWAYS 0x00010000 /* internal use only */ +/* This is the alignment of msg descriptors and the actual data. + * + * On x86 it is made equal to the default structure alignment on + * 32-bit, so we can easily maintain compatibility with 32-bit user + * space on a 64-bit kernel. Other architectures might have different + * needs, so this value might change in the future for differents + * architectures. + */ +#define MACH_MSG_ALIGNMENT 4 + +#define msg_is_misaligned(x) ( ((vm_offset_t)(x)) & (MACH_MSG_ALIGNMENT-1) ) +#define msg_align(x) \ + ( ( ((vm_offset_t)(x)) + (MACH_MSG_ALIGNMENT-1) ) & ~(MACH_MSG_ALIGNMENT-1) ) /* * Much code assumes that mach_msg_return_t == kern_return_t. @@ -401,7 +414,6 @@ typedef kern_return_t mach_msg_return_t; #define MACH_RCV_BODY_ERROR 0x1000400c /* Error receiving message body. See special bits. */ - extern mach_msg_return_t mach_msg_trap (mach_msg_user_header_t *msg, |