]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/avr/interp.c
sim: avr/mcore/moxie: fill out sim-cpu pc fetch/store helpers
[thirdparty/binutils-gdb.git] / sim / avr / interp.c
index d16993598bc60d85f8247a684c0f18c06e757a83..a6588d3de4fc2b93979572ed583cf80ec164ee7a 100644 (file)
@@ -1663,6 +1663,18 @@ sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
   return 0;
 }
 
+static sim_cia
+avr_pc_get (sim_cpu *cpu)
+{
+  return pc;
+}
+
+static void
+avr_pc_set (sim_cpu *cpu, sim_cia _pc)
+{
+  pc = _pc;
+}
+
 static void
 free_state (SIM_DESC sd)
 {
@@ -1675,6 +1687,7 @@ free_state (SIM_DESC sd)
 SIM_DESC
 sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
 {
+  int i;
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
@@ -1729,6 +1742,15 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
       return 0;
     }
 
+  /* CPU specific initialization.  */
+  for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+    {
+      SIM_CPU *cpu = STATE_CPU (sd, i);
+
+      CPU_PC_FETCH (cpu) = avr_pc_get;
+      CPU_PC_STORE (cpu) = avr_pc_set;
+    }
+
   /* Clear all the memory.  */
   memset (sram, 0, sizeof (sram));
   memset (flash, 0, sizeof (flash));