On 28/04/2021 10:14, Jan Beulich wrote: > On 27.04.2021 19:47, Andrew Cooper wrote: >> On 27/04/2021 16:53, Jan Beulich wrote: >>> On 26.04.2021 19:54, Andrew Cooper wrote: >>>> @@ -497,7 +501,9 @@ struct vmcb_struct { >>>> u64 rip; >>>> u64 res14[11]; >>>> u64 rsp; >>>> - u64 res15[3]; >>>> + u64 _msr_s_cet; /* offset 0x400 + 0x1E0 - cleanbit 12 */ >>>> + u64 _ssp; /* offset 0x400 + 0x1E8 | */ >>>> + u64 _msr_isst; /* offset 0x400 + 0x1F0 v */ >>>> u64 rax; >>>> u64 star; >>>> u64 lstar; >>> Any reason for the leading underscores, when none of the neighboring >>> fields have such? >> Yes - they're covered by a cleanbit, and for better or worse, this is >> our style. > The underscore prefixes are, to my understanding, there only to > emphasize that the fields shouldn't be accessed directly, but ... > >>> Did you perhaps mean to add VMCB_ACCESSORS() >>> instances for them? >> TBH, I opencoded the cleanbit handling because I thoroughly hate that >> entire infrastructure. > ... via this (or something with similar abstracting effect). So > for any fields you mean to access directly they imo shouldn't be > there. I particularly don't view them as indicators of being > covered by cleanbits (if the respective accessors aren't used).
The leading underscores are enforced by 'vmcb->_ ## name' in VMCB_ACCESSORS(). The cleanbits are the only reason we can't treat this as a simple struct. ~Andrew