aboutsummaryrefslogtreecommitdiff
path: root/sim/avr
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-11-21 21:12:59 -0800
committerMike Frysinger <vapier@gentoo.org>2015-11-22 00:53:23 -0500
commit807eaf04cb4ba3c1e5529069ac78af6d9969a5b0 (patch)
tree1b5dd027f61901b45d14d99acc358af8dab6b159 /sim/avr
parentsim: sh: delete global callback/argv (diff)
downloadbinutils-gdb-807eaf04cb4ba3c1e5529069ac78af6d9969a5b0.tar.gz
binutils-gdb-807eaf04cb4ba3c1e5529069ac78af6d9969a5b0.tar.bz2
binutils-gdb-807eaf04cb4ba3c1e5529069ac78af6d9969a5b0.zip
sim: avr: switch to common sim-reg
This is not entirely useful as avr doesn't (yet) store its register state in the cpu state, but it does allow for switching to the common code for these functions.
Diffstat (limited to 'sim/avr')
-rw-r--r--sim/avr/ChangeLog8
-rw-r--r--sim/avr/interp.c10
2 files changed, 14 insertions, 4 deletions
diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog
index 0f52474daa9..410cacaaec3 100644
--- a/sim/avr/ChangeLog
+++ b/sim/avr/ChangeLog
@@ -1,3 +1,11 @@
+2015-11-21 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_store_register): Rename to ...
+ (avr_reg_store): ... this. Adjust signature.
+ (sim_fetch_register): Rename to ...
+ (avr_reg_fetch): ... this. Adjust signature.
+ (sim_open): Call CPU_REG_FETCH and CPU_REG_STORE.
+
2015-11-15 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-reason.o and sim-stop.o.
diff --git a/sim/avr/interp.c b/sim/avr/interp.c
index 0b84c3b4572..48d219540b7 100644
--- a/sim/avr/interp.c
+++ b/sim/avr/interp.c
@@ -1604,8 +1604,8 @@ sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
}
}
-int
-sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+avr_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
if (rn < 32 && length == 1)
{
@@ -1633,8 +1633,8 @@ sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
return 0;
}
-int
-sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+avr_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
{
if (rn < 32 && length == 1)
{
@@ -1747,6 +1747,8 @@ 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) = avr_reg_fetch;
+ CPU_REG_STORE (cpu) = avr_reg_store;
CPU_PC_FETCH (cpu) = avr_pc_get;
CPU_PC_STORE (cpu) = avr_pc_set;
}