diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-04-16 02:07:33 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-04-16 02:13:50 -0400 |
commit | 4c0cab1e212bd0f25879b00393bbb60e114ac724 (patch) | |
tree | a4018b90256be14afda4bd7669b03a108a6af772 /sim/moxie | |
parent | 04be4e9eda6742d82fced4a3fc88b01f6cadc183 (diff) | |
download | gdb-4c0cab1e212bd0f25879b00393bbb60e114ac724.zip gdb-4c0cab1e212bd0f25879b00393bbb60e114ac724.tar.gz gdb-4c0cab1e212bd0f25879b00393bbb60e114ac724.tar.bz2 |
sim: avr/mcore/moxie: fill out sim-cpu pc fetch/store helpers
This makes the common sim-cpu logic work.
Diffstat (limited to 'sim/moxie')
-rw-r--r-- | sim/moxie/ChangeLog | 7 | ||||
-rw-r--r-- | sim/moxie/interp.c | 23 | ||||
-rw-r--r-- | sim/moxie/sim-main.h | 2 |
3 files changed, 31 insertions, 1 deletions
diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog index b2cf6f6..6f7e55b 100644 --- a/sim/moxie/ChangeLog +++ b/sim/moxie/ChangeLog @@ -1,3 +1,10 @@ +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. diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c index 428a9d5..fce6d81 100644 --- a/sim/moxie/interp.c +++ b/sim/moxie/interp.c @@ -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; } diff --git a/sim/moxie/sim-main.h b/sim/moxie/sim-main.h index 5a9f7c7..6a2174b 100644 --- a/sim/moxie/sim-main.h +++ b/sim/moxie/sim-main.h @@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ typedef address_word sim_cia; +typedef struct _sim_cpu SIM_CPU; + #include "sim-base.h" #include "bfd.h" |