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

Re: [Xen-devel] [PATCH] x86/HVM: 32-bit IN result must be zero-extended to 64 bits



>>> On 05.11.13 at 10:53, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
> On 05/11/13 08:46, Jan Beulich wrote:
>> @@ -237,7 +239,12 @@ int handle_pio(uint16_t port, int size, 
>>      {
>>      case X86EMUL_OKAY:
>>          if ( dir == IOREQ_READ )
>> -            memcpy(&guest_cpu_user_regs()->eax, &data, vio->io_size);
>> +        {
>> +            if ( size == 4 ) /* Needs zero extension. */
>> +                guest_cpu_user_regs()->eax = (uint32_t)data;
> 
> This would be a rather more clear as guest_cpu_user_regs()->rax, with
> makes the 0-extension more obvious than remembering that eax is a 64bit
> value in Xen.  However, I guess consistency with the surrounding code is
> important, and it is spelt out in a comment.

In fact I agree - I coded it that way with backportability in mind,
but am inclined to change _both_ instances to "rax" here (which
will cause obvious build breakage if not adjusted accordingly for
4.2 and earlier).

> Either way,
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Thanks.

Jan


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


 


Rackspace

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