[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3] SVM: use generic instruction decoding



On 30/09/16 15:44, Jan Beulich wrote:
>>> +int
>>> +x86_insn_modrm(const struct x86_emulate_state *state,
>>> +               unsigned int *rm, unsigned int *reg)
>>> +{
>>> +    check_state(state);
>>> +
>>> +    if ( !(state->desc & ModRM) )
>>> +        return -EINVAL;
>>> +
>>> +    if ( rm )
>>> +        *rm = state->modrm_rm;
>>> +    if ( reg )
>>> +        *reg = state->modrm_reg;
>>> +
>>> +    return state->modrm_mod;
>>> +}
>> Can this return struct modrm (which would then become visible outside of
>> svm.c)? And then x86_emulate_state can include the same struct instead
>> of the three separate fields.
> I'd prefer not to, to leave it to callers which parts they actually care
> about. No need for them to put the whole structure on stack when
> all they want is e.g. mod.

The structure is fine in principle, being only a single byte, but what
can't be represented with it is additions from REX prefixes.

I had considered making structures for ModRM/SIB bytes in the past, but
it makes the logic harder rather than easier.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.