We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 02766fb commit 6f3d893Copy full SHA for 6f3d893
1 file changed
include/hvt_ring.h
@@ -27,6 +27,7 @@
27
#ifndef HVT_RING_H
28
#define HVT_RING_H
29
30
+#include <stddef.h>
31
#include <stdint.h>
32
33
#define HVT_RING_SIZE 1024
@@ -94,6 +95,16 @@ struct hvt_ring {
94
95
struct hvt_ring_commit commits[HVT_RING_SIZE];
96
};
97
98
+/*
99
+ * Verify that guest-written and host-written fields live on distinct cache
100
+ * lines (64 bytes each), and that the data arrays start after exactly 2
101
+ * cache lines of index/control fields.
102
+ */
103
+_Static_assert(offsetof(struct hvt_ring, ent_head) == 64,
104
+ "ent_head must start at cache line 1 (offset 64)");
105
+_Static_assert(offsetof(struct hvt_ring, entries) == 128,
106
+ "entries[] must start after 2 cache lines (offset 128)");
107
+
108
/*
109
* Memory barriers.
110
*
0 commit comments