diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-04-13 02:11:24 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-04-13 02:11:50 -0400 |
commit | 14c9ad2edb6e0bb0b560fa45699b83d85aa28b94 (patch) | |
tree | 183183d1bc008d9da91182db3ced6f320f583716 /sim/v850/interp.c | |
parent | 7bebb329bbad32b948939c5f437b2b4eebe7e9fd (diff) | |
download | gdb-14c9ad2edb6e0bb0b560fa45699b83d85aa28b94.zip gdb-14c9ad2edb6e0bb0b560fa45699b83d85aa28b94.tar.gz gdb-14c9ad2edb6e0bb0b560fa45699b83d85aa28b94.tar.bz2 |
sim: v850: convert to sim-cpu
Make cpu allocation fully dynamic so we can leverage the common
sim-cpu and its APIs.
Diffstat (limited to 'sim/v850/interp.c')
-rw-r--r-- | sim/v850/interp.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/sim/v850/interp.c b/sim/v850/interp.c index 04f3f2f..36da132 100644 --- a/sim/v850/interp.c +++ b/sim/v850/interp.c @@ -184,6 +184,17 @@ get_insn_name (sim_cpu *cpu, int i) uint32 OP[4]; +static sim_cia +v850_pc_get (sim_cpu *cpu) +{ + return PC; +} + +static void +v850_pc_set (sim_cpu *cpu, sim_cia pc) +{ + PC = pc; +} SIM_DESC sim_open (SIM_OPEN_KIND kind, @@ -191,11 +202,16 @@ sim_open (SIM_OPEN_KIND kind, struct bfd * abfd, char ** argv) { + int i; SIM_DESC sd = sim_state_alloc (kind, cb); int mach; SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); + /* The cpu data is kept in a separately allocated chunk of memory. */ + if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + return 0; + /* for compatibility */ simulator = sd; @@ -283,6 +299,15 @@ sim_open (SIM_OPEN_KIND kind, break; } + /* CPU specific initialization. */ + for (i = 0; i < MAX_NR_PROCESSORS; ++i) + { + SIM_CPU *cpu = STATE_CPU (sd, i); + + CPU_PC_FETCH (cpu) = v850_pc_get; + CPU_PC_STORE (cpu) = v850_pc_set; + } + return sd; } @@ -324,9 +349,3 @@ sim_store_register (SIM_DESC sd, State.regs[rn] = T2H_4 (*(unsigned32 *) memory); return length; } - -sim_cia -sim_pc_get (sim_cpu *cpu) -{ - return PC; -} |