On Wed, 2019-12-04 at 10:04 +0100, Jan Beulich wrote: > On 03.12.2019 18:10, Andrew Cooper wrote: > > --- a/xen/include/public/hvm/dm_op.h > > +++ b/xen/include/public/hvm/dm_op.h > > @@ -324,7 +324,7 @@ struct xen_dm_op_inject_event { > > /* IN - error code (or ~0 to skip) */ > > uint32_t error_code; > > uint32_t pad1; > > - /* IN - CR2 for page faults */ > > + /* IN - type-specific extra data (%cr2 for #PF, pending_dbg > > for #DB) */ > > uint64_aligned_t cr2; > > }; > > How about > > uint32_t error_code; > uint32_t pad1; > /* IN - type-specific extra data (%cr2 for #PF, pending_dbg for > #DB) */ > #if defined(__XEN__) || defined(__XEN_TOOLS__) > uint64_aligned_t extra; > #else > uint64_aligned_t cr2; > #endif > }; > > or something along these lines (e.g. could also be an unnamed > union guarded by a __GNUC__ check, or a __XEN_INTERFACE_VERSION__ > conditional), to have a less confusing name in Xen and the tools? > Either way hypervisor bits > Honestly, this looks a little bit scary. However, it might be a good opportunity to discuss upgrading to C11, which supports anonymous unions and offers a cleaner (and safer) way to handle this type of problems.
Best regards, Petre _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel