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

[Xen-changelog] Fix a regression in hvm_pio_assist() when booting Windows



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 02e8dd5e4c572dac62750ccd7e8dd93829a79e0c
# Parent  ce7746d47f1854281626742de65bdb590d7ad763
Fix a regression in hvm_pio_assist() when booting Windows
on VT-x. Clean up the function also.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r ce7746d47f18 -r 02e8dd5e4c57 xen/arch/x86/hvm/io.c
--- a/xen/arch/x86/hvm/io.c     Wed Apr  5 09:54:29 2006
+++ b/xen/arch/x86/hvm/io.c     Wed Apr  5 11:23:49 2006
@@ -365,57 +365,46 @@
     unsigned long old_eax;
     int sign = p->df ? -1 : 1;
 
-    if (p->pdata_valid || (mmio_opp->flags & OVERLAP)) {
-        if (mmio_opp->flags & REPZ)
+    if ( p->pdata_valid || (mmio_opp->flags & OVERLAP) )
+    {
+        if ( mmio_opp->flags & REPZ )
             regs->ecx -= p->count;
-        if (p->dir == IOREQ_READ) {
+        if ( p->dir == IOREQ_READ )
+        {
             regs->edi += sign * p->count * p->size;
-
-            if (mmio_opp->flags & OVERLAP) {
-                /* 
-                 * If we are doing in IN and it's overlapping a page boundary, 
-                 * we need to copy the data back to user's page with hvm_copy. 
-                 * Note that overlap * can only be set with paging enabled, so 
-                 * we don't need to worry about * real-mode stuff.  
-                 */
-                unsigned long addr;
-                {
-                    /* 
-                    * We completely ignore segment registers here - 
-                     * it's not a good idea. We also may use upper bits
-                     * in edi when in 16-bit real/protected mode.
-                     * We really need to get the actual address back from
-                     * the arch-dependant HVM portion.
-                     */
-                    struct vcpu *v = current;
-                    if (hvm_realmode(v))
-                        __hvm_bug(regs);
-                }
-                addr = regs->edi;
+            if ( mmio_opp->flags & OVERLAP )
+            {
+                unsigned long addr = regs->edi;
+                if (hvm_realmode(current))
+                    addr += regs->es << 4;
                 if (sign > 0)
                     addr -= p->size;
                 hvm_copy(&p->u.data, addr, p->size, HVM_COPY_OUT);
             }
-        } else
+        }
+        else /* p->dir == IOREQ_WRITE */
+        {
+            ASSERT(p->dir == IOREQ_WRITE);
             regs->esi += sign * p->count * p->size;
-
-    } else {
-        if (p->dir == IOREQ_READ) {
-            old_eax = regs->eax;
-            switch (p->size) {
-            case 1:
-                regs->eax = (old_eax & 0xffffff00) | (p->u.data & 0xff);
-                break;
-            case 2:
-                regs->eax = (old_eax & 0xffff0000) | (p->u.data & 0xffff);
-                break;
-            case 4:
-                regs->eax = (p->u.data & 0xffffffff);
-                break;
-            default:
-                printk("Error: %s unknown port size\n", __FUNCTION__);
-                domain_crash_synchronous();
-            }
+        }
+    }
+    else if ( p->dir == IOREQ_READ )
+    {
+        old_eax = regs->eax;
+        switch ( p->size )
+        {
+        case 1:
+            regs->eax = (old_eax & 0xffffff00) | (p->u.data & 0xff);
+            break;
+        case 2:
+            regs->eax = (old_eax & 0xffff0000) | (p->u.data & 0xffff);
+            break;
+        case 4:
+            regs->eax = (p->u.data & 0xffffffff);
+            break;
+        default:
+            printk("Error: %s unknown port size\n", __FUNCTION__);
+            domain_crash_synchronous();
         }
     }
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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