+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (sim_store_register): Rename to ...
+ (arm_reg_store): ... this.
+ (sim_fetch_register): Rename to ...
+ (arm_reg_fetch): ... this.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.
}
}
-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 ();
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;
{
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;
}
+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (d10v_reg_store, d10v_reg_fetch): Define.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+ (sim_store_register): Rename to ...
+ (d10v_reg_store): ... this. Rename cpu to sd.
+ (sim_fetch_register): Rename to ...
+ (d10v_reg_fetch): ... this. Rename cpu to sd.
+
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.
sim_state_free (sd);
}
+static int d10v_reg_fetch (SIM_CPU *, int, unsigned char *, int);
+static int d10v_reg_store (SIM_CPU *, int, unsigned char *, int);
+
SIM_DESC
sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
{
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+ CPU_REG_FETCH (cpu) = d10v_reg_fetch;
+ CPU_REG_STORE (cpu) = d10v_reg_store;
CPU_PC_FETCH (cpu) = d10v_pc_get;
CPU_PC_STORE (cpu) = d10v_pc_set;
}
return SIM_RC_OK;
}
-int
-sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+d10v_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
- SIM_CPU *cpu = STATE_CPU (sd, 0);
+ SIM_DESC sd = CPU_STATE (cpu);
int size;
switch ((enum sim_d10v_regs) rn)
{
return size;
}
-int
-sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+d10v_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
- SIM_CPU *cpu = STATE_CPU (sd, 0);
+ SIM_DESC sd = CPU_STATE (cpu);
int size;
switch ((enum sim_d10v_regs) rn)
{
+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (sim_store_register): Rename to ...
+ (h8300_reg_store): ... this. Declare sd.
+ (sim_fetch_register): Rename to ...
+ (h8300_reg_fetch): ... this. Declare sd.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+
2015-12-30 Mike Frysinger <vapier@gentoo.org>
* compile.c (lreg): Delete.
return size;
}
-
-int
-sim_store_register (SIM_DESC sd, int rn, unsigned char *value, int length)
+static int
+h8300_reg_store (SIM_CPU *cpu, int rn, unsigned char *value, int length)
{
+ SIM_DESC sd = CPU_STATE (cpu);
int longval;
int shortval;
int intval;
return length;
}
-int
-sim_fetch_register (SIM_DESC sd, int rn, unsigned char *buf, int length)
+static int
+h8300_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *buf, int length)
{
+ SIM_DESC sd = CPU_STATE (cpu);
int v;
int longreg = 0;
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+ CPU_REG_FETCH (cpu) = h8300_reg_fetch;
+ CPU_REG_STORE (cpu) = h8300_reg_store;
CPU_PC_FETCH (cpu) = h8300_pc_get;
CPU_PC_STORE (cpu) = h8300_pc_set;
}
+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (m68hc11_reg_store, m68hc11_reg_fetch): Define.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+ (sim_store_register): Rename to ...
+ (m68hc11_reg_store): ... this. Delete local cpu var.
+ (sim_fetch_register): Rename to ...
+ (m68hc11_reg_fetch): ... this. Delete local cpu var.
+
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.
cpu_set_pc (cpu, pc);
}
+static int m68hc11_reg_fetch (SIM_CPU *, int, unsigned char *, int);
+static int m68hc11_reg_store (SIM_CPU *, int, unsigned char *, int);
+
SIM_DESC
sim_open (SIM_OPEN_KIND kind, host_callback *callback,
bfd *abfd, char **argv)
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+ CPU_REG_FETCH (cpu) = m68hc11_reg_fetch;
+ CPU_REG_STORE (cpu) = m68hc11_reg_store;
CPU_PC_FETCH (cpu) = m68hc11_pc_get;
CPU_PC_STORE (cpu) = m68hc11_pc_set;
}
return sim_prepare_for_program (sd, abfd);
}
-int
-sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+m68hc11_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
- sim_cpu *cpu;
uint16 val;
int size = 2;
- cpu = STATE_CPU (sd, 0);
switch (rn)
{
case A_REGNUM:
return size;
}
-int
-sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+m68hc11_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
uint16 val;
- sim_cpu *cpu;
-
- cpu = STATE_CPU (sd, 0);
val = *memory++;
if (length == 2)
+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (sim_store_register): Rename to ...
+ (microblaze_reg_store): ... this. Delete local cpu var.
+ (sim_fetch_register): Rename to ...
+ (microblaze_reg_fetch): ... this. Delete local cpu var.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.
CPU.cycles += memops; /* and memop cycle delays */
}
-int
-sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+microblaze_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
- SIM_CPU *cpu = STATE_CPU (sd, 0);
-
if (rn < NUM_REGS + NUM_SPECIAL && rn >= 0)
{
if (length == 4)
return 0;
}
-int
-sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+microblaze_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
- SIM_CPU *cpu = STATE_CPU (sd, 0);
long ival;
if (rn < NUM_REGS + NUM_SPECIAL && rn >= 0)
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+ CPU_REG_FETCH (cpu) = microblaze_reg_fetch;
+ CPU_REG_STORE (cpu) = microblaze_reg_store;
CPU_PC_FETCH (cpu) = microblaze_pc_get;
CPU_PC_STORE (cpu) = microblaze_pc_set;
+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (mips_reg_store, mips_reg_fetch): Define.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+ (sim_store_register): Rename to ...
+ (mips_reg_store): ... this. Delete local cpu var.
+ Update sim_io_eprintf calls.
+ (sim_fetch_register): Rename to ...
+ (mips_reg_fetch): ... this. Delete local cpu var.
+ Update sim_io_eprintf calls.
+
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.
PC = pc;
}
+static int mips_reg_fetch (SIM_CPU *, int, unsigned char *, int);
+static int mips_reg_store (SIM_CPU *, int, unsigned char *, int);
+
SIM_DESC
sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
{
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+ CPU_REG_FETCH (cpu) = mips_reg_fetch;
+ CPU_REG_STORE (cpu) = mips_reg_store;
CPU_PC_FETCH (cpu) = mips_pc_get;
CPU_PC_STORE (cpu) = mips_pc_set;
}
#endif
}
-int
-sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+mips_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
- sim_cpu *cpu = STATE_CPU (sd, 0); /* FIXME */
/* NOTE: gdb (the client) stores registers in target byte order
while the simulator uses host byte order */
-#ifdef DEBUG
- sim_io_printf(sd,"sim_store_register(%d,*memory=0x%s);\n",rn,pr_addr(*((SIM_ADDR *)memory)));
-#endif /* DEBUG */
/* Unfortunately this suffers from the same problem as the register
numbering one. We need to know what the width of each logical
if (cpu->register_widths[rn] == 0)
{
- sim_io_eprintf(sd,"Invalid register width for %d (register store ignored)\n",rn);
+ sim_io_eprintf (CPU_STATE (cpu), "Invalid register width for %d (register store ignored)\n", rn);
return 0;
}
-
-
if (rn >= FGR_BASE && rn < FGR_BASE + NR_FGR)
{
cpu->fpr_state[rn - FGR_BASE] = fmt_uninterpreted;
return 0;
}
-int
-sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+mips_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
- sim_cpu *cpu = STATE_CPU (sd, 0); /* FIXME */
/* NOTE: gdb (the client) stores registers in target byte order
while the simulator uses host byte order */
-#ifdef DEBUG
-#if 0 /* FIXME: doesn't compile */
- sim_io_printf(sd,"sim_fetch_register(%d=0x%s,mem) : place simulator registers into memory\n",rn,pr_addr(registers[rn]));
-#endif
-#endif /* DEBUG */
if (cpu->register_widths[rn] == 0)
{
- sim_io_eprintf (sd, "Invalid register width for %d (register fetch ignored)\n",rn);
+ sim_io_eprintf (CPU_STATE (cpu), "Invalid register width for %d (register fetch ignored)\n", rn);
return 0;
}
-
-
/* Any floating point register */
if (rn >= FGR_BASE && rn < FGR_BASE + NR_FGR)
{
+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (mn10300_reg_store, mn10300_reg_fetch): Define.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+ (sim_store_register): Rename to ...
+ (mn10300_reg_store): ... this.
+ (sim_fetch_register): Rename to ...
+ (mn10300_reg_fetch): ... this.
+
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (MN10300_OBJS): Delete sim-hload.o.
PC = pc;
}
+static int mn10300_reg_fetch (SIM_CPU *, int, unsigned char *, int);
+static int mn10300_reg_store (SIM_CPU *, int, unsigned char *, int);
+
/* These default values correspond to expected usage for the chip. */
SIM_DESC
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+ CPU_REG_FETCH (cpu) = mn10300_reg_fetch;
+ CPU_REG_STORE (cpu) = mn10300_reg_store;
CPU_PC_FETCH (cpu) = mn10300_pc_get;
CPU_PC_STORE (cpu) = mn10300_pc_set;
}
/* FIXME These would more efficient to use than load_mem/store_mem,
but need to be changed to use the memory map. */
-int
-sim_fetch_register (SIM_DESC sd,
- int rn,
- unsigned char *memory,
- int length)
+static int
+mn10300_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
reg_t reg = State.regs[rn];
uint8 *a = memory;
return length;
}
-int
-sim_store_register (SIM_DESC sd,
- int rn,
- unsigned char *memory,
- int length)
+static int
+mn10300_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
uint8 *a = memory;
State.regs[rn] = (a[3] << 24) + (a[2] << 16) + (a[1] << 8) + a[0];
+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (sim_store_register): Rename to ...
+ (moxie_reg_store): ... this.
+ (sim_fetch_register): Rename to ...
+ (moxie_reg_fetch): ... this.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.
} while (1);
}
-int
-sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+moxie_reg_store (SIM_CPU *scpu, int rn, unsigned char *memory, int length)
{
if (rn < NUM_MOXIE_REGS && rn >= 0)
{
return 0;
}
-int
-sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+moxie_reg_fetch (SIM_CPU *scpu, int rn, unsigned char *memory, int length)
{
if (rn < NUM_MOXIE_REGS && rn >= 0)
{
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+ CPU_REG_FETCH (cpu) = moxie_reg_fetch;
+ CPU_REG_STORE (cpu) = moxie_reg_store;
CPU_PC_FETCH (cpu) = moxie_pc_get;
CPU_PC_STORE (cpu) = moxie_pc_set;
+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (sim_store_register): Rename to ...
+ (sh_reg_store): ... this.
+ (sim_fetch_register): Rename to ...
+ (sh_reg_fetch): ... this.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.
REGBANK_MACL = 19
};
-int
-sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+sh_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
unsigned val;
return length;
}
-int
-sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+sh_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
int val;
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+ CPU_REG_FETCH (cpu) = sh_reg_fetch;
+ CPU_REG_STORE (cpu) = sh_reg_store;
CPU_PC_FETCH (cpu) = sh_pc_get;
CPU_PC_STORE (cpu) = sh_pc_set;
}
+2015-12-30 Mike Frysinger <vapier@gentoo.org>
+
+ * wrapper.c (v850_reg_store, v850_reg_fetch): Define.
+ (sim_open): Call CPU_REG_FETCH/CPU_REG_STORE.
+ (sim_store_register): Rename to ...
+ (v850_reg_store): ... this.
+ (sim_fetch_register): Rename to ...
+ (v850_reg_fetch): ... this.
+
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.
PC = pc;
}
+static int v850_reg_fetch (SIM_CPU *, int, unsigned char *, int);
+static int v850_reg_store (SIM_CPU *, int, unsigned char *, int);
+
SIM_DESC
sim_open (SIM_OPEN_KIND kind,
host_callback * cb,
{
SIM_CPU *cpu = STATE_CPU (sd, i);
+ CPU_REG_FETCH (cpu) = v850_reg_fetch;
+ CPU_REG_STORE (cpu) = v850_reg_store;
CPU_PC_FETCH (cpu) = v850_pc_get;
CPU_PC_STORE (cpu) = v850_pc_set;
}
return SIM_RC_OK;
}
-int
-sim_fetch_register (SIM_DESC sd,
- int rn,
- unsigned char * memory,
- int length)
+static int
+v850_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
*(unsigned32*)memory = H2T_4 (State.regs[rn]);
return -1;
}
-
-int
-sim_store_register (SIM_DESC sd,
- int rn,
- unsigned char * memory,
- int length)
+
+static int
+v850_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
State.regs[rn] = T2H_4 (*(unsigned32 *) memory);
return length;