aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-02-12 17:14:23 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-02-13 00:42:36 +0100
commita391c8f0eef8573fd6b99e6cd264a5f2caa539cb (patch)
tree4e0835b958dcd51a59ab5a1bf652dec4ea2c544a /utils.c
parent403007dc55222d4ca1120dd7730baa7579d12d88 (diff)
downloadmig-a391c8f0eef8573fd6b99e6cd264a5f2caa539cb.tar.gz
mig-a391c8f0eef8573fd6b99e6cd264a5f2caa539cb.tar.bz2
mig-a391c8f0eef8573fd6b99e6cd264a5f2caa539cb.zip
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: <Y+lkv0uMo/3+hbCb@jupiter.tail36e24.ts.net>
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index 2fb8c2e..f2f45f6 100644
--- a/utils.c
+++ b/utils.c
@@ -304,6 +304,10 @@ WriteFieldDeclPrim(FILE *file, const argument_t *arg,
fprintf(file, "\t\tmach_msg_type_%st %s;\n",
arg->argLongForm ? "long_" : "", arg->argTTName);
+ if (!arg->argLongForm && complex_alignof > sizeof_mach_msg_type_t) {
+ /* Pad mach_msg_type_t in case we need alignment by more than its size. */
+ fprintf(file, "\t\tchar %s_pad[%d];\n", arg->argTTName, complex_alignof - sizeof_mach_msg_type_t);
+ }
if (it->itInLine && it->itVarArray)
{
@@ -338,7 +342,7 @@ void
WriteStructDecl(FILE *file, const argument_t *args, write_list_fn_t *func,
u_int mask, const char *name)
{
- fprintf(file, "#pragma pack(push,%d)\n", word_size);
+ fprintf(file, "#pragma pack(push,%d)\n", complex_alignof);
fprintf(file, "\ttypedef struct {\n");
fprintf(file, "\t\tmach_msg_header_t Head;\n");
WriteList(file, args, func, mask, "\n", "\n");