ia64/xen-unstable

changeset 9339:a8b1d4fad72d

Fix a protocol violation in the pcnet emulation. 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@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Mar 20 12:01:32 2006 +0100 (2006-03-20)
parents 056e571ce462
children d982f5fa9bad
files tools/ioemu/hw/pcnet.h
line diff
     1.1 --- a/tools/ioemu/hw/pcnet.h	Mon Mar 20 12:00:58 2006 +0100
     1.2 +++ b/tools/ioemu/hw/pcnet.h	Mon Mar 20 12:01:32 2006 +0100
     1.3 @@ -225,9 +225,11 @@ static inline void pcnet_tmd_load(PCNetS
     1.4          ((uint32_t *)tmd)[3] = 0;
     1.5      }
     1.6      else
     1.7 -    if (BCR_SWSTYLE(s) != 3)
     1.8 -        cpu_physical_memory_read(addr, (void *)tmd, 16);
     1.9 -    else {
    1.10 +    if (BCR_SWSTYLE(s) != 3) {
    1.11 +        ((uint32_t *)tmd)[2] = 0;
    1.12 +        cpu_physical_memory_read(addr+4, (void *)&tmd->tmd1, 4);
    1.13 +        cpu_physical_memory_read(addr, (void *)&tmd->tmd0, 4);
    1.14 +    } else {
    1.15          uint32_t xda[4];
    1.16          cpu_physical_memory_read(addr,
    1.17                  (void *)&xda[0], sizeof(xda));
    1.18 @@ -253,9 +255,10 @@ static inline void pcnet_tmd_store(PCNet
    1.19          cpu_physical_memory_set_dirty(addr+7);
    1.20      }
    1.21      else {
    1.22 -        if (BCR_SWSTYLE(s) != 3)
    1.23 -            cpu_physical_memory_write(addr, (void *)tmd, 16);
    1.24 -        else {
    1.25 +        if (BCR_SWSTYLE(s) != 3) {
    1.26 +            cpu_physical_memory_write(addr+8, (void *)&tmd->tmd2, 4);
    1.27 +            cpu_physical_memory_write(addr+4, (void *)&tmd->tmd1, 4);
    1.28 +        } else {
    1.29              uint32_t xda[4];
    1.30              xda[0] = ((uint32_t *)tmd)[2];
    1.31              xda[1] = ((uint32_t *)tmd)[1];
    1.32 @@ -282,9 +285,11 @@ static inline void pcnet_rmd_load(PCNetS
    1.33          ((uint32_t *)rmd)[3] = 0;
    1.34      }
    1.35      else
    1.36 -    if (BCR_SWSTYLE(s) != 3)
    1.37 -        cpu_physical_memory_read(addr, (void *)rmd, 16);
    1.38 -    else {
    1.39 +    if (BCR_SWSTYLE(s) != 3) {
    1.40 +        rmd->rmd2.zeros = 0;
    1.41 +        cpu_physical_memory_read(addr+4, (void *)&rmd->rmd1, 4);
    1.42 +        cpu_physical_memory_read(addr, (void *)&rmd->rmd0, 4);
    1.43 +    } else {
    1.44          uint32_t rda[4];
    1.45          cpu_physical_memory_read(addr,
    1.46                  (void *)&rda[0], sizeof(rda));
    1.47 @@ -310,9 +315,10 @@ static inline void pcnet_rmd_store(PCNet
    1.48          cpu_physical_memory_set_dirty(addr+7);
    1.49      }
    1.50      else {
    1.51 -        if (BCR_SWSTYLE(s) != 3)
    1.52 -            cpu_physical_memory_write(addr, (void *)rmd, 16);
    1.53 -        else {
    1.54 +        if (BCR_SWSTYLE(s) != 3) {
    1.55 +            cpu_physical_memory_write(addr+8, (void *)&rmd->rmd2, 4);
    1.56 +            cpu_physical_memory_write(addr+4, (void *)&rmd->rmd1, 4);
    1.57 +        } else {
    1.58              uint32_t rda[4];
    1.59              rda[0] = ((uint32_t *)rmd)[2];
    1.60              rda[1] = ((uint32_t *)rmd)[1];
    1.61 @@ -339,8 +345,7 @@ static inline void pcnet_rmd_store(PCNet
    1.62  #define CHECK_RMD(ADDR,RES) do {                \
    1.63      struct pcnet_RMD rmd;                       \
    1.64      RMDLOAD(&rmd,(ADDR));                       \
    1.65 -    (RES) |= (rmd.rmd1.ones != 15)              \
    1.66 -          || (rmd.rmd2.zeros != 0);             \
    1.67 +    (RES) |= (rmd.rmd1.ones != 15);             \
    1.68  } while (0)
    1.69  
    1.70  #define CHECK_TMD(ADDR,RES) do {                \