sim: arm/cr16/d10v/h8300/microblaze/sh: fill out sim-cpu pc fetch/store helpers
This makes the common sim-cpu logic work.
This commit is contained in:
parent
0fdc66e16e
commit
27b97b40bc
13 changed files with 159 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2015-04-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* wrapper.c (arm_pc_get, arm_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.
|
||||
|
|
|
@ -800,6 +800,18 @@ sim_target_parse_arg_array (char ** argv)
|
|||
sim_target_parse_command_line (i, argv);
|
||||
}
|
||||
|
||||
static sim_cia
|
||||
arm_pc_get (sim_cpu *cpu)
|
||||
{
|
||||
return PC;
|
||||
}
|
||||
|
||||
static void
|
||||
arm_pc_set (sim_cpu *cpu, sim_cia pc)
|
||||
{
|
||||
ARMul_SetPC (state, pc);
|
||||
}
|
||||
|
||||
static void
|
||||
free_state (SIM_DESC sd)
|
||||
{
|
||||
|
@ -815,6 +827,7 @@ sim_open (SIM_OPEN_KIND kind,
|
|||
struct bfd *abfd,
|
||||
char **argv)
|
||||
{
|
||||
int i;
|
||||
SIM_DESC sd = sim_state_alloc (kind, cb);
|
||||
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
|
||||
|
||||
|
@ -866,6 +879,15 @@ sim_open (SIM_OPEN_KIND kind,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* CPU specific initialization. */
|
||||
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
|
||||
{
|
||||
SIM_CPU *cpu = STATE_CPU (sd, i);
|
||||
|
||||
CPU_PC_FETCH (cpu) = arm_pc_get;
|
||||
CPU_PC_STORE (cpu) = arm_pc_set;
|
||||
}
|
||||
|
||||
sim_callback = cb;
|
||||
|
||||
sim_target_parse_arg_array (argv);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2015-04-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (cr16_pc_get, cr16_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.
|
||||
|
|
|
@ -737,6 +737,18 @@ sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
|
|||
return xfer_mem (sd, addr, buffer, size, 0);
|
||||
}
|
||||
|
||||
static sim_cia
|
||||
cr16_pc_get (sim_cpu *cpu)
|
||||
{
|
||||
return PC;
|
||||
}
|
||||
|
||||
static void
|
||||
cr16_pc_set (sim_cpu *cpu, sim_cia pc)
|
||||
{
|
||||
SET_PC (pc);
|
||||
}
|
||||
|
||||
static void
|
||||
free_state (SIM_DESC sd)
|
||||
{
|
||||
|
@ -807,6 +819,15 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *cb, struct bfd *abfd,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* CPU specific initialization. */
|
||||
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
|
||||
{
|
||||
SIM_CPU *cpu = STATE_CPU (sd, i);
|
||||
|
||||
CPU_PC_FETCH (cpu) = cr16_pc_get;
|
||||
CPU_PC_STORE (cpu) = cr16_pc_set;
|
||||
}
|
||||
|
||||
trace_sd = sd;
|
||||
cr16_callback = cb;
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2015-04-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (d10v_pc_get, d10v_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.
|
||||
|
|
|
@ -722,6 +722,18 @@ sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
|
|||
return xfer_mem( addr, buffer, size, 0);
|
||||
}
|
||||
|
||||
static sim_cia
|
||||
d10v_pc_get (sim_cpu *cpu)
|
||||
{
|
||||
return PC;
|
||||
}
|
||||
|
||||
static void
|
||||
d10v_pc_set (sim_cpu *cpu, sim_cia pc)
|
||||
{
|
||||
SET_PC (pc);
|
||||
}
|
||||
|
||||
static void
|
||||
free_state (SIM_DESC sd)
|
||||
{
|
||||
|
@ -740,6 +752,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
|
|||
struct hash_entry *h;
|
||||
static int init_p = 0;
|
||||
char **p;
|
||||
int i;
|
||||
SIM_DESC sd = sim_state_alloc (kind, cb);
|
||||
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
|
||||
|
||||
|
@ -791,6 +804,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) = d10v_pc_get;
|
||||
CPU_PC_STORE (cpu) = d10v_pc_set;
|
||||
}
|
||||
|
||||
trace_sd = sd;
|
||||
d10v_callback = cb;
|
||||
old_segment_mapping = 0;
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2015-04-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* compile.c (h8300_pc_get, h8300_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): Define.
|
||||
|
||||
2015-04-15 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
|
||||
|
|
|
@ -4865,6 +4865,18 @@ set_h8300h (unsigned long machine)
|
|||
h8300_normal_mode = 1;
|
||||
}
|
||||
|
||||
static sim_cia
|
||||
h8300_pc_get (sim_cpu *cpu)
|
||||
{
|
||||
return cpu->pc;
|
||||
}
|
||||
|
||||
static void
|
||||
h8300_pc_set (sim_cpu *cpu, sim_cia pc)
|
||||
{
|
||||
cpu->pc = pc;
|
||||
}
|
||||
|
||||
/* Cover function of sim_state_free to free the cpu buffers as well. */
|
||||
|
||||
static void
|
||||
|
@ -4883,6 +4895,7 @@ sim_open (SIM_OPEN_KIND kind,
|
|||
struct bfd *abfd,
|
||||
char **argv)
|
||||
{
|
||||
int i;
|
||||
SIM_DESC sd;
|
||||
sim_cpu *cpu;
|
||||
|
||||
|
@ -4947,6 +4960,15 @@ sim_open (SIM_OPEN_KIND kind,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* CPU specific initialization. */
|
||||
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
|
||||
{
|
||||
SIM_CPU *cpu = STATE_CPU (sd, i);
|
||||
|
||||
CPU_PC_FETCH (cpu) = h8300_pc_get;
|
||||
CPU_PC_STORE (cpu) = h8300_pc_set;
|
||||
}
|
||||
|
||||
/* sim_hw_configure (sd); */
|
||||
|
||||
/* FIXME: Much of the code in sim_load can be moved here. */
|
||||
|
|
|
@ -91,6 +91,8 @@ enum h8_typecodes {
|
|||
/* Define sim_cia. */
|
||||
typedef unsigned32 sim_cia;
|
||||
|
||||
typedef struct _sim_cpu SIM_CPU;
|
||||
|
||||
#include "sim-base.h"
|
||||
|
||||
/* Structure used to describe addressing */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2015-04-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (microblaze_pc_get, microblaze_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.
|
||||
|
|
|
@ -633,6 +633,18 @@ sim_info (SIM_DESC sd, int verbose)
|
|||
(CPU.cycles) ? CPU.cycles+2 : 0);
|
||||
}
|
||||
|
||||
static sim_cia
|
||||
microblaze_pc_get (sim_cpu *cpu)
|
||||
{
|
||||
return cpu->microblaze_cpu.spregs[0];
|
||||
}
|
||||
|
||||
static void
|
||||
microblaze_pc_set (sim_cpu *cpu, sim_cia pc)
|
||||
{
|
||||
cpu->microblaze_cpu.spregs[0] = pc;
|
||||
}
|
||||
|
||||
static void
|
||||
free_state (SIM_DESC sd)
|
||||
{
|
||||
|
@ -706,6 +718,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
|
|||
SIM_CPU *cpu = STATE_CPU (sd, i);
|
||||
int osize = sim_memory_size;
|
||||
|
||||
CPU_PC_FETCH (cpu) = microblaze_pc_get;
|
||||
CPU_PC_STORE (cpu) = microblaze_pc_set;
|
||||
|
||||
set_initial_gprs (cpu);
|
||||
|
||||
/* Discard and reacquire memory -- start with a clean slate. */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2015-04-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sh_pc_get, sh_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.
|
||||
|
|
|
@ -2373,6 +2373,18 @@ sim_info (SIM_DESC sd, int verbose)
|
|||
}
|
||||
}
|
||||
|
||||
static sim_cia
|
||||
sh_pc_get (sim_cpu *cpu)
|
||||
{
|
||||
return saved_state.asregs.pc;
|
||||
}
|
||||
|
||||
static void
|
||||
sh_pc_set (sim_cpu *cpu, sim_cia pc)
|
||||
{
|
||||
saved_state.asregs.pc = pc;
|
||||
}
|
||||
|
||||
static void
|
||||
free_state (SIM_DESC sd)
|
||||
{
|
||||
|
@ -2448,6 +2460,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) = sh_pc_get;
|
||||
CPU_PC_STORE (cpu) = sh_pc_set;
|
||||
}
|
||||
|
||||
for (p = argv + 1; *p != NULL; ++p)
|
||||
{
|
||||
if (isdigit (**p))
|
||||
|
|
Loading…
Reference in a new issue