From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] x86/HVM: 32-bit IN result must be zero-extended to 64 bits (part 2) Date: Wed, 13 Nov 2013 17:12:29 +0000 Message-ID: <5283B2FD.7070101@citrix.com> References: <5283C05E0200007800102F78@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3915454277978013789==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VgdzW-0006Hy-I3 for xen-devel@lists.xenproject.org; Wed, 13 Nov 2013 17:12:34 +0000 In-Reply-To: <5283C05E0200007800102F78@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org --===============3915454277978013789== Content-Type: multipart/alternative; boundary="------------070200080207030004030303" --------------070200080207030004030303 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit 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 Reviewed-by: Andrew Cooper > > --- 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 --------------070200080207030004030303 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit
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

--------------070200080207030004030303-- --===============3915454277978013789== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============3915454277978013789==--