[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 at 16:54, <boris.ostrovsky@xxxxxxxxxx> wrote:
> On 09/30/2016 10:44 AM, 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.
> 
> But isn't the whole struct one byte long so you'd not be increasing
> amount of data on stack? This will also make comparison at least in
> __get_instruction_length_from_list() (and possibly other places) simpler.

See the other reply (as well as Andrew's): We'd be making available
incomplete information if we did it that way.

Jan


_______________________________________________
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®.