From a391c8f0eef8573fd6b99e6cd264a5f2caa539cb Mon Sep 17 00:00:00 2001 From: Flavio Cruz Date: Sun, 12 Feb 2023 17:14:23 -0500 Subject: Introduce complex_alignof to replace word_size Remove the concept of word_size since it is meaningless in some architectures. This is also done in preparation to possibly introduce 8-byte aligned messages. Message-Id: --- routine.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'routine.c') diff --git a/routine.c b/routine.c index c0a016c..3ae9298 100644 --- a/routine.c +++ b/routine.c @@ -47,6 +47,7 @@ #include "routine.h" #include "message.h" #include "cpu.h" +#include "utils.h" u_int rtNumber = 0; @@ -316,19 +317,21 @@ rtFindSize(const argument_t *args, u_int mask) const argument_t *arg; u_int size = sizeof_mach_msg_header_t; + size = ALIGN(size, complex_alignof); for (arg = args; arg != argNULL; arg = arg->argNext) if (akCheck(arg->argKind, mask)) { ipc_type_t *it = arg->argType; /* might need proper alignment on demanding 64bit archies */ - size = (size + word_size-1) & ~(word_size-1); if (arg->argLongForm) { size += sizeof_mach_msg_type_long_t; } else { size += sizeof_mach_msg_type_t; } + size = ALIGN(size, complex_alignof); + /* Note itMinTypeSize is already aligned to complex_alignof. */ size += it->itMinTypeSize; } -- cgit v1.2.3