20000-05-18 H.J. Lu (hjl@gnu.org)
[binutils-gdb.git] / gdb / arc-tdep.c
index 6e0cf8dc2aefe6c02bd0add5e1dacbf8c738a7a7..2a1f0006702d422bfea46ec3441701ceeed90fcf 100644 (file)
 #include "symtab.h"
 #include "gdbcmd.h"
 
+/* Local functions */
+
+static int arc_set_cpu_type (char *str);
+
 /* Current CPU, set with the "set cpu" command.  */
 static int arc_bfd_mach_type;
 char *arc_cpu_type;
@@ -93,6 +97,7 @@ static unsigned int codestream_fill PARAMS ((int));
 #define CODESTREAM_BUFSIZ 16
 static CORE_ADDR codestream_next_addr;
 static CORE_ADDR codestream_addr;
+/* FIXME assumes sizeof (int) == 32? */
 static unsigned int codestream_buf[CODESTREAM_BUFSIZ];
 static int codestream_off;
 static int codestream_cnt;
@@ -120,16 +125,15 @@ codestream_fill (peek_flag)
               CODESTREAM_BUFSIZ * sizeof (codestream_buf[0]));
   /* FIXME: check return code?  */
 
-  /* Handle byte order differences.  */
-  if (HOST_BYTE_ORDER != TARGET_BYTE_ORDER)
-    {
-      register unsigned int i, j, n = sizeof (codestream_buf[0]);
-      register char tmp, *p;
-      for (i = 0, p = (char *) codestream_buf; i < CODESTREAM_BUFSIZ;
-          ++i, p += n)
-       for (j = 0; j < n / 2; ++j)
-         tmp = p[j], p[j] = p[n - 1 - j], p[n - 1 - j] = tmp;
-    }
+
+  /* Handle byte order differences -> convert to host byte ordering.  */
+  {
+    int i;
+    for (i = 0; i < CODESTREAM_BUFSIZ; i++)
+      codestream_buf[i] =
+       extract_unsigned_integer (&codestream_buf[i],
+                                 sizeof (codestream_buf[i]));
+  }
 
   if (peek_flag)
     return codestream_peek ();
@@ -404,7 +408,7 @@ frame_find_saved_regs (fip, fsrp)
 }
 
 void
-push_dummy_frame ()
+arc_push_dummy_frame (void)
 {
   CORE_ADDR sp = read_register (SP_REGNUM);
   int regnum;
@@ -425,7 +429,7 @@ push_dummy_frame ()
 }
 
 void
-pop_frame ()
+arc_pop_frame (void)
 {
   struct frame_info *frame = get_current_frame ();
   CORE_ADDR fp;
@@ -641,9 +645,7 @@ arc_print_insn (vma, info)
 /* Command to set cpu type.  */
 
 void
-arc_set_cpu_type_command (args, from_tty)
-     char *args;
-     int from_tty;
+arc_set_cpu_type_command (char *args, int from_tty)
 {
   int i;
 
@@ -677,7 +679,7 @@ arc_show_cpu_type_command (args, from_tty)
 /* Modify the actual cpu type.
    Result is a boolean indicating success.  */
 
-int
+static int
 arc_set_cpu_type (str)
      char *str;
 {