]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/m68hc11/interp.c
sim: m68hc11/mn10300/v850: delete redundant INLINE defines
[thirdparty/binutils-gdb.git] / sim / m68hc11 / interp.c
index d0752dc1a5e5a0f5c5c01661485d315a37c76a0e..e9f3aab6857b1ed91ad9499730d099f1aa123fa0 100644 (file)
@@ -1,6 +1,5 @@
 /* interp.c -- Simulator for Motorola 68HC11/68HC12
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008
-   Free Software Foundation, Inc.
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
    Written by Stephane Carrez (stcarrez@nerim.fr)
 
 This file is part of GDB, the GNU debugger.
@@ -42,14 +41,6 @@ char *interrupt_names[] = {
   NULL
 };
 
-#ifndef INLINE
-#if defined(__GNUC__) && defined(__OPTIMIZE__)
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-#endif
-
 struct sim_info_list
 {
   const char *name;
@@ -418,18 +409,39 @@ sim_prepare_for_program (SIM_DESC sd, bfd* abfd)
   return SIM_RC_OK;
 }
 
+static sim_cia
+m68hc11_pc_get (sim_cpu *cpu)
+{
+  return cpu_get_pc (cpu);
+}
+
+static void
+m68hc11_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+  cpu_set_pc (cpu, pc);
+}
+
 SIM_DESC
 sim_open (SIM_OPEN_KIND kind, host_callback *callback,
           bfd *abfd, char **argv)
 {
+  int i;
   SIM_DESC sd;
   sim_cpu *cpu;
 
   sd = sim_state_alloc (kind, callback);
-  cpu = STATE_CPU (sd, 0);
 
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* The cpu data is kept in a separately allocated chunk of memory.  */
+  if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK)
+    {
+      free_state (sd);
+      return 0;
+    }
+
+  cpu = STATE_CPU (sd, 0);
+
   /* for compatibility */
   current_alignment = NONSTRICT_ALIGNMENT;
   current_target_byte_order = BIG_ENDIAN;
@@ -483,7 +495,15 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
       return 0;
     }      
 
-  /* Fudge our descriptor.  */
+  /* CPU specific initialization.  */
+  for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+    {
+      SIM_CPU *cpu = STATE_CPU (sd, i);
+
+      CPU_PC_FETCH (cpu) = m68hc11_pc_get;
+      CPU_PC_STORE (cpu) = m68hc11_pc_set;
+    }
+
   return sd;
 }
 
@@ -503,16 +523,6 @@ sim_close (SIM_DESC sd, int quitting)
   return;
 }
 
-void
-sim_set_profile (int n)
-{
-}
-
-void
-sim_set_profile_size (int n)
-{
-}
-
 /* Generic implementation of sim_engine_run that works within the
    sim_engine setjmp/longjmp framework. */
 
@@ -538,13 +548,6 @@ sim_engine_run (SIM_DESC sd,
     }
 }
 
-int
-sim_trace (SIM_DESC sd)
-{
-  sim_resume (sd, 0, 0);
-  return 1;
-}
-
 void
 sim_info (SIM_DESC sd, int verbose)
 {
@@ -574,14 +577,6 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
   return sim_prepare_for_program (sd, abfd);
 }
 
-
-void
-sim_set_callbacks (host_callback *p)
-{
-  /*  m6811_callback = p; */
-}
-
-
 int
 sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
 {
@@ -705,39 +700,6 @@ sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
   return 2;
 }
 
-void
-sim_size (int s)
-{
-  ;
-}
-
-void
-sim_do_command (SIM_DESC sd, char *cmd)
-{
-  char *mm_cmd = "memory-map";
-  char *int_cmd = "interrupt";
-  sim_cpu *cpu;
-
-  cpu = STATE_CPU (sd, 0);
-  /* Commands available from GDB:   */
-  if (sim_args_command (sd, cmd) != SIM_RC_OK)
-    {
-      if (strncmp (cmd, "info", sizeof ("info") - 1) == 0)
-       sim_get_info (sd, &cmd[4]);
-      else if (strncmp (cmd, mm_cmd, strlen (mm_cmd) == 0))
-       sim_io_eprintf (sd,
-                       "`memory-map' command replaced by `sim memory'\n");
-      else if (strncmp (cmd, int_cmd, strlen (int_cmd)) == 0)
-       sim_io_eprintf (sd, "`interrupt' command replaced by `sim watch'\n");
-      else
-       sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
-    }
-
-  /* If the architecture changed, re-configure.  */
-  if (STATE_ARCHITECTURE (sd) != cpu->cpu_configured_arch)
-    sim_hw_configure (sd);
-}
-
 /* Halt the simulator after just one instruction */
 
 static void