This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Simplify d10v memory transfers
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 22 Jun 2003 09:39:41 -0400
- Subject: [commit] Simplify d10v memory transfers
Hello,
This simplifies the d10v memory transfer code - it only attempts a
single partial transfer. Original problem reported by tom rix.
committed,
Andrew
2003-06-22 Andrew Cagney <cagney@redhat.com>
* interp.c (xfer_mem): Simplify. Only do a single partial
transfer. Problem reported by Tom Rix.
Index: interp.c
===================================================================
RCS file: /cvs/src/src/sim/d10v/interp.c,v
retrieving revision 1.14
diff -u -r1.14 interp.c
--- interp.c 7 May 2003 19:21:12 -0000 1.14
+++ interp.c 22 Jun 2003 13:37:19 -0000
@@ -720,49 +720,39 @@
int size,
int write_p)
{
- int xfered = 0;
+ 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;
- 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;
-
- 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;
}