Fix for transfers across segments.
authorTom Rix <trix@redhat.com>
Sat, 15 Jun 2002 11:01:34 +0000 (11:01 +0000)
committerTom Rix <trix@redhat.com>
Sat, 15 Jun 2002 11:01:34 +0000 (11:01 +0000)
sim/d10v/ChangeLog
sim/d10v/interp.c

index 91d71f3f512e86f7df85a83fd1ff7e206c54d39f..b5343d61d161b3dbd1ecd16d72d9ae5944b3985b 100644 (file)
@@ -1,3 +1,7 @@
+2002-06-13  Tom Rix  <trix@redhat.com>
+
+       * interp.c (xfer_mem): Fix transfers across multiple segments.
 2002-06-09  Andrew Cagney  <cagney@redhat.com>
 
        * Makefile.in (INCLUDE): Update path to callback.h.
index e465a809d02313936d431378ee41c668b2193aa3..0f7295dc239d32f35cedc94c81fe0b0b045129a4 100644 (file)
@@ -715,7 +715,7 @@ xfer_mem (SIM_ADDR virt,
 {
   int xfered = 0;
 
-  while (xfered < size)
+  while (0 < size)
     {
       uint8 *memory;
       unsigned long phys;
@@ -754,9 +754,10 @@ xfer_mem (SIM_ADDR virt,
       virt += phys_size;
       buffer += phys_size;
       xfered += phys_size;
+      size -= phys_size;
     }
 
-  return size;
+  return xfered;
 }