summaryrefslogtreecommitdiff
path: root/gdb/remote-bug.c
diff options
context:
space:
mode:
authorJ.T. Conklin <jtc@redback.com>2000-06-19 18:59:07 +0000
committerJ.T. Conklin <jtc@redback.com>2000-06-19 18:59:07 +0000
commit5661361b085034fd8bafca7d18189b9318a54116 (patch)
treef0ab191e82f43ffac71a2131a5761e916286322f /gdb/remote-bug.c
parentb90de66bd1c979f5f0712619bd8e1b1439c5f575 (diff)
downloadgdb-5661361b085034fd8bafca7d18189b9318a54116.tar.gz
* remote-nindy.c (nindy_fetch_word, nindy_store_word): Removed
(nindy_xfer_inferior_memory): Use dcache_xfer_memory() instead of breaking transfer into chunks and using nindy_fetch_word() and nindy_store_word(). * remote-bug.c (bug_xfer_memory): Use dcache_xfer_memory() instead of breaking transfer into chunks and using gr_fetch_word() and gr_store_word(). * remote.c (remote_fetch_word, remote_store_word): Removed. * remote-utils.h (gr_fetch_word, gr_store_word): Removed. * remote-utils.c (gr_fetch_word, gr_store_word): Removed. * dcache.h (dcache_fetch, dcache_poke, dcache_poke_block): Removed. * dcache.c (dcache_fetch, dcache_poke): Removed.
Diffstat (limited to 'gdb/remote-bug.c')
-rw-r--r--gdb/remote-bug.c71
1 files changed, 3 insertions, 68 deletions
diff --git a/gdb/remote-bug.c b/gdb/remote-bug.c
index 6c331a124db..e3a5a6778bc 100644
--- a/gdb/remote-bug.c
+++ b/gdb/remote-bug.c
@@ -575,75 +575,10 @@ bug_xfer_memory (memaddr, myaddr, len, write, target)
int write;
struct target_ops *target; /* ignored */
{
- register int i;
+ if (len <= 0)
+ return 0;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr;
-
- /* Round ending address up; get number of longwords that makes. */
- register int count;
-
- /* Allocate buffer of that many longwords. */
- register int *buffer;
-
- addr = memaddr & -sizeof (int);
- count = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-
- buffer = (int *) alloca (count * sizeof (int));
-
- if (write)
- {
- /* Fill start and end extra bytes of buffer with existing memory data. */
-
- if (addr != memaddr || len < (int) sizeof (int))
- {
- /* Need part of initial word -- fetch it. */
- buffer[0] = gr_fetch_word (addr);
- }
-
- if (count > 1) /* FIXME, avoid if even boundary */
- {
- buffer[count - 1]
- = gr_fetch_word (addr + (count - 1) * sizeof (int));
- }
-
- /* Copy data to be written over corresponding part of buffer */
-
- memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
- /* Write the entire buffer. */
-
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- gr_store_word (addr, buffer[i]);
- if (errno)
- {
-
- return 0;
- }
-
- }
- }
- else
- {
- /* Read all the longwords */
- for (i = 0; i < count; i++, addr += sizeof (int))
- {
- errno = 0;
- buffer[i] = gr_fetch_word (addr);
- if (errno)
- {
- return 0;
- }
- QUIT;
- }
-
- /* Copy appropriate bytes out of the buffer. */
- memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
- }
-
- return len;
+ return dcache_xfer_memory (gr_get_dcache (), memaddr, myaddr, len, write);
}
static void