This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / gdb / remote-nindy.c
index 9a25986773effa8e7bfe46c4df4de55ae4d87f65..fb8b5e29fa1f0ae2a8c8b0bc2e86552a4bd81993 100644 (file)
 #include "command.h"
 #include "floatformat.h"
 
-#include "wait.h"
+#include "gdb_wait.h"
 #include <sys/file.h>
 #include <ctype.h>
 #include "serial.h"
@@ -151,11 +151,9 @@ static int regs_changed = 0;       /* 1 iff regs were modified since last read */
 
 extern char *exists ();
 
-static void
-nindy_fetch_registers PARAMS ((int));
+static void nindy_fetch_registers (int);
 
-static void
-nindy_store_registers PARAMS ((int));
+static void nindy_store_registers (int);
 \f
 static char *savename;
 
@@ -489,34 +487,9 @@ nindy_store_registers (regno)
   immediate_quit--;
 }
 
-/* Read a word from remote address ADDR and return it.
- * This goes through the data cache.
- */
-int
-nindy_fetch_word (addr)
-     CORE_ADDR addr;
-{
-  return dcache_fetch (nindy_dcache, addr);
-}
-
-/* Write a word WORD into remote address ADDR.
-   This goes through the data cache.  */
-
-void
-nindy_store_word (addr, word)
-     CORE_ADDR addr;
-     int word;
-{
-  dcache_poke (nindy_dcache, addr, word);
-}
-
 /* Copy LEN bytes to or from inferior's memory starting at MEMADDR
    to debugger memory starting at MYADDR.   Copy to inferior if
-   WRITE is nonzero.  Returns the length copied.
-
-   This is stolen almost directly from infptrace.c's child_xfer_memory,
-   which also deals with a word-oriented memory interface.  Sometime,
-   FIXME, rewrite this to not use the word-oriented routines.  */
+   SHOULD_WRITE is nonzero.  Returns the length copied. */
 
 int
 nindy_xfer_inferior_memory (memaddr, myaddr, len, should_write, target)
@@ -526,61 +499,10 @@ nindy_xfer_inferior_memory (memaddr, myaddr, len, should_write, target)
      int should_write;
      struct target_ops *target;        /* ignored */
 {
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
-
-  if (should_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] = nindy_fetch_word (addr);
-       }
-
-      if (count > 1)           /* FIXME, avoid if even boundary */
-       {
-         buffer[count - 1]
-           = nindy_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;
-         nindy_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] = nindy_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;
+  if (len <= 0)
+    return 0;
+  return dcache_xfer_memory (nindy_dcache, memaddr, myaddr, 
+                            len, should_write);
 }
 \f
 static void
This page took 0.028641 seconds and 4 git commands to generate.