summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ioq.c2
-rw-r--r--src/ioq.h9
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ioq.c b/src/ioq.c
index cf0b927..f23b62f 100644
--- a/src/ioq.c
+++ b/src/ioq.c
@@ -177,7 +177,7 @@ typedef atomic uintptr_t ioq_slot;
#define IOQ_SKIP_ONE (~IOQ_BLOCKED)
// Need room for two flag bits
-bfs_static_assert(alignof(struct ioq_ent) > 2);
+bfs_static_assert(alignof(struct ioq_ent) >= (1 << 2));
/**
* An MPMC queue of I/O commands.
diff --git a/src/ioq.h b/src/ioq.h
index 30e90e0..818eea6 100644
--- a/src/ioq.h
+++ b/src/ioq.h
@@ -33,11 +33,18 @@ enum ioq_op {
};
/**
+ * The I/O queue implementation needs two tag bits in each pointer to a struct
+ * ioq_ent, so we need to ensure at least 4-byte alignment. The natural
+ * alignment is enough on most architectures, but not m68k, so over-align it.
+ */
+#define IOQ_ENT_ALIGN alignas(4)
+
+/**
* An I/O queue entry.
*/
struct ioq_ent {
/** The I/O operation. */
- enum ioq_op op;
+ IOQ_ENT_ALIGN enum ioq_op op;
/** The return value (on success) or negative error code (on failure). */
int result;