memory transfers, fall back to the old memory xfer functions.  */
 
 static LONGEST
-child_xfer_partial (struct target_ops *ops,
-                   enum target_object object,
-                   const char *annex, const void *writebuf,
-                   void *readbuf, ULONGEST offset, LONGEST len)
+child_xfer_partial (struct target_ops *ops, enum target_object object,
+                   const char *annex, void *readbuf,
+                   const void *writebuf, ULONGEST offset, LONGEST len)
 {
   switch (object)
     {
 #ifndef NATIVE_XFER_UNWIND_TABLE
 #define NATIVE_XFER_UNWIND_TABLE(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1)
 #endif
-      return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, writebuf,
-                                      readbuf, offset, len);
+      return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, readbuf, writebuf,
+                                      offset, len);
 #endif
 
 #if 0
     case TARGET_OBJECT_AUXV:
-      return native_xfer_auxv (PIDGET (inferior_ptid), writebuf, readbuf,
+      return native_xfer_auxv (PIDGET (inferior_ptid), readbuf, writebuf,
                               offset, len);
 #endif
 
 
 
 static LONGEST default_xfer_partial (struct target_ops *ops,
                                     enum target_object object,
-                                    const char *annex, const void *writebuf,
-                                    void *readbuf, ULONGEST offset,
-                                    LONGEST len);
+                                    const char *annex, void *readbuf,
+                                    const void *writebuf,
+                                    ULONGEST offset, LONGEST len);
 
 /* Transfer LEN bytes between target address MEMADDR and GDB address
    MYADDR.  Returns 0 for success, errno code for failure (which
 /* More generic transfers.  */
 
 static LONGEST
-default_xfer_partial (struct target_ops *ops,
-                     enum target_object object,
-                     const char *annex, const void *writebuf,
-                     void *readbuf, ULONGEST offset, LONGEST len)
+default_xfer_partial (struct target_ops *ops, enum target_object object,
+                     const char *annex, void *readbuf, 
+                     const void *writebuf, ULONGEST offset, LONGEST len)
 {
   if (object == TARGET_OBJECT_MEMORY
       && ops->to_xfer_memory != NULL)
     }
   else if (ops->beneath != NULL)
     return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
-                                         writebuf, readbuf, offset, len);
+                                         readbuf, writebuf, offset, len);
   else
     return -1;
 }
                     ULONGEST offset, LONGEST len)
 {
   gdb_assert (ops->to_xfer_partial != NULL);
-  return ops->to_xfer_partial (ops, object, annex, NULL, buf, offset, len);
+  return ops->to_xfer_partial (ops, object, annex, buf, NULL, offset, len);
 }
 
 LONGEST
                      ULONGEST offset, LONGEST len)
 {
   gdb_assert (ops->to_xfer_partial != NULL);
-  return ops->to_xfer_partial (ops, object, annex, buf, NULL, offset, len);
+  return ops->to_xfer_partial (ops, object, annex, NULL, buf, offset, len);
 }
 
 /* Wrappers to perform the full transfer.  */
 }
 
 static LONGEST
-debug_to_xfer_partial (struct target_ops *ops,
-                      enum target_object object,
-                      const char *annex, const void *writebuf,
-                      void *readbuf, ULONGEST offset, LONGEST len)
+debug_to_xfer_partial (struct target_ops *ops, enum target_object object,
+                      const char *annex, void *readbuf, const void *writebuf,
+                      ULONGEST offset, LONGEST len)
 {
   LONGEST retval;
 
   retval = debug_target.to_xfer_partial (&debug_target, object, annex,
-                                        writebuf, readbuf, offset, len);
+                                        readbuf, writebuf, offset, len);
 
   fprintf_unfiltered (gdb_stdlog,
                      "target_xfer_partial (%d, %s, 0x%lx,  0x%lx,  0x%s, %s) = %s\n",
                      (int) object, (annex ? annex : "(null)"),
-                     (long) writebuf, (long) readbuf, paddr_nz (offset),
+                     (long) readbuf, (long) writebuf, paddr_nz (offset),
                      paddr_d (len), paddr_d (retval));
 
   return retval;