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/avr | |
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/avr')
-rw-r--r-- | sim/avr/ChangeLog | 6 | ||||
-rw-r--r-- | sim/avr/interp.c | 22 |
2 files changed, 28 insertions, 0 deletions
diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog index 0dd4faf..2d8ddf2 100644 --- a/sim/avr/ChangeLog +++ b/sim/avr/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/sim/avr/interp.c b/sim/avr/interp.c index d169935..a6588d3 100644 --- a/sim/avr/interp.c +++ b/sim/avr/interp.c @@ -1663,6 +1663,18 @@ sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length) 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) { @@ -1675,6 +1687,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); @@ -1729,6 +1742,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) = avr_pc_get; + CPU_PC_STORE (cpu) = avr_pc_set; + } + /* Clear all the memory. */ memset (sram, 0, sizeof (sram)); memset (flash, 0, sizeof (flash)); |