On 1/6/2025 9:37 AM, Michael Kelley wrote:
From: Roman Kisel <romank@xxxxxxxxxxxxxxxxxxx> Sent: Monday, December 30, 2024 10:10 AM
[...]
These bit field definitions don't look right. We want to "fill up"
the field size, so that we're explicit about each bit, and not leave
it to the compiler to add padding (which __packed tells the
compiler not to do). So in aggregate, the "u64" bit fields should
account for all 64 bits, but here you account for only 32 bits.
There are two ways to fix this:
u32 interruption_pending : 1;
u32 interruption_type: 1;
u32 reserved : 30;
u32 error_code;
Or
u64 interruption_pending : 1;
u64 interruption_type: 1;
u64 reserved : 30;
u64 error_code : 32;
Nuno -- your thoughts?
Quite a blunder on my side! Thank you very much for your help :)
GDB is my witness:
(gdb) ptype /o union hv_arm64_pending_synthetic_exception_event
/* offset | size */ type = union
hv_arm64_pending_synthetic_exception_event {
/* 16 */ u64 as_uint64[2];
/* 13 */ struct {
/* 0: 0 | 4 */ u32 event_pending : 1;
/* 0: 1 | 4 */ u32 event_type : 3;
/* 0: 4 | 4 */ u32 reserved : 4;
/* 1 | 4 */ u32 exception_type;
/* 5 | 8 */ u64 context;
/* total size (bytes): 13 */
};
/* total size (bytes): 16 */
}
which looks messed up to me to put it mildly. Will fix next time.
[...]
Michael
+
+/*
+ * NOTE: Linux helper struct - NOT from Hyper-V code.
+ * DECLARE_FLEX_ARRAY() needs to be wrapped into
+ * a structure and have at least one more member besides
+ * DECLARE_FLEX_ARRAY.
+ */
+struct hv_output_get_vp_registers {
+ struct {
+ DECLARE_FLEX_ARRAY(union hv_register_value, values);
+ struct {} values_end;
+ };
};
#if defined(CONFIG_ARM64)
--
2.34.1
--
Thank you,
Roman