@@ -68,6 +68,32 @@ cp arm/mod.rs arm64/
68
68
69
69
Also, you will need to add the new architecture to ` kvm-bindings/lib.rs ` .
70
70
71
+ When regenerating bindings, care must be taken to re-add various ` zerocopy `
72
+ derives under the ` serde ` feature. All items that require derives are
73
+ listed in the ` x86_64/serialize.rs ` and ` arm64/serialize.rs ` inside the
74
+ ` serde_impls! ` macro invocation, and missing derives will cause these
75
+ modules to fail compilation. For all items listed here, the following
76
+ derive should be present:
77
+
78
+ ``` rs
79
+ #[cfg_attr(
80
+ feature = " serde" ,
81
+ derive(zerocopy:: AsBytes , zerocopy:: FromBytes , zerocopy:: FromZeroes )
82
+ )]
83
+ ```
84
+
85
+ Any types whose name contains a suffix akin to ` __bindgen_ty_<number> ` and
86
+ which is contained in any struct listed in ` serialize.rs ` will also need
87
+ to have this derive added (otherwise compilation will fail). Note that
88
+ these types are not explicitly listed in ` serialize.rs ` , as their names
89
+ can change across ` bindgen.rs ` versions.
90
+
91
+ Lastly, in ` x86_64/bindings.rs ` , the derives also need to be added to
92
+ ` struct __BindgenBitfieldUnit<Storage> ` and ` struct __IncompleteArrayField<T> ` .
93
+ Additionally, these structs need to have their layout changed from ` #[repr(C)] `
94
+ to ` #[repr(transparent)] ` . This is needed because ` zerocopy ` traits can only be
95
+ derived on generic structures that are ` repr(transparent) ` or ` repr(packed) ` .
96
+
71
97
### Future Improvements
72
98
All the above steps are scriptable, so in the next iteration I will add a
73
99
script to generate the bindings.
0 commit comments