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

Re: [Xen-devel] [PATCH] x86emul: {L, S}{G, I}DT ignore operand size overrides in 64-bit mode



On 03/11/16 08:06, Jan Beulich wrote:
>>>> On 02.11.16 at 18:42, <andrew.cooper3@xxxxxxxxxx> wrote:
>> On 02/11/16 16:12, Jan Beulich wrote:
>>> This affects not only the layout of the data (always 2+8 bytes), but
>>> also the contents (no truncation to 24 bits occurs).
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, although
>> wouldn't it be cleaner to set op_bytes = def_op_bytes, than to keep
>> referring back to mode_64()?
> That would still mean
>
>             if ( mode_64bit() )
>                 op_bytes = def_op_bytes;

Oh true.

>
> and wouldn't eliminate the uses in the second ops->write() /
> read_ulong() either.
>
> What we could do in the S{G,I}DT case is
>
>             if ( mode_64bit() )
>                 op_bytes = 8;
>             else if ( op_bytes == 2 )
>             {
>                 sreg.base &= 0xffffff;
>                 op_bytes = 4;
>             }
>             if ( (rc = ops->write(ea.mem.seg, ea.mem.off+0,
>                                   &sreg.limit, 2, ctxt)) ||
>                  (rc = ops->write(ea.mem.seg, ea.mem.off+2,
>                                   &sreg.base, op_bytes, ctxt)) )
>
> But the same can't be done in the L{G,I}DT case. Let me know.

This does look a little cleaner, even if it is only for the sgdt/sidt case.

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