[ARM, sim] Fix build error and warnings
[deliverable/binutils-gdb.git] / sim / arm / wrapper.c
index b494354fcd3b2e9a82270e1f64271814f7190a7f..78a91924a94b647a0b7009b0a36c27d62e64326d 100644 (file)
@@ -1,5 +1,5 @@
 /* run front end support for arm
-   Copyright (C) 1995-2015 Free Software Foundation, Inc.
+   Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
    This file is part of ARM SIM.
 
@@ -37,6 +37,7 @@
 #include "gdb/signals.h"
 #include "libiberty.h"
 #include "iwmmxt.h"
+#include "maverick.h"
 
 /* TODO: This should get pulled from the SIM_DESC.  */
 host_callback *sim_callback;
@@ -92,45 +93,15 @@ void
 print_insn (ARMword instr)
 {
   int size;
+  disassembler_ftype disassemble_fn;
 
   opbuf[0] = 0;
   info.application_data = & instr;
-  size = print_insn_little_arm (0, & info);
+  disassemble_fn = disassembler (bfd_arch_arm, 0, 0, NULL);
+  size = disassemble_fn (0, & info);
   fprintf (stderr, " %*s\n", size, opbuf);
 }
 
-/* Cirrus DSP registers.
-
-   We need to define these registers outside of maverick.c because
-   maverick.c might not be linked in unless --target=arm9e-* in which
-   case wrapper.c will not compile because it tries to access Cirrus
-   registers.  This should all go away once we get the Cirrus and ARM
-   Coprocessor to coexist in armcopro.c-- aldyh.  */
-
-struct maverick_regs
-{
-  union
-  {
-    int i;
-    float f;
-  } upper;
-  
-  union
-  {
-    int i;
-    float f;
-  } lower;
-};
-
-union maverick_acc_regs
-{
-  long double ld;              /* Acc registers are 72-bits.  */
-};
-
-struct maverick_regs     DSPregs[16];
-union maverick_acc_regs  DSPacc[4];
-ARMword DSPsc;
-
 static void
 init (void)
 {
@@ -140,7 +111,7 @@ init (void)
     {
       ARMul_EmulateInit ();
       state = ARMul_NewState ();
-      state->bigendSig = (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN ? HIGH : LOW);
+      state->bigendSig = (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? HIGH : LOW);
       ARMul_MemoryInit (state, mem_size);
       ARMul_OSInit (state);
       state->verbose = 0;
@@ -163,14 +134,6 @@ ARMul_ConsolePrint (ARMul_State * state,
     }
 }
 
-ARMword
-ARMul_Debug (ARMul_State * state ATTRIBUTE_UNUSED,
-            ARMword       pc    ATTRIBUTE_UNUSED,
-            ARMword       instr ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
 int
 sim_write (SIM_DESC sd ATTRIBUTE_UNUSED,
           SIM_ADDR addr,
@@ -237,12 +200,12 @@ sim_resume (SIM_DESC sd ATTRIBUTE_UNUSED,
 SIM_RC
 sim_create_inferior (SIM_DESC sd ATTRIBUTE_UNUSED,
                     struct bfd * abfd,
-                    char *argv,
-                    char *env)
+                    char * const *argv,
+                    char * const *env)
 {
   int argvlen = 0;
   int mach;
-  char **arg;
+  char * const *arg;
 
   init ();
 
@@ -439,11 +402,8 @@ tomem (struct ARMul_State *state,
     }
 }
 
-int
-sim_store_register (SIM_DESC sd ATTRIBUTE_UNUSED,
-                   int rn,
-                   unsigned char *memory,
-                   int length)
+static int
+arm_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
 {
   init ();
 
@@ -547,11 +507,8 @@ sim_store_register (SIM_DESC sd ATTRIBUTE_UNUSED,
   return length;
 }
 
-int
-sim_fetch_register (SIM_DESC sd ATTRIBUTE_UNUSED,
-                   int rn,
-                   unsigned char *memory,
-                   int length)
+static int
+arm_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
 {
   ARMword regval;
   int len = length;
@@ -664,7 +621,7 @@ sim_fetch_register (SIM_DESC sd ATTRIBUTE_UNUSED,
       len -= 4;
       memory += 4;
       regval = 0;
-    }  
+    }
 
   return length;
 }
@@ -710,7 +667,7 @@ sim_target_parse_command_line (int argc, char ** argv)
          trace = 1;
          continue;
        }
-      
+
       if (strcmp (ptr, "-z") == 0)
        {
          /* Remove this option from the argv array.  */
@@ -721,7 +678,7 @@ sim_target_parse_command_line (int argc, char ** argv)
          trace_funcs = 1;
          continue;
        }
-      
+
       if (strcmp (ptr, "-d") == 0)
        {
          /* Remove this option from the argv array.  */
@@ -742,19 +699,19 @@ sim_target_parse_command_line (int argc, char ** argv)
          for (arg = i; arg < argc; arg ++)
            argv[arg] = argv[arg + 1];
          argc --;
-         
+
          ptr = argv[i];
        }
       else
        ptr += sizeof SWI_SWITCH;
 
       swi_mask = 0;
-      
+
       while (* ptr)
        {
          int i;
 
-         for (i = sizeof options / sizeof options[0]; i--;)
+         for (i = ARRAY_SIZE (options); i--;)
            if (strncmp (ptr, options[i].swi_option,
                         strlen (options[i].swi_option)) == 0)
              {
@@ -773,7 +730,7 @@ sim_target_parse_command_line (int argc, char ** argv)
 
       if (* ptr != 0)
        fprintf (stderr, "Ignoring swi options: %s\n", ptr);
-      
+
       /* Remove this option from the argv array.  */
       for (arg = i; arg < argc; arg ++)
        argv[arg] = argv[arg + 1];
@@ -786,12 +743,7 @@ sim_target_parse_command_line (int argc, char ** argv)
 static void
 sim_target_parse_arg_array (char ** argv)
 {
-  int i;
-
-  for (i = 0; argv[i]; i++)
-    ;
-
-  sim_target_parse_command_line (i, argv);
+  sim_target_parse_command_line (countargv (argv), argv);
 }
 
 static sim_cia
@@ -819,7 +771,7 @@ SIM_DESC
 sim_open (SIM_OPEN_KIND kind,
          host_callback *cb,
          struct bfd *abfd,
-         char **argv)
+         char * const *argv)
 {
   int i;
   SIM_DESC sd = sim_state_alloc (kind, cb);
@@ -838,9 +790,7 @@ sim_open (SIM_OPEN_KIND kind,
       return 0;
     }
 
-  /* getopt will print the error message so we just have to exit if this fails.
-     FIXME: Hmmm...  in the case of gdb we need getopt to call
-     print_filtered.  */
+  /* The parser will print an error message for us, so we silently return.  */
   if (sim_parse_args (sd, argv) != SIM_RC_OK)
     {
       free_state (sd);
@@ -878,6 +828,8 @@ sim_open (SIM_OPEN_KIND kind,
     {
       SIM_CPU *cpu = STATE_CPU (sd, i);
 
+      CPU_REG_FETCH (cpu) = arm_reg_fetch;
+      CPU_REG_STORE (cpu) = arm_reg_store;
       CPU_PC_FETCH (cpu) = arm_pc_get;
       CPU_PC_STORE (cpu) = arm_pc_set;
     }
@@ -907,20 +859,12 @@ sim_open (SIM_OPEN_KIND kind,
                                               "Missing argument to -m option\n");
                return NULL;
              }
-             
          }
     }
 
   return sd;
 }
 
-void
-sim_close (SIM_DESC sd ATTRIBUTE_UNUSED,
-          int quitting ATTRIBUTE_UNUSED)
-{
-  /* Nothing to do.  */
-}
-
 void
 sim_stop_reason (SIM_DESC sd ATTRIBUTE_UNUSED,
                 enum sim_stop *reason,
This page took 0.028997 seconds and 4 git commands to generate.