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
|