WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] pcnet emulation bug fix

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] pcnet emulation bug fix
From: Don Fry <brazilnut@xxxxxxxxxx>
Date: Fri, 17 Mar 2006 15:56:15 -0800
Delivery-date: Mon, 20 Mar 2006 10:40:03 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6i
This patch fixes a protocol violation in the pcnet emulation.  It has
been tested on at least two systems and fixes the 'corrupt MAC' with scp
or sftp.  See bug 574 for more information.

Signed-off-by:  Don Fry <brazilnut@xxxxxxxxxx>

--- ioemu/hw/orig.pcnet.h       2006-03-14 08:54:57.000000000 -0800
+++ ioemu/hw/pcnet.h    2006-03-16 16:50:49.000000000 -0800
@@ -225,9 +225,11 @@ static inline void pcnet_tmd_load(PCNetS
         ((uint32_t *)tmd)[3] = 0;
     }
     else
-    if (BCR_SWSTYLE(s) != 3)
-        cpu_physical_memory_read(addr, (void *)tmd, 16);
-    else {
+    if (BCR_SWSTYLE(s) != 3) {
+        ((uint32_t *)tmd)[2] = 0;
+        cpu_physical_memory_read(addr+4, (void *)&tmd->tmd1, 4);
+        cpu_physical_memory_read(addr, (void *)&tmd->tmd0, 4);
+    } else {
         uint32_t xda[4];
         cpu_physical_memory_read(addr,
                 (void *)&xda[0], sizeof(xda));
@@ -253,9 +255,10 @@ static inline void pcnet_tmd_store(PCNet
         cpu_physical_memory_set_dirty(addr+7);
     }
     else {
-        if (BCR_SWSTYLE(s) != 3)
-            cpu_physical_memory_write(addr, (void *)tmd, 16);
-        else {
+        if (BCR_SWSTYLE(s) != 3) {
+            cpu_physical_memory_write(addr+8, (void *)&tmd->tmd2, 4);
+            cpu_physical_memory_write(addr+4, (void *)&tmd->tmd1, 4);
+        } else {
             uint32_t xda[4];
             xda[0] = ((uint32_t *)tmd)[2];
             xda[1] = ((uint32_t *)tmd)[1];
@@ -282,9 +285,11 @@ static inline void pcnet_rmd_load(PCNetS
         ((uint32_t *)rmd)[3] = 0;
     }
     else
-    if (BCR_SWSTYLE(s) != 3)
-        cpu_physical_memory_read(addr, (void *)rmd, 16);
-    else {
+    if (BCR_SWSTYLE(s) != 3) {
+        rmd->rmd2.zeros = 0;
+        cpu_physical_memory_read(addr+4, (void *)&rmd->rmd1, 4);
+        cpu_physical_memory_read(addr, (void *)&rmd->rmd0, 4);
+    } else {
         uint32_t rda[4];
         cpu_physical_memory_read(addr,
                 (void *)&rda[0], sizeof(rda));
@@ -310,9 +315,10 @@ static inline void pcnet_rmd_store(PCNet
         cpu_physical_memory_set_dirty(addr+7);
     }
     else {
-        if (BCR_SWSTYLE(s) != 3)
-            cpu_physical_memory_write(addr, (void *)rmd, 16);
-        else {
+        if (BCR_SWSTYLE(s) != 3) {
+            cpu_physical_memory_write(addr+8, (void *)&rmd->rmd2, 4);
+            cpu_physical_memory_write(addr+4, (void *)&rmd->rmd1, 4);
+        } else {
             uint32_t rda[4];
             rda[0] = ((uint32_t *)rmd)[2];
             rda[1] = ((uint32_t *)rmd)[1];
@@ -339,8 +345,7 @@ static inline void pcnet_rmd_store(PCNet
 #define CHECK_RMD(ADDR,RES) do {                \
     struct pcnet_RMD rmd;                       \
     RMDLOAD(&rmd,(ADDR));                       \
-    (RES) |= (rmd.rmd1.ones != 15)              \
-          || (rmd.rmd2.zeros != 0);             \
+    (RES) |= (rmd.rmd1.ones != 15);             \
 } while (0)
 
 #define CHECK_TMD(ADDR,RES) do {                \

-- 
Don Fry
brazilnut@xxxxxxxxxx

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] pcnet emulation bug fix, Don Fry <=