This makes the common sim-cpu logic work.
+2015-04-16 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (avr_pc_get, avr_pc_set): New functions.
+ (sim_open): Declare new local var i. Call CPU_PC_FETCH &
+ CPU_PC_STORE for all cpus.
+
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
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)
{
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);
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));
+2015-04-16 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (mcore_pc_get, mcore_pc_set): New functions.
+ (sim_open): Call CPU_PC_FETCH & CPU_PC_STORE for all cpus.
+
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
#endif
}
+static sim_cia
+mcore_pc_get (sim_cpu *cpu)
+{
+ return cpu->pc;
+}
+
+static void
+mcore_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+ cpu->pc = pc;
+}
+
static void
free_state (SIM_DESC sd)
{
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+
+ CPU_PC_FETCH (cpu) = mcore_pc_get;
+ CPU_PC_STORE (cpu) = mcore_pc_set;
+
set_initial_gprs (cpu); /* Reset the GPR registers. */
}
+2015-04-16 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (moxie_pc_get, moxie_pc_set): New functions.
+ (sim_open): Declare new local var i. Call CPU_PC_FETCH &
+ CPU_PC_STORE for all cpus.
+ * sim-main.h (SIM_CPU): New typedef.
+
2015-04-15 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
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)
{
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);
}
/* 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;
}
typedef address_word sim_cia;
+typedef struct _sim_cpu SIM_CPU;
+
#include "sim-base.h"
#include "bfd.h"