Re: [PATCH v2 04/16] KVM: VMX: Introduce unified instruction info structure
From: Sean Christopherson
Date: Thu Mar 12 2026 - 21:07:09 EST
On Fri, Mar 06, 2026, Chang S. Bae wrote:
> On 3/4/2026 8:21 PM, Sean Christopherson wrote:
> > static inline int vmx_get_insn_info_reg(u64 insn_info)
> > {
> > return vmx_insn_info_extended() ? (insn_info >> ??) & 0x1f :
> > (insn_info >> 3) & 0xf;
> > }
>
> There is
>
> int get_vmx_mem_address(...)
> {
> ...
>
> /*
> * According to Vol. 3B,...
> */
> int scaling = vmx_instruction_info & 3;
> int addr_size = (vmx_instruction_info >> 7) & 7;
> bool is_reg = vmx_instruction_info & (1u << 10);
> int seg_reg = (vmx_instruction_info >> 15) & 7;
> int index_reg = (vmx_instruction_info >> 18) & 0xf;
> bool index_is_valid = !(vmx_instruction_info & (1u << 22));
> int base_reg = (vmx_instruction_info >> 23) & 0xf;
> bool base_is_valid = !(vmx_instruction_info & (1u << 27));
>
> I'd assume wrappers like above for each line there.
Ya.
> But to confirm your preference: would you rather keep this open-coded, or
> introduce another wrappers for each?
Assuming the alternative is to open code both the extended and regular versions,
yes, definitely add wrappers.