2003-06-22 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Sun, 22 Jun 2003 13:38:28 +0000 (13:38 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sun, 22 Jun 2003 13:38:28 +0000 (13:38 +0000)
* interp.c (xfer_mem): Simplify.  Only do a single partial
transfer.  Problem reported by Tom Rix.

sim/d10v/ChangeLog
sim/d10v/interp.c

index 3256284ad4123368bc48f7967aec082dcb21dea0..f8e70a531c5017b86f87c531263793b01d8557d8 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-22  Andrew Cagney  <cagney@redhat.com>
+
+       * interp.c (xfer_mem): Simplify.  Only do a single partial
+       transfer.  Problem reported by Tom Rix.
+
 2003-05-07  Andrew Cagney  <cagney@redhat.com>
 
        * interp.c (sim_d10v_translate_addr): Add "regcache" parameter.
index 30239ab0247a778f7ccb9e267eb4d869fc4afdbc..284a4e144c4c8de551af4d60f6588d62a9df023a 100644 (file)
@@ -720,49 +720,39 @@ xfer_mem (SIM_ADDR virt,
          int size,
          int write_p)
 {
-  int xfered = 0;
-
-  while (0 < size)
-    {
-      uint8 *memory;
-      unsigned long phys;
-      int phys_size;
-      phys_size = sim_d10v_translate_addr (virt, size, &phys, NULL,
-                                          dmap_register, imap_register);
-      if (phys_size == 0)
-       return xfered;
+  uint8 *memory;
+  unsigned long phys;
+  int phys_size;
+  phys_size = sim_d10v_translate_addr (virt, size, &phys, NULL,
+                                      dmap_register, imap_register);
+  if (phys_size == 0)
+    return 0;
 
-      memory = map_memory (phys);
+  memory = map_memory (phys);
 
 #ifdef DEBUG
-      if ((d10v_debug & DEBUG_INSTRUCTION) != 0)
-       {
-         (*d10v_callback->printf_filtered)
-           (d10v_callback,
-            "sim_%s %d bytes: 0x%08lx (%s) -> 0x%08lx (%s) -> 0x%08lx (%s)\n",
+  if ((d10v_debug & DEBUG_INSTRUCTION) != 0)
+    {
+      (*d10v_callback->printf_filtered)
+       (d10v_callback,
+        "sim_%s %d bytes: 0x%08lx (%s) -> 0x%08lx (%s) -> 0x%08lx (%s)\n",
             (write_p ? "write" : "read"),
-            phys_size, virt, last_from,
-            phys, last_to,
-            (long) memory, last_segname);
-       }
+        phys_size, virt, last_from,
+        phys, last_to,
+        (long) memory, last_segname);
+    }
 #endif
 
-      if (write_p)
-       {
-         memcpy (memory, buffer, phys_size);
-       }
-      else
-       {
-         memcpy (buffer, memory, phys_size);
-       }
-
-      virt += phys_size;
-      buffer += phys_size;
-      xfered += phys_size;
-      size -= phys_size;
+  if (write_p)
+    {
+      memcpy (memory, buffer, phys_size);
     }
-
-  return xfered;
+  else
+    {
+      memcpy (buffer, memory, phys_size);
+    }
+  
+  return phys_size;
 }