]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/moxie/interp.c
sim: avr/mcore/moxie: fill out sim-cpu pc fetch/store helpers
[thirdparty/binutils-gdb.git] / sim / moxie / interp.c
index 428a9d5f5090b6d6ea87ae699d30ebf1d9596794..fce6d81787934b89686a223e172d0f3fd7c3cc48 100644 (file)
@@ -1145,6 +1145,18 @@ sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
     return 0;
 }
 
+static sim_cia
+moxie_pc_get (sim_cpu *cpu)
+{
+  return cpu->registers[PCIDX];
+}
+
+static void
+moxie_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+  cpu->registers[PCIDX] = pc;
+}
+
 static void
 free_state (SIM_DESC sd)
 {
@@ -1157,6 +1169,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);
 
@@ -1215,7 +1228,15 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
     }
 
   /* CPU specific initialization.  */
-  set_initial_gprs ();
+  for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+    {
+      SIM_CPU *cpu = STATE_CPU (sd, i);
+
+      CPU_PC_FETCH (cpu) = moxie_pc_get;
+      CPU_PC_STORE (cpu) = moxie_pc_set;
+
+      set_initial_gprs ();     /* Reset the GPR registers.  */
+    }
 
   return sd;
 }