Jan Beulich
2013-Nov-13 17:09 UTC
[PATCH] x86/HVM: 32-bit IN result must be zero-extended to 64 bits (part 2)
Just spotted a counterpart of what commit 9d89100b (same title) dealt with. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- 2013-10-16.orig/xen/arch/x86/hvm/io.c 2013-11-13 17:45:16.000000000 +0100 +++ 2013-10-16/xen/arch/x86/hvm/io.c 2013-11-13 17:47:47.000000000 +0100 @@ -290,8 +290,10 @@ void hvm_io_assist(void) (void)handle_mmio(); break; case HVMIO_handle_pio_awaiting_completion: - memcpy(&guest_cpu_user_regs()->eax, - &p->data, vio->io_size); + if ( vio->io_size == 4 ) /* Needs zero extension. */ + guest_cpu_user_regs()->rax = (uint32_t)p->data; + else + memcpy(&guest_cpu_user_regs()->rax, &p->data, vio->io_size); break; default: break; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Andrew Cooper
2013-Nov-13 17:12 UTC
Re: [PATCH] x86/HVM: 32-bit IN result must be zero-extended to 64 bits (part 2)
On 13/11/13 17:09, Jan Beulich wrote:> Just spotted a counterpart of what commit 9d89100b (same title) dealt > with. > > Signed-off-by: Jan Beulich <jbeulich@suse.com>Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>> > --- 2013-10-16.orig/xen/arch/x86/hvm/io.c 2013-11-13 17:45:16.000000000 +0100 > +++ 2013-10-16/xen/arch/x86/hvm/io.c 2013-11-13 17:47:47.000000000 +0100 > @@ -290,8 +290,10 @@ void hvm_io_assist(void) > (void)handle_mmio(); > break; > case HVMIO_handle_pio_awaiting_completion: > - memcpy(&guest_cpu_user_regs()->eax, > - &p->data, vio->io_size); > + if ( vio->io_size == 4 ) /* Needs zero extension. */ > + guest_cpu_user_regs()->rax = (uint32_t)p->data; > + else > + memcpy(&guest_cpu_user_regs()->rax, &p->data, vio->io_size); > break; > default: > break; > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Keir Fraser
2013-Nov-13 18:09 UTC
Re: [PATCH] x86/HVM: 32-bit IN result must be zero-extended to 64 bits (part 2)
On 13/11/2013 17:09, "Jan Beulich" <JBeulich@suse.com> wrote:> Just spotted a counterpart of what commit 9d89100b (same title) dealt > with. > > Signed-off-by: Jan Beulich <jbeulich@suse.com>Acked-by: Keir Fraser <keir@xen.org>> --- 2013-10-16.orig/xen/arch/x86/hvm/io.c 2013-11-13 17:45:16.000000000 +0100 > +++ 2013-10-16/xen/arch/x86/hvm/io.c 2013-11-13 17:47:47.000000000 +0100 > @@ -290,8 +290,10 @@ void hvm_io_assist(void) > (void)handle_mmio(); > break; > case HVMIO_handle_pio_awaiting_completion: > - memcpy(&guest_cpu_user_regs()->eax, > - &p->data, vio->io_size); > + if ( vio->io_size == 4 ) /* Needs zero extension. */ > + guest_cpu_user_regs()->rax = (uint32_t)p->data; > + else > + memcpy(&guest_cpu_user_regs()->rax, &p->data, vio->io_size); > break; > default: > break; > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel