]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: mcore: switch to common sim-reg
authorMike Frysinger <vapier@gentoo.org>
Sun, 15 Nov 2015 08:17:02 +0000 (00:17 -0800)
committerMike Frysinger <vapier@gentoo.org>
Sun, 15 Nov 2015 12:59:09 +0000 (07:59 -0500)
This is not entirely useful as mcore doesn't (yet) store its register
state in the cpu state, but it does allow for switching to the common
code for these functions.

sim/mcore/ChangeLog
sim/mcore/Makefile.in
sim/mcore/interp.c

index af698e0f33b2205cf2bba3ad25d51753f15b08bc..d89050dbca816814bc263fa6686113808a71ee1b 100644 (file)
@@ -1,3 +1,12 @@
+2015-11-15  Mike Frysinger  <vapier@gentoo.org>
+
+       * Makefile.in (SIM_OBJS): Add sim-reg.o.
+       * interp.c (sim_store_register): Rename to ...
+       (mcore_reg_store): ... this.  Change SIM_DESC to SIM_CPU.
+       (sim_fetch_register): Rename to ...
+       (mcore_reg_fetch): ... this.  Change SIM_DESC to SIM_CPU.
+       (sim_open): Call CPU_REG_FETCH and CPU_REG_STORE.
+
 2015-11-15  Mike Frysinger  <vapier@gentoo.org>
 
        * Makefile.in (SIM_OBJS): Add sim-reason.o and sim-resume.o.
index c66e568b7efb112a7322e46d81f18509ec3af8ae..8e84b0e755c9f89d0218e85ec424833b09880f42 100644 (file)
@@ -25,6 +25,7 @@ SIM_OBJS = \
        $(SIM_NEW_COMMON_OBJS) \
        sim-hload.o \
        sim-reason.o \
+       sim-reg.o \
        sim-resume.o \
        sim-stop.o
 
index 7009f00c8cc1b0bd56a89f92b0492c9d572c1f3c..6972b7fbea2cd6ce0bc6f16eb2db29dcf39b1cbd 100644 (file)
@@ -1285,8 +1285,8 @@ sim_engine_run (SIM_DESC sd,
     }
 }
 
-int
-sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+static int
+mcore_reg_store (SIM_CPU *scpu, int rn, unsigned char *memory, int length)
 {
   if (rn < NUM_MCORE_REGS && rn >= 0)
     {
@@ -1305,8 +1305,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
+mcore_reg_fetch (SIM_CPU *scpu, int rn, unsigned char *memory, int length)
 {
   if (rn < NUM_MCORE_REGS && rn >= 0)
     {
@@ -1447,6 +1447,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) = mcore_reg_fetch;
+      CPU_REG_STORE (cpu) = mcore_reg_store;
       CPU_PC_FETCH (cpu) = mcore_pc_get;
       CPU_PC_STORE (cpu) = mcore_pc_set;