| 1 |
commit 3f4b0062963fca5d90fc65c1d7912ecdc21a8fed |
| 2 |
Author: Samuel Thibault <[email protected]> |
| 3 |
Date: Mon Jun 9 23:30:36 2025 +0200 |
| 4 |
|
| 5 |
Fix aligning 64b types in structures |
| 6 |
|
| 7 |
diff --git a/cpu.sym b/cpu.sym |
| 8 |
index 1ac2fae..ac2ff40 100644 |
| 9 |
--- a/cpu.sym |
| 10 |
+++ b/cpu.sym |
| 11 |
@@ -101,6 +101,7 @@ expr sizeof(char) sizeof_char |
| 12 |
expr sizeof(short) sizeof_short |
| 13 |
expr sizeof(int) sizeof_int |
| 14 |
expr sizeof(long) sizeof_long |
| 15 |
+expr sizeof(int64_t) sizeof_int64_t |
| 16 |
expr sizeof(float) sizeof_float |
| 17 |
expr sizeof(double) sizeof_double |
| 18 |
expr sizeof(uintptr_t) sizeof_uintptr_t |
| 19 |
diff --git a/type.c b/type.c |
| 20 |
index aaa01f9..6042898 100644 |
| 21 |
--- a/type.c |
| 22 |
+++ b/type.c |
| 23 |
@@ -48,6 +48,7 @@ ipc_type_t *itWaitTimeType; /* used for dummy WaitTime args */ |
| 24 |
ipc_type_t *itMsgOptionType; /* used for dummy MsgOption args */ |
| 25 |
ipc_type_t *itShortType; /* used for the short type */ |
| 26 |
ipc_type_t *itIntType; /* used for the int type */ |
| 27 |
+ipc_type_t *itInt64Type; /* used for the int64 type */ |
| 28 |
ipc_type_t *itUintPtrType; /* used for the uintptr_t type */ |
| 29 |
ipc_type_t *itIntPtrType; /* used for the intptr_t type */ |
| 30 |
static bool types_initialized = false; |
| 31 |
@@ -740,6 +741,11 @@ itStructDecl(u_int min_type_size_in_bytes, u_int required_alignment_in_bytes) |
| 32 |
assert(final_struct_bytes % 4 == 0); |
| 33 |
number_elements = final_struct_bytes / 4; |
| 34 |
break; |
| 35 |
+ case 8: |
| 36 |
+ element_type = itInt64Type; |
| 37 |
+ assert(final_struct_bytes % 8 == 0); |
| 38 |
+ number_elements = final_struct_bytes / 8; |
| 39 |
+ break; |
| 40 |
case 1: |
| 41 |
default: |
| 42 |
element_type = itByteType; |
| 43 |
@@ -979,6 +985,8 @@ init_type(void) |
| 44 |
itInsert("short", itShortType); |
| 45 |
itIntType = itCIntTypeDecl("int", sizeof_int); |
| 46 |
itInsert("int", itIntType); |
| 47 |
+ itInt64Type = itCIntTypeDecl("int64", sizeof_int64_t); |
| 48 |
+ itInsert("int64", itInt64Type); |
| 49 |
itUintPtrType = itCIntTypeDecl("uintptr_t", sizeof_uintptr_t); |
| 50 |
itInsert("uintptr_t", itUintPtrType); |
| 51 |
itIntPtrType = itCIntTypeDecl("intptr_t", sizeof_intptr_t); |