aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-19 23:30:40 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-19 23:30:40 +0100
commitc7a84af651ae5cf2588c4a057564f9c2189846ef (patch)
tree65e1e0349703b3c8ab88748107d054584e71a470
parent569df850cd7badd1e36132ad3b44aa76a4d27c25 (diff)
downloadgnumach-c7a84af651ae5cf2588c4a057564f9c2189846ef.tar.gz
gnumach-c7a84af651ae5cf2588c4a057564f9c2189846ef.tar.bz2
gnumach-c7a84af651ae5cf2588c4a057564f9c2189846ef.zip
Rename msg_is_misaligned and msg_align
message.h is installed so we need to hide these behind a mach_ prefix
-rw-r--r--include/mach/message.h4
-rw-r--r--ipc/ipc_kmsg.c40
-rw-r--r--x86_64/copy_user.c24
3 files changed, 34 insertions, 34 deletions
diff --git a/include/mach/message.h b/include/mach/message.h
index 16788fef..21c551c2 100644
--- a/include/mach/message.h
+++ b/include/mach/message.h
@@ -326,8 +326,8 @@ typedef integer_t mach_msg_option_t;
*/
#define MACH_MSG_ALIGNMENT 4
-#define msg_is_misaligned(x) ( ((vm_offset_t)(x)) & (MACH_MSG_ALIGNMENT-1) )
-#define msg_align(x) \
+#define mach_msg_is_misaligned(x) ( ((vm_offset_t)(x)) & (MACH_MSG_ALIGNMENT-1) )
+#define mach_msg_align(x) \
( ( ((vm_offset_t)(x)) + (MACH_MSG_ALIGNMENT-1) ) & ~(MACH_MSG_ALIGNMENT-1) )
/*
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 8bb20a18..2c9d4988 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -231,8 +231,8 @@ ipc_kmsg_clean_body(
if (((mach_msg_type_t*)type)->msgt_longform) {
/* This must be aligned */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
- (msg_is_misaligned(type))) {
- saddr = msg_align(saddr);
+ (mach_msg_is_misaligned(type))) {
+ saddr = mach_msg_align(saddr);
continue;
}
name = type->msgtl_name;
@@ -249,7 +249,7 @@ ipc_kmsg_clean_body(
/* padding (ptrs and ports) ? */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
((size >> 3) == sizeof(natural_t)))
- saddr = msg_align(saddr);
+ saddr = mach_msg_align(saddr);
/* calculate length of data in bytes, rounding up */
@@ -392,8 +392,8 @@ xxx: type = (mach_msg_type_long_t *) eaddr;
if (((mach_msg_type_t*)type)->msgt_longform) {
/* This must be aligned */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
- (msg_is_misaligned(type))) {
- eaddr = msg_align(eaddr);
+ (mach_msg_is_misaligned(type))) {
+ eaddr = mach_msg_align(eaddr);
goto xxx;
}
name = type->msgtl_name;
@@ -410,7 +410,7 @@ xxx: type = (mach_msg_type_long_t *) eaddr;
/* padding (ptrs and ports) ? */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
((size >> 3) == sizeof(natural_t)))
- eaddr = msg_align(eaddr);
+ eaddr = mach_msg_align(eaddr);
/* calculate length of data in bytes, rounding up */
@@ -1332,8 +1332,8 @@ ipc_kmsg_copyin_body(
if (longform) {
/* This must be aligned */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
- (msg_is_misaligned(type))) {
- saddr = msg_align(saddr);
+ (mach_msg_is_misaligned(type))) {
+ saddr = mach_msg_align(saddr);
continue;
}
name = type->msgtl_name;
@@ -1362,7 +1362,7 @@ ipc_kmsg_copyin_body(
/* padding (ptrs and ports) ? */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
((size >> 3) == sizeof(natural_t)))
- saddr = msg_align(saddr);
+ saddr = mach_msg_align(saddr);
/* calculate length of data in bytes, rounding up */
@@ -1385,7 +1385,7 @@ ipc_kmsg_copyin_body(
vm_offset_t addr;
if (MACH_MSG_ALIGNMENT > sizeof(mach_msg_type_t))
- saddr = msg_align(saddr);
+ saddr = mach_msg_align(saddr);
if ((eaddr - saddr) < sizeof(vm_offset_t)) {
ipc_kmsg_clean_partial(kmsg, taddr, FALSE, 0);
@@ -1615,8 +1615,8 @@ ipc_kmsg_copyin_from_kernel(ipc_kmsg_t kmsg)
if (longform) {
/* This must be aligned */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
- (msg_is_misaligned(type))) {
- saddr = msg_align(saddr);
+ (mach_msg_is_misaligned(type))) {
+ saddr = mach_msg_align(saddr);
continue;
}
name = type->msgtl_name;
@@ -1633,7 +1633,7 @@ ipc_kmsg_copyin_from_kernel(ipc_kmsg_t kmsg)
/* padding (ptrs and ports) ? */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
((size >> 3) == sizeof(natural_t)))
- saddr = msg_align(saddr);
+ saddr = mach_msg_align(saddr);
/* calculate length of data in bytes, rounding up */
@@ -2388,8 +2388,8 @@ ipc_kmsg_copyout_body(
if (longform) {
/* This must be aligned */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
- (msg_is_misaligned(type))) {
- saddr = msg_align(saddr);
+ (mach_msg_is_misaligned(type))) {
+ saddr = mach_msg_align(saddr);
continue;
}
name = type->msgtl_name;
@@ -2406,7 +2406,7 @@ ipc_kmsg_copyout_body(
/* padding (ptrs and ports) ? */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
((size >> 3) == sizeof(natural_t)))
- saddr = msg_align(saddr);
+ saddr = mach_msg_align(saddr);
/* calculate length of data in bytes, rounding up */
@@ -2450,7 +2450,7 @@ ipc_kmsg_copyout_body(
vm_offset_t data;
if (MACH_MSG_ALIGNMENT > sizeof(mach_msg_type_t))
- saddr = msg_align(saddr);
+ saddr = mach_msg_align(saddr);
data = * (vm_offset_t *) saddr;
@@ -2827,8 +2827,8 @@ ipc_msg_print(mach_msg_header_t *msgh)
if (longform) {
/* This must be aligned */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
- (msg_is_misaligned(type))) {
- saddr = msg_align(saddr);
+ (mach_msg_is_misaligned(type))) {
+ saddr = mach_msg_align(saddr);
continue;
}
name = type->msgtl_name;
@@ -2873,7 +2873,7 @@ ipc_msg_print(mach_msg_header_t *msgh)
/* padding (ptrs and ports) ? */
if ((sizeof(natural_t) > sizeof(mach_msg_type_t)) &&
((size >> 3) == sizeof(natural_t)))
- saddr = msg_align(saddr);
+ saddr = mach_msg_align(saddr);
/* calculate length of data in bytes, rounding up */
diff --git a/x86_64/copy_user.c b/x86_64/copy_user.c
index 34fe5212..b340d6f0 100644
--- a/x86_64/copy_user.c
+++ b/x86_64/copy_user.c
@@ -149,8 +149,8 @@ size_t msg_usize(const mach_msg_header_t *kmsg)
size_t n = descsize_to_bytes(size);
saddr += n*number;
usize += n*number;
- saddr = msg_align(saddr);
- usize = msg_align(usize);
+ saddr = mach_msg_align(saddr);
+ usize = mach_msg_align(usize);
}
}
else
@@ -201,8 +201,8 @@ int copyinmsg (const void *userbuf, void *kernelbuf, const size_t usize)
mach_msg_type_size_t size;
mach_msg_type_number_t number;
boolean_t is_inline;
- usaddr = msg_align(usaddr);
- ksaddr = msg_align(ksaddr);
+ usaddr = mach_msg_align(usaddr);
+ ksaddr = mach_msg_align(ksaddr);
if (copyin_unpack_msg_type(usaddr, ksaddr, &name, &size, &number,
&is_inline, &amount))
return 1;
@@ -238,8 +238,8 @@ int copyinmsg (const void *userbuf, void *kernelbuf, const size_t usize)
return 1;
usaddr += n*number;
ksaddr += n*number;
- usaddr = msg_align(usaddr);
- ksaddr = msg_align(ksaddr);
+ usaddr = mach_msg_align(usaddr);
+ ksaddr = mach_msg_align(ksaddr);
}
}
else
@@ -261,7 +261,7 @@ int copyinmsg (const void *userbuf, void *kernelbuf, const size_t usize)
}
kmsg->msgh_size = sizeof(mach_msg_header_t) + ksaddr - (vm_offset_t)(kmsg + 1);
- kmsg->msgh_size = msg_align(kmsg->msgh_size);
+ kmsg->msgh_size = mach_msg_align(kmsg->msgh_size);
return 0;
}
@@ -295,8 +295,8 @@ int copyoutmsg (const void *kernelbuf, void *userbuf, const size_t ksize)
mach_msg_type_size_t size;
mach_msg_type_number_t number;
boolean_t is_inline;
- usaddr = msg_align(usaddr);
- ksaddr = msg_align(ksaddr);
+ usaddr = mach_msg_align(usaddr);
+ ksaddr = mach_msg_align(ksaddr);
amount = unpack_msg_type(ksaddr, &name, &size, &number, &is_inline);
// TODO: optimize and bring here type adjustment??
vm_offset_t utaddr=usaddr, ktaddr=ksaddr;
@@ -328,8 +328,8 @@ int copyoutmsg (const void *kernelbuf, void *userbuf, const size_t ksize)
return 1;
usaddr += n*number;
ksaddr += n*number;
- usaddr = msg_align(usaddr);
- ksaddr = msg_align(ksaddr);
+ usaddr = mach_msg_align(usaddr);
+ ksaddr = mach_msg_align(ksaddr);
}
}
else
@@ -353,7 +353,7 @@ int copyoutmsg (const void *kernelbuf, void *userbuf, const size_t ksize)
mach_msg_size_t usize;
usize = sizeof(mach_msg_user_header_t) + usaddr - (vm_offset_t)(umsg + 1);
- usize = msg_align(usize);
+ usize = mach_msg_align(usize);
if (copyout(&usize, &umsg->msgh_size, sizeof(kmsg->msgh_size)))
return 1;