This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] sim: replace CIA_{GET,SET} with CPU_PC_{GET,SET}


The CIA_{GET,SET} macros serve the same function as CPU_PC_{GET,SET}
except the latter adds a layer of indirection via the sim state.  This
lets models set up different functions at runtime and doesn't reach so
directly into the arch-specific cpu state.

It also doesn't make sense to have two sets of macros that do exactly
the same thing, so lets standardize on the one that gets us more.

Committed.
---
 sim/arm/ChangeLog         |  4 ++++
 sim/arm/sim-main.h        |  3 ---
 sim/avr/ChangeLog         |  4 ++++
 sim/avr/sim-main.h        |  3 ---
 sim/bfin/ChangeLog        |  4 ++++
 sim/bfin/sim-main.h       |  3 ---
 sim/common/ChangeLog      |  8 ++++++++
 sim/common/cgen-utils.c   |  2 +-
 sim/common/sim-core.c     |  4 ++--
 sim/common/sim-engine.h   |  2 +-
 sim/common/sim-run.c      |  4 ++--
 sim/cr16/ChangeLog        |  4 ++++
 sim/cr16/sim-main.h       |  3 ---
 sim/cris/ChangeLog        |  6 ++++++
 sim/cris/crisv10f.c       |  2 +-
 sim/cris/crisv32f.c       |  2 +-
 sim/cris/sim-main.h       |  3 ---
 sim/d10v/ChangeLog        |  4 ++++
 sim/d10v/sim-main.h       |  3 ---
 sim/frv/ChangeLog         |  5 +++++
 sim/frv/sim-main.h        |  3 ---
 sim/frv/traps.c           |  2 +-
 sim/ft32/ChangeLog        |  7 +++++++
 sim/ft32/interp.c         |  6 +++---
 sim/ft32/sim-main.h       |  2 --
 sim/h8300/ChangeLog       |  4 ++++
 sim/h8300/sim-main.h      |  2 --
 sim/igen/ChangeLog        |  5 +++++
 sim/igen/gen-engine.c     | 10 +++++-----
 sim/iq2000/ChangeLog      |  4 ++++
 sim/iq2000/sim-main.h     |  3 ---
 sim/lm32/ChangeLog        |  8 ++++++++
 sim/lm32/dv-lm32cpu.c     |  4 ++--
 sim/lm32/sim-main.h       |  3 ---
 sim/lm32/traps.c          |  4 ++--
 sim/m32r/ChangeLog        |  4 ++++
 sim/m32r/sim-main.h       |  3 ---
 sim/m68hc11/ChangeLog     |  4 ++++
 sim/m68hc11/sim-main.h    |  3 ---
 sim/mcore/ChangeLog       |  8 ++++++++
 sim/mcore/interp.c        |  8 ++++----
 sim/mcore/sim-main.h      |  3 ---
 sim/microblaze/ChangeLog  |  4 ++++
 sim/microblaze/sim-main.h |  3 ---
 sim/mips/ChangeLog        | 10 ++++++++++
 sim/mips/dv-tx3904cpu.c   |  8 ++++----
 sim/mips/interp.c         |  4 ++--
 sim/mips/m16run.c         |  6 +++---
 sim/mips/sim-main.h       |  2 --
 sim/mn10300/ChangeLog     | 12 ++++++++++++
 sim/mn10300/dv-mn103cpu.c | 12 ++++++------
 sim/mn10300/interp.c      | 12 ++++++------
 sim/mn10300/sim-main.h    |  3 ---
 sim/moxie/ChangeLog       |  6 ++++++
 sim/moxie/interp.c        | 14 +++++++-------
 sim/moxie/sim-main.h      |  3 ---
 sim/msp430/ChangeLog      |  4 ++++
 sim/msp430/sim-main.h     |  3 ---
 sim/sh/ChangeLog          |  4 ++++
 sim/sh/sim-main.h         |  3 ---
 sim/sh64/ChangeLog        |  4 ++++
 sim/sh64/sim-main.h       |  3 ---
 sim/v850/ChangeLog        |  4 ++++
 sim/v850/sim-main.h       |  3 ---
 64 files changed, 184 insertions(+), 116 deletions(-)

diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index 01105f8..fbb78ec 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,5 +1,9 @@
 2015-04-17  Mike Frysinger  <vapier@gentoo.org>
 
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
 	* wrapper.c (arm_pc_get, arm_pc_set): New functions.
 	(sim_open): Declare new local var i.  Call CPU_PC_FETCH &
 	CPU_PC_STORE for all cpus.
diff --git a/sim/arm/sim-main.h b/sim/arm/sim-main.h
index 8b64287..087ddd5 100644
--- a/sim/arm/sim-main.h
+++ b/sim/arm/sim-main.h
@@ -33,9 +33,6 @@ typedef struct _sim_cpu SIM_CPU;
 
 extern struct ARMul_State *state;
 
-#define CIA_GET(cpu)     PC
-#define CIA_SET(cpu,val) ARMul_SetPC (state, (val))
-
 struct _sim_cpu {
 
   sim_cpu_base base;
diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog
index 2d8ddf2..81bab3b 100644
--- a/sim/avr/ChangeLog
+++ b/sim/avr/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* interp.c (avr_pc_get, avr_pc_set): New functions.
diff --git a/sim/avr/sim-main.h b/sim/avr/sim-main.h
index fc30e11..6b49b8d 100644
--- a/sim/avr/sim-main.h
+++ b/sim/avr/sim-main.h
@@ -24,9 +24,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 typedef address_word sim_cia;
 extern unsigned int pc;
 
-#define CIA_GET(cpu)     pc
-#define CIA_SET(cpu,val) (pc) = (val)
-
 typedef struct _sim_cpu SIM_CPU;
 
 #include "sim-base.h"
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index db379c3..c27ef32 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/bfin/sim-main.h b/sim/bfin/sim-main.h
index f8c2ba2..614d1b6 100644
--- a/sim/bfin/sim-main.h
+++ b/sim/bfin/sim-main.h
@@ -26,9 +26,6 @@
 
 typedef unsigned32 sim_cia;
 
-#define CIA_GET(cpu)     CPU_PC_GET (cpu)
-#define CIA_SET(cpu,val) CPU_PC_SET ((cpu), (val))
-
 typedef struct _sim_cpu SIM_CPU;
 
 #include "bfin-sim.h"
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 316771d..d5c965c 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,11 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* cgen-utils.c (cgen_rtx_error): Change CIA_GET to CPU_PC_GET.
+	* sim-core.c (sim_core_read_buffer, sim_core_write_buffer): Likewise.
+	* sim-engine.h (SIM_ENGINE_HALT_HOOK): Change CIA_SET to CPU_PC_SET.
+	* sim-run.c (sim_engine_run): Change CIA_GET to CPU_PC_GET and
+	CIA_SET to CPU_PC_SET.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_NEW_COMMON_OBJS): Add sim-cpu.o.
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index e1138af..7178677 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -434,5 +434,5 @@ cgen_rtx_error (SIM_CPU *cpu, const char * msg)
   sim_io_printf (sd, msg);
   sim_io_printf (sd, "\n");
 
-  sim_engine_halt (sd, cpu, NULL, CIA_GET (cpu), sim_stopped, SIM_SIGTRAP);
+  sim_engine_halt (sd, cpu, NULL, CPU_PC_GET (cpu), sim_stopped, SIM_SIGTRAP);
 }
diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c
index ccd2c02..43e9076 100644
--- a/sim/common/sim-core.c
+++ b/sim/common/sim-core.c
@@ -531,7 +531,7 @@ sim_core_read_buffer (SIM_DESC sd,
     if (mapping->device != NULL)
       {
 	int nr_bytes = len - count;
-	sim_cia cia = cpu ? CIA_GET (cpu) : NULL_CIA;
+	sim_cia cia = cpu ? CPU_PC_GET (cpu) : NULL_CIA;
 	if (raddr + nr_bytes - 1> mapping->bound)
 	  nr_bytes = mapping->bound - raddr + 1;
 	if (device_io_read_buffer (mapping->device,
@@ -598,7 +598,7 @@ sim_core_write_buffer (SIM_DESC sd,
 	  && mapping->device != NULL)
 	{
 	  int nr_bytes = len - count;
-	  sim_cia cia = cpu ? CIA_GET (cpu) : NULL_CIA;
+	  sim_cia cia = cpu ? CPU_PC_GET (cpu) : NULL_CIA;
 	  if (raddr + nr_bytes - 1 > mapping->bound)
 	    nr_bytes = mapping->bound - raddr + 1;
 	  if (device_io_write_buffer (mapping->device,
diff --git a/sim/common/sim-engine.h b/sim/common/sim-engine.h
index 3fd0a20..73be175 100644
--- a/sim/common/sim-engine.h
+++ b/sim/common/sim-engine.h
@@ -69,7 +69,7 @@ extern void sim_engine_halt
 
 #if !defined (SIM_ENGINE_HALT_HOOK)
 #define SIM_ENGINE_HALT_HOOK(SD, LAST_CPU, CIA) \
-if ((LAST_CPU) != NULL) CIA_SET (LAST_CPU, CIA)
+if ((LAST_CPU) != NULL) CPU_PC_SET (LAST_CPU, CIA)
 #endif
 
 /* NB: If a port uses the SIM_CPU_EXCEPTION_* hooks, the default
diff --git a/sim/common/sim-run.c b/sim/common/sim-run.c
index 6ab18b1..0bf2e4e 100644
--- a/sim/common/sim-run.c
+++ b/sim/common/sim-run.c
@@ -35,7 +35,7 @@ sim_engine_run (SIM_DESC sd,
   sim_cpu *cpu;
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
   cpu = STATE_CPU (sd, 0);
-  cia = CIA_GET (cpu);
+  cia = CPU_PC_GET (cpu);
   while (1)
     {
       instruction_word insn = IMEM32 (cia);
@@ -43,7 +43,7 @@ sim_engine_run (SIM_DESC sd,
       /* process any events */
       if (sim_events_tick (sd))
 	{
-	  CIA_SET (cpu, cia);
+	  CPU_PC_SET (cpu, cia);
 	  sim_events_process (sd);
 	}
     }
diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog
index 1a6cd14..260164f 100644
--- a/sim/cr16/ChangeLog
+++ b/sim/cr16/ChangeLog
@@ -1,5 +1,9 @@
 2015-04-17  Mike Frysinger  <vapier@gentoo.org>
 
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
 	* interp.c (cr16_pc_get, cr16_pc_set): New functions.
 	(sim_open): Call CPU_PC_FETCH & CPU_PC_STORE for all cpus.
 
diff --git a/sim/cr16/sim-main.h b/sim/cr16/sim-main.h
index ec94a82..96254f1 100644
--- a/sim/cr16/sim-main.h
+++ b/sim/cr16/sim-main.h
@@ -32,9 +32,6 @@ typedef struct _sim_cpu SIM_CPU;
 
 #include "cr16_sim.h"
 
-#define CIA_GET(cpu)     PC
-#define CIA_SET(cpu,val) SET_PC (val)
-
 struct _sim_cpu {
 
   sim_cpu_base base;
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index 8927529..b8b1631 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* crisv10f.c (deliver_interrupt): Change CIA_GET to CPU_PC_GET.
+	* crisv32f.c (deliver_interrupt): Likewise.
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/cris/crisv10f.c b/sim/cris/crisv10f.c
index 562b4c9..906a32f 100644
--- a/sim/cris/crisv10f.c
+++ b/sim/cris/crisv10f.c
@@ -86,7 +86,7 @@ MY (deliver_interrupt) (SIM_CPU *current_cpu,
 			    GET_H_SR (H_SR_PRE_V32_IBR) + vec * 4, 4) == 0)
     {
       /* Nothing to do actually; either abort or send a signal.  */
-      sim_core_signal (sd, current_cpu, CIA_GET (current_cpu), 0, 4,
+      sim_core_signal (sd, current_cpu, CPU_PC_GET (current_cpu), 0, 4,
 		       GET_H_SR (H_SR_PRE_V32_IBR) + vec * 4,
 		       read_transfer, sim_core_unmapped_signal);
       return 0;
diff --git a/sim/cris/crisv32f.c b/sim/cris/crisv32f.c
index 3a0135d..dabd8b3 100644
--- a/sim/cris/crisv32f.c
+++ b/sim/cris/crisv32f.c
@@ -615,7 +615,7 @@ MY (deliver_interrupt) (SIM_CPU *current_cpu,
 			    GET_H_SR (H_SR_EBP) + vec * 4, 4) == 0)
     {
       /* Nothing to do actually; either abort or send a signal.  */
-      sim_core_signal (sd, current_cpu, CIA_GET (current_cpu), 0, 4,
+      sim_core_signal (sd, current_cpu, CPU_PC_GET (current_cpu), 0, 4,
 		       GET_H_SR (H_SR_EBP) + vec * 4,
 		       read_transfer, sim_core_unmapped_signal);
       return 0;
diff --git a/sim/cris/sim-main.h b/sim/cris/sim-main.h
index df6c5cf..5985308 100644
--- a/sim/cris/sim-main.h
+++ b/sim/cris/sim-main.h
@@ -39,9 +39,6 @@ typedef struct _sim_cpu SIM_CPU;
 /* These must be defined before sim-base.h.  */
 typedef USI sim_cia;
 
-#define CIA_GET(cpu)     CPU_PC_GET (cpu)
-#define CIA_SET(cpu,val) CPU_PC_SET ((cpu), (val))
-
 #define SIM_ENGINE_HALT_HOOK(sd, cpu, cia) \
 do { \
   if (cpu) /* Null if ctrl-c.  */ \
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 0cf06d7..bac73a2 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,5 +1,9 @@
 2015-04-17  Mike Frysinger  <vapier@gentoo.org>
 
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
 	* interp.c (d10v_pc_get, d10v_pc_set): New functions.
 	(sim_open): Declare new local var i.  Call CPU_PC_FETCH &
 	CPU_PC_STORE for all cpus.
diff --git a/sim/d10v/sim-main.h b/sim/d10v/sim-main.h
index c83c78c..7eb0b90 100644
--- a/sim/d10v/sim-main.h
+++ b/sim/d10v/sim-main.h
@@ -32,9 +32,6 @@ typedef struct _sim_cpu SIM_CPU;
 
 #include "d10v_sim.h"
 
-#define CIA_GET(cpu)     PC
-#define CIA_SET(cpu,val) SET_PC (val)
-
 struct _sim_cpu {
 
   sim_cpu_base base;
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index 05ae18a..1724c35 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+	* traps.c (frv_sim_engine_halt_hook): Change CIA_SET to CPU_PC_SET.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/frv/sim-main.h b/sim/frv/sim-main.h
index 1fd60b5..275ac28 100644
--- a/sim/frv/sim-main.h
+++ b/sim/frv/sim-main.h
@@ -43,9 +43,6 @@ typedef struct _sim_cpu SIM_CPU;
 /* These must be defined before sim-base.h.  */
 typedef USI sim_cia;
 
-#define CIA_GET(cpu)     CPU_PC_GET (cpu)
-#define CIA_SET(cpu,val) CPU_PC_SET ((cpu), (val))
-
 void frv_sim_engine_halt_hook (SIM_DESC, SIM_CPU *, sim_cia);
 #define SIM_ENGINE_HALT_HOOK(SD, LAST_CPU, CIA) \
   frv_sim_engine_halt_hook ((SD), (LAST_CPU), (CIA))
diff --git a/sim/frv/traps.c b/sim/frv/traps.c
index 1f116b2..1263683 100644
--- a/sim/frv/traps.c
+++ b/sim/frv/traps.c
@@ -65,7 +65,7 @@ frv_sim_engine_halt_hook (SIM_DESC sd, SIM_CPU *current_cpu, sim_cia cia)
 {
   int i;
   if (current_cpu != NULL)
-    CIA_SET (current_cpu, cia);
+    CPU_PC_SET (current_cpu, cia);
 
   /* Invalidate the insn and data caches of all cpus.  */
   for (i = 0; i < MAX_NR_PROCESSORS; ++i)
diff --git a/sim/ft32/ChangeLog b/sim/ft32/ChangeLog
index 07fb6a6..a391108 100644
--- a/sim/ft32/ChangeLog
+++ b/sim/ft32/ChangeLog
@@ -1,3 +1,10 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (ft32_read_item): Change CIA_GET to CPU_PC_GET.
+	(ft32_write_item): Likewise.
+	(step_once): Likewise.
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c
index 8306a75..404683d 100644
--- a/sim/ft32/interp.c
+++ b/sim/ft32/interp.c
@@ -110,7 +110,7 @@ static uint32_t
 ft32_read_item (SIM_DESC sd, int dw, uint32_t ea)
 {
   sim_cpu *cpu = STATE_CPU (sd, 0);
-  address_word cia = CIA_GET (cpu);
+  address_word cia = CPU_PC_GET (cpu);
   uint8_t byte[4];
   uint32_t r;
 
@@ -133,7 +133,7 @@ static void
 ft32_write_item (SIM_DESC sd, int dw, uint32_t ea, uint32_t v)
 {
   sim_cpu *cpu = STATE_CPU (sd, 0);
-  address_word cia = CIA_GET (cpu);
+  address_word cia = CPU_PC_GET (cpu);
   uint8_t byte[4];
 
   ea = ft32_align (dw, ea);
@@ -311,7 +311,7 @@ static void
 step_once (SIM_DESC sd)
 {
   sim_cpu *cpu = STATE_CPU (sd, 0);
-  address_word cia = CIA_GET (cpu);
+  address_word cia = CPU_PC_GET (cpu);
   uint32_t inst;
   uint32_t dw;
   uint32_t cb;
diff --git a/sim/ft32/sim-main.h b/sim/ft32/sim-main.h
index 1aa4248..a4f5f6d 100644
--- a/sim/ft32/sim-main.h
+++ b/sim/ft32/sim-main.h
@@ -35,8 +35,6 @@ typedef struct _sim_cpu SIM_CPU;
 struct _sim_cpu {
 
   /* The following are internal simulator state variables: */
-#define CIA_GET(CPU) ((CPU)->state.pc + 0)
-#define CIA_SET(CPU,CIA) ((CPU)->state.pc = (CIA))
 
   struct ft32_cpu_state state;
 
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index f414847..1cc28f5 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,5 +1,9 @@
 2015-04-17  Mike Frysinger  <vapier@gentoo.org>
 
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
 	* compile.c (h8300_pc_get, h8300_pc_set): New functions.
 	(sim_open): Declare new local var i.  Call CPU_PC_FETCH &
 	CPU_PC_STORE for all cpus.
diff --git a/sim/h8300/sim-main.h b/sim/h8300/sim-main.h
index e428d80..450f8ca 100644
--- a/sim/h8300/sim-main.h
+++ b/sim/h8300/sim-main.h
@@ -155,8 +155,6 @@ struct sim_state {
 
 /* The current state of the processor; registers, memory, etc.  */
 
-#define CIA_GET(CPU)		(cpu_get_pc (CPU))
-#define CIA_SET(CPU, VAL)	(cpu_set_pc ((CPU), (VAL)))
 #define cpu_set_pc(CPU, VAL)	(((CPU)->pc)  = (VAL))
 #define cpu_get_pc(CPU)		(((CPU)->pc))
 
diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog
index 0553434..92d7db9 100644
--- a/sim/igen/ChangeLog
+++ b/sim/igen/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* gen-engine.c (print_run_body): Change CIA_GET to CPU_PC_GET and
+	CIA_SET to CPU_PC_SET.
+
 2015-03-31  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure: Regenerate.
diff --git a/sim/igen/gen-engine.c b/sim/igen/gen-engine.c
index 232e50d..c081049 100644
--- a/sim/igen/gen-engine.c
+++ b/sim/igen/gen-engine.c
@@ -116,7 +116,7 @@ cache. */\n\
       lf_putstr (file, "/* prime the main loop */\n");
       lf_putstr (file, "SIM_ASSERT (current_cpu == 0);\n");
       lf_putstr (file, "SIM_ASSERT (nr_cpus == 1);\n");
-      lf_putstr (file, "cia = CIA_GET (CPU);\n");
+      lf_putstr (file, "cia = CPU_PC_GET (CPU);\n");
 
       lf_putstr (file, "\n");
       lf_putstr (file, "while (1)\n");
@@ -202,9 +202,9 @@ cache. */\n\
       lf_putstr (file, "/* process any events */\n");
       lf_putstr (file, "if (sim_events_tick (sd))\n");
       lf_putstr (file, "  {\n");
-      lf_putstr (file, "    CIA_SET (CPU, cia);\n");
+      lf_putstr (file, "    CPU_PC_SET (CPU, cia);\n");
       lf_putstr (file, "    sim_events_process (sd);\n");
-      lf_putstr (file, "    cia = CIA_GET (CPU);\n");
+      lf_putstr (file, "    cia = CPU_PC_GET (CPU);\n");
       lf_putstr (file, "  }\n");
 
       lf_indent (file, -4);
@@ -236,7 +236,7 @@ after all the other CPU's and the event queue have been processed */\n\
       lf_putstr (file, "  {\n");
       lf_indent (file, +4);
       lf_putstr (file, "sim_cpu *cpu = STATE_CPU (sd, current_cpu);\n");
-      lf_putstr (file, "instruction_address cia = CIA_GET (cpu);\n");
+      lf_putstr (file, "instruction_address cia = CPU_PC_GET (cpu);\n");
       lf_putstr (file, "\n");
 
       if (!options.gen.icache)
@@ -245,7 +245,7 @@ after all the other CPU's and the event queue have been processed */\n\
 		     options.insn_bit_size);
 	  print_engine_issue_prefix_hook (file);
 	  print_idecode_body (file, table, "cia =");
-	  lf_putstr (file, "CIA_SET (cpu, cia);\n");
+	  lf_putstr (file, "CPU_PC_SET (cpu, cia);\n");
 	  print_engine_issue_postfix_hook (file);
 	}
 
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index 4278ae6..44e5002 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/iq2000/sim-main.h b/sim/iq2000/sim-main.h
index 1498eb4..29d4b62 100644
--- a/sim/iq2000/sim-main.h
+++ b/sim/iq2000/sim-main.h
@@ -26,9 +26,6 @@ typedef struct _sim_cpu SIM_CPU;
 /* These must be defined before sim-base.h.  */
 typedef USI sim_cia;
 
-#define CIA_GET(cpu)     CPU_PC_GET (cpu)
-#define CIA_SET(cpu,val) CPU_PC_SET ((cpu), (val))
-
 #include "sim-base.h"
 #include "cgen-sim.h"
 #include "iq2000-sim.h"
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog
index 6464b77..e536d31 100644
--- a/sim/lm32/ChangeLog
+++ b/sim/lm32/ChangeLog
@@ -1,3 +1,11 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-lm32cpu.c (deliver_lm32cpu_interrupt): Change CIA_GET to
+	CPU_PC_GET.
+	(lm32cpu_port_event): Likewise.
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+	* traps.c (lm32_core_signal): Change CIA_SET to CPU_PC_SET.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/lm32/dv-lm32cpu.c b/sim/lm32/dv-lm32cpu.c
index 7087f0b..bdd64f3 100644
--- a/sim/lm32/dv-lm32cpu.c
+++ b/sim/lm32/dv-lm32cpu.c
@@ -137,7 +137,7 @@ deliver_lm32cpu_interrupt (struct hw *me, void *data)
   struct lm32cpu *controller = hw_data (me);
   SIM_DESC sd = hw_system (me);
   sim_cpu *cpu = STATE_CPU (sd, 0);	/* NB: fix CPU 0.  */
-  address_word cia = CIA_GET (cpu);
+  address_word cia = CPU_PC_GET (cpu);
   int interrupt = (int) data;
 
 
@@ -192,7 +192,7 @@ lm32cpu_port_event (struct hw *me,
   struct lm32cpu *controller = hw_data (me);
   SIM_DESC sd = hw_system (me);
   sim_cpu *cpu = STATE_CPU (sd, 0);	/* NB: fix CPU 0.  */
-  address_word cia = CIA_GET (cpu);
+  address_word cia = CPU_PC_GET (cpu);
 
 
   HW_TRACE ((me, "interrupt event on port %d, level %d", my_port, level));
diff --git a/sim/lm32/sim-main.h b/sim/lm32/sim-main.h
index dcb5ac0..52122d2 100644
--- a/sim/lm32/sim-main.h
+++ b/sim/lm32/sim-main.h
@@ -38,9 +38,6 @@ typedef struct _sim_cpu SIM_CPU;
 /* These must be defined before sim-base.h.  */
 typedef USI sim_cia;
 
-#define CIA_GET(cpu)     CPU_PC_GET (cpu)
-#define CIA_SET(cpu,val) CPU_PC_SET ((cpu), (val))
-
 #define SIM_ENGINE_HALT_HOOK(sd, cpu, cia) \
 do { \
   if (cpu) /* null if ctrl-c */ \
diff --git a/sim/lm32/traps.c b/sim/lm32/traps.c
index 3070323..777e7b5 100644
--- a/sim/lm32/traps.c
+++ b/sim/lm32/traps.c
@@ -245,7 +245,7 @@ lm32_core_signal (SIM_DESC sd,
       SET_H_GR (30, ip);
       /* Save and clear interrupt enable.  */
       SET_H_CSR (LM32_CSR_IE, (GET_H_CSR (LM32_CSR_IE) & 1) << 1);
-      CIA_SET (cpu, GET_H_CSR (LM32_CSR_EBA) + LM32_EID_DATA_BUS_ERROR * 32);
+      CPU_PC_SET (cpu, GET_H_CSR (LM32_CSR_EBA) + LM32_EID_DATA_BUS_ERROR * 32);
       sim_engine_halt (sd, cpu, NULL, LM32_EID_DATA_BUS_ERROR * 32,
 		       sim_stopped, SIM_SIGSEGV);
       break;
@@ -257,7 +257,7 @@ lm32_core_signal (SIM_DESC sd,
       SET_H_GR (30, ip);
       /* Save and clear interrupt enable.  */
       SET_H_CSR (LM32_CSR_IE, (GET_H_CSR (LM32_CSR_IE) & 1) << 1);
-      CIA_SET (cpu, GET_H_CSR (LM32_CSR_EBA) + LM32_EID_DATA_BUS_ERROR * 32);
+      CPU_PC_SET (cpu, GET_H_CSR (LM32_CSR_EBA) + LM32_EID_DATA_BUS_ERROR * 32);
       sim_engine_halt (sd, cpu, NULL, LM32_EID_DATA_BUS_ERROR * 32,
 		       sim_stopped, SIM_SIGBUS);
       break;
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index ab15617..d47cdfb 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/m32r/sim-main.h b/sim/m32r/sim-main.h
index 9f859e2..661d9cf 100644
--- a/sim/m32r/sim-main.h
+++ b/sim/m32r/sim-main.h
@@ -18,9 +18,6 @@ typedef struct _sim_cpu SIM_CPU;
 /* These must be defined before sim-base.h.  */
 typedef USI sim_cia;
 
-#define CIA_GET(cpu)     CPU_PC_GET (cpu)
-#define CIA_SET(cpu,val) CPU_PC_SET ((cpu), (val))
-
 #define SIM_ENGINE_HALT_HOOK(sd, cpu, cia) \
 do { \
   if (cpu) /* null if ctrl-c */ \
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 64cb223..714c000 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
index 9c0a1ed..ac57f98 100644
--- a/sim/m68hc11/sim-main.h
+++ b/sim/m68hc11/sim-main.h
@@ -574,9 +574,6 @@ extern void m68hc11cpu_set_port (struct hw *me, sim_cpu *cpu,
 
 /* The current state of the processor; registers, memory, etc.  */
 
-#define CIA_GET(CPU)      (cpu_get_pc (CPU))
-#define CIA_SET(CPU,VAL)  (cpu_set_pc ((CPU), (VAL)))
-
 struct sim_state {
   sim_cpu        *cpu[MAX_NR_PROCESSORS];
   device         *devices;
diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog
index a00954c..89f17d8 100644
--- a/sim/mcore/ChangeLog
+++ b/sim/mcore/ChangeLog
@@ -1,3 +1,11 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (set_initial_gprs): Change CIA_SET to CPU_PC_SET.
+	(sim_resume): Change CIA_GET to CPU_PC_GET and CIA_SET to
+	CPU_PC_SET.
+	(sim_create_inferior): Change CIA_SET to CPU_PC_SET.
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* interp.c (mcore_pc_get, mcore_pc_set): New functions.
diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c
index fc1131b..54d628c 100644
--- a/sim/mcore/interp.c
+++ b/sim/mcore/interp.c
@@ -397,7 +397,7 @@ set_initial_gprs (SIM_CPU *scpu)
   init_pointers ();
 
   /* Set up machine just out of reset.  */
-  CIA_SET (scpu, 0);
+  CPU_PC_SET (scpu, 0);
   cpu.sr = 0;
 
   memsize = cpu.asregs.msize / (1024 * 1024);
@@ -716,7 +716,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
   word WLhash;
 
   cpu.asregs.exception = step ? SIGTRAP: 0;
-  pc = CIA_GET (scpu);
+  pc = CPU_PC_GET (scpu);
 
   /* Fetch the initial instructions that we'll decode. */
   ibuf = rlat (pc & 0xFFFFFFFC);
@@ -1648,7 +1648,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
   while (!cpu.asregs.exception);
 
   /* Hide away the things we've cached while executing.  */
-  CIA_SET (scpu, pc);
+  CPU_PC_SET (scpu, pc);
   cpu.asregs.insts += insts;		/* instructions done ... */
   cpu.asregs.cycles += insts;		/* and each takes a cycle */
   cpu.asregs.cycles += bonus_cycles;	/* and extra cycles for branches */
@@ -1905,7 +1905,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *prog_bfd, char **argv, char **env)
   issue_messages = l;
 
   hi_stack = cpu.asregs.msize - 4;
-  CIA_SET (scpu, bfd_get_start_address (prog_bfd));
+  CPU_PC_SET (scpu, bfd_get_start_address (prog_bfd));
 
   /* Calculate the argument and environment strings.  */
   s_length = 0;
diff --git a/sim/mcore/sim-main.h b/sim/mcore/sim-main.h
index 80b467a..f700059 100644
--- a/sim/mcore/sim-main.h
+++ b/sim/mcore/sim-main.h
@@ -30,9 +30,6 @@ typedef struct _sim_cpu SIM_CPU;
 #include "sim-base.h"
 #include "bfd.h"
 
-#define CIA_GET(cpu)     (cpu)->pc
-#define CIA_SET(cpu,val) (cpu)->pc = (val)
-
 struct _sim_cpu {
 
   word pc;
diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog
index 4223301..8ac3a26 100644
--- a/sim/microblaze/ChangeLog
+++ b/sim/microblaze/ChangeLog
@@ -1,5 +1,9 @@
 2015-04-17  Mike Frysinger  <vapier@gentoo.org>
 
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
 	* interp.c (microblaze_pc_get, microblaze_pc_set): New functions.
 	(sim_open): Call CPU_PC_FETCH & CPU_PC_STORE for all cpus.
 
diff --git a/sim/microblaze/sim-main.h b/sim/microblaze/sim-main.h
index 68f8223..1b34f3a 100644
--- a/sim/microblaze/sim-main.h
+++ b/sim/microblaze/sim-main.h
@@ -23,9 +23,6 @@
 
 typedef address_word sim_cia;
 
-#define CIA_GET(cpu) (cpu)->microblaze_cpu.spregs[0]
-#define CIA_SET(cpu,val) (cpu)->microblaze_cpu.spregs[0] = (val)
-
 typedef struct _sim_cpu SIM_CPU;
 
 #include "sim-base.h"
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 249e8c5..00f7871 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,13 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-tx3904cpu.c (deliver_tx3904cpu_interrupt): Change CIA_GET to
+	PU_PC_GET.
+	* interp.c (interrupt_event): Change CIA_GET to CPU_PC_GET.
+	(sim_create_inferior): Change CIA_SET to CPU_PC_SET.
+	* m16run.c (sim_engine_run): Change CIA_GET to CPU_PC_GET and
+	CIA_SET to CPU_PC_SET.
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/mips/dv-tx3904cpu.c b/sim/mips/dv-tx3904cpu.c
index 56b3386..cf9399a 100644
--- a/sim/mips/dv-tx3904cpu.c
+++ b/sim/mips/dv-tx3904cpu.c
@@ -141,7 +141,7 @@ deliver_tx3904cpu_interrupt (struct hw *me,
   struct tx3904cpu *controller = hw_data (me);
   SIM_DESC sd = hw_system (me);
   sim_cpu *cpu = STATE_CPU (sd, 0); /* NB: fix CPU 0. */
-  address_word cia = CIA_GET (cpu);
+  address_word cia = CPU_PC_GET (cpu);
 
 #define CPU cpu
 #define SD current_state
@@ -149,20 +149,20 @@ deliver_tx3904cpu_interrupt (struct hw *me,
   if (controller->pending_reset)
     {
       controller->pending_reset = 0;
-      HW_TRACE ((me, "reset pc=0x%08lx", (long) CIA_GET (cpu)));
+      HW_TRACE ((me, "reset pc=0x%08lx", (long) CPU_PC_GET (cpu)));
       SignalExceptionNMIReset();
     }
   else if (controller->pending_nmi)
     {
       controller->pending_nmi = 0;
-      HW_TRACE ((me, "nmi pc=0x%08lx", (long) CIA_GET (cpu)));
+      HW_TRACE ((me, "nmi pc=0x%08lx", (long) CPU_PC_GET (cpu)));
       SignalExceptionNMIReset();
     }
   else if (controller->pending_level)
     {
       HW_TRACE ((me, "interrupt level=%d pc=0x%08lx sr=0x%08lx",
 		 controller->pending_level,
-		 (long) CIA_GET (cpu), (long) SR));
+		 (long) CPU_PC_GET (cpu), (long) SR));
 
       /* Clear CAUSE register.  It may stay this way if the interrupt
 	 was cleared with a negative pending_level. */
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index d6136ab..38f2524 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -311,7 +311,7 @@ void
 interrupt_event (SIM_DESC sd, void *data)
 {
   sim_cpu *cpu = STATE_CPU (sd, 0); /* FIXME */
-  address_word cia = CIA_GET (cpu);
+  address_word cia = CPU_PC_GET (cpu);
   if (SR & status_IE)
     {
       interrupt_pending = 0;
@@ -1112,7 +1112,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
       for (cpu_nr = 0; cpu_nr < sim_engine_nr_cpus (sd); cpu_nr++)
 	{
 	  sim_cpu *cpu = STATE_CPU (sd, cpu_nr);
-	  CIA_SET (cpu, (unsigned64) bfd_get_start_address (abfd));
+	  CPU_PC_SET (cpu, (unsigned64) bfd_get_start_address (abfd));
 	}
     }
 
diff --git a/sim/mips/m16run.c b/sim/mips/m16run.c
index 0f5fec1..44fb9e4 100644
--- a/sim/mips/m16run.c
+++ b/sim/mips/m16run.c
@@ -33,7 +33,7 @@ sim_engine_run (SIM_DESC sd,
 		int siggnal) /* ignore */
 {
   sim_cpu *cpu = STATE_CPU (sd, next_cpu_nr);
-  address_word cia = CIA_GET (cpu);
+  address_word cia = CPU_PC_GET (cpu);
 
   while (1)
     {
@@ -64,9 +64,9 @@ sim_engine_run (SIM_DESC sd,
       /* process any events */
       if (sim_events_tick (sd))
         {
-          CIA_SET (CPU, cia);
+          CPU_PC_SET (CPU, cia);
           sim_events_process (sd);
-	  cia = CIA_GET (CPU);
+	  cia = CPU_PC_GET (CPU);
         }
 
     }
diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h
index a044504..7a58bd3 100644
--- a/sim/mips/sim-main.h
+++ b/sim/mips/sim-main.h
@@ -257,8 +257,6 @@ struct _sim_cpu {
 
 
   /* The following are internal simulator state variables: */
-#define CIA_GET(CPU) ((CPU)->registers[PCIDX] + 0)
-#define CIA_SET(CPU,CIA) ((CPU)->registers[PCIDX] = (CIA))
   address_word dspc;  /* delay-slot PC */
 #define DSPC ((CPU)->dspc)
 
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index eca9946..91aa179 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,15 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-mn103cpu.c (deliver_mn103cpu_interrupt): Change CIA_GET to
+	CPU_PC_GET and CIA_SET to CPU_PC_SET.
+	* interp.c (sim_create_inferior): Change CIA_SET to CPU_PC_SET.
+	(program_interrupt): Change CIA_GET to CPU_PC_GET and CIA_SET to
+	CPU_PC_SET.
+	(mn10300_cpu_exception_trigger): Change CIA_SET to CPU_PC_SET.
+	(mn10300_cpu_exception_suspend): Likewise.
+	(mn10300_cpu_exception_resume): Likewise.
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (MN10300_OBJS): Delete sim-cpu.o.
diff --git a/sim/mn10300/dv-mn103cpu.c b/sim/mn10300/dv-mn103cpu.c
index e5540ee..e9dd2f6 100644
--- a/sim/mn10300/dv-mn103cpu.c
+++ b/sim/mn10300/dv-mn103cpu.c
@@ -227,31 +227,31 @@ deliver_mn103cpu_interrupt (struct hw *me,
   else if (controller->pending_nmi)
     {
       controller->pending_nmi = 0;
-      store_word (SP - 4, CIA_GET (cpu));
+      store_word (SP - 4, CPU_PC_GET (cpu));
       store_half (SP - 8, PSW);
       PSW &= ~PSW_IE;
       SP = SP - 8;
-      CIA_SET (cpu, 0x40000008);
+      CPU_PC_SET (cpu, 0x40000008);
       HW_TRACE ((me, "nmi pc=0x%08lx psw=0x%04x sp=0x%08lx",
-		 (long) CIA_GET (cpu), (unsigned) PSW, (long) SP));
+		 (long) CPU_PC_GET (cpu), (unsigned) PSW, (long) SP));
     }
   else if ((controller->pending_level < EXTRACT_PSW_LM)
 	   && (PSW & PSW_IE))
     {
       /* Don't clear pending level.  Request continues to be pending
          until the interrupt controller clears/changes it */
-      store_word (SP - 4, CIA_GET (cpu));
+      store_word (SP - 4, CPU_PC_GET (cpu));
       store_half (SP - 8, PSW);
       PSW &= ~PSW_IE;
       PSW &= ~PSW_LM;
       PSW |= INSERT_PSW_LM (controller->pending_level);
       SP = SP - 8;
-      CIA_SET (cpu, 0x40000000 + controller->interrupt_vector[controller->pending_level]);
+      CPU_PC_SET (cpu, 0x40000000 + controller->interrupt_vector[controller->pending_level]);
       HW_TRACE ((me, "port-out ack %d", controller->pending_level));
       hw_port_event (me, ACK_PORT, controller->pending_level);
       HW_TRACE ((me, "int level=%d pc=0x%08lx psw=0x%04x sp=0x%08lx",
 		 controller->pending_level,
-		 (long) CIA_GET (cpu), (unsigned) PSW, (long) SP));
+		 (long) CPU_PC_GET (cpu), (unsigned) PSW, (long) SP));
     }
 
   if (controller->pending_level < 7) /* FIXME */
diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c
index 850f057..4439ac8 100644
--- a/sim/mn10300/interp.c
+++ b/sim/mn10300/interp.c
@@ -346,7 +346,7 @@ sim_create_inferior (SIM_DESC sd,
   } else {
     PC = 0;
   }
-  CIA_SET (STATE_CPU (sd, 0), (unsigned64) PC);
+  CPU_PC_SET (STATE_CPU (sd, 0), (unsigned64) PC);
 
   if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_am33_2)
     PSW |= PSW_FE;
@@ -482,7 +482,7 @@ program_interrupt (SIM_DESC sd,
     {
       in_interrupt = 1;
       /* copy NMI handler code from dv-mn103cpu.c */
-      store_word (SP - 4, CIA_GET (cpu));
+      store_word (SP - 4, CPU_PC_GET (cpu));
       store_half (SP - 8, PSW);
 
       /* Set the SYSEF flag in NMICR by backdoor method.  See
@@ -496,7 +496,7 @@ program_interrupt (SIM_DESC sd,
 
   PSW &= ~PSW_IE;
   SP = SP - 8;
-  CIA_SET (cpu, 0x40000008);
+  CPU_PC_SET (cpu, 0x40000008);
 
   in_interrupt = 0;
   sim_engine_halt(sd, cpu, NULL, cia, sim_stopped, sig);
@@ -511,7 +511,7 @@ mn10300_cpu_exception_trigger(SIM_DESC sd, sim_cpu* cpu, address_word cia)
   if(State.exc_suspended > 0)
     sim_io_eprintf(sd, "Warning, nested exception triggered (%d)\n", State.exc_suspended); 
 
-  CIA_SET (cpu, cia);
+  CPU_PC_SET (cpu, cia);
   memcpy(State.exc_trigger_regs, State.regs, sizeof(State.exc_trigger_regs));
   State.exc_suspended = 0;
 }
@@ -527,7 +527,7 @@ mn10300_cpu_exception_suspend(SIM_DESC sd, sim_cpu* cpu, int exception)
 
   memcpy(State.exc_suspend_regs, State.regs, sizeof(State.exc_suspend_regs));
   memcpy(State.regs, State.exc_trigger_regs, sizeof(State.regs));
-  CIA_SET (cpu, PC); /* copy PC back from new State.regs */
+  CPU_PC_SET (cpu, PC); /* copy PC back from new State.regs */
   State.exc_suspended = exception;
 }
 
@@ -549,7 +549,7 @@ mn10300_cpu_exception_resume(SIM_DESC sd, sim_cpu* cpu, int exception)
 		       State.exc_suspended, exception); 
       
       memcpy(State.regs, State.exc_suspend_regs, sizeof(State.regs)); 
-      CIA_SET (cpu, PC); /* copy PC back from new State.regs */
+      CPU_PC_SET (cpu, PC); /* copy PC back from new State.regs */
     }
   else if(exception != 0 && State.exc_suspended == 0)
     {
diff --git a/sim/mn10300/sim-main.h b/sim/mn10300/sim-main.h
index 47c017e..3781da0 100644
--- a/sim/mn10300/sim-main.h
+++ b/sim/mn10300/sim-main.h
@@ -71,9 +71,6 @@ mn10300_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), (TRANSFER),
 /* FIXME: For moment, save/restore PC value found in struct State.
    Struct State will one day go away, being placed in the sim_cpu
    state. */
-#define CIA_GET(CPU) ((PC) + 0)
-#define CIA_SET(CPU,VAL) ((CPU)->cia = (VAL), PC = (VAL))
-
 
 struct _sim_cpu {
   sim_event *pending_nmi;
diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog
index 6f7e55b..6bdad25 100644
--- a/sim/moxie/ChangeLog
+++ b/sim/moxie/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (wbat, wsat, wlat, rsat, rbat, rlat, sim_engine_run):
+	Change CIA_GET to CPU_PC_GET.
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* interp.c (moxie_pc_get, moxie_pc_set): New functions.
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index fce6d81..0fbb850 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -151,7 +151,7 @@ set_initial_gprs (void)
 static INLINE void
 wbat (sim_cpu *scpu, word pc, word x, word v)
 {
-  address_word cia = CIA_GET (scpu);
+  address_word cia = CPU_PC_GET (scpu);
   
   sim_core_write_aligned_1 (scpu, cia, write_map, x, v);
 }
@@ -161,7 +161,7 @@ wbat (sim_cpu *scpu, word pc, word x, word v)
 static INLINE void
 wsat (sim_cpu *scpu, word pc, word x, word v)
 {
-  address_word cia = CIA_GET (scpu);
+  address_word cia = CPU_PC_GET (scpu);
   
   sim_core_write_aligned_2 (scpu, cia, write_map, x, v);
 }
@@ -171,7 +171,7 @@ wsat (sim_cpu *scpu, word pc, word x, word v)
 static INLINE void
 wlat (sim_cpu *scpu, word pc, word x, word v)
 {
-  address_word cia = CIA_GET (scpu);
+  address_word cia = CPU_PC_GET (scpu);
 	
   sim_core_write_aligned_4 (scpu, cia, write_map, x, v);
 }
@@ -181,7 +181,7 @@ wlat (sim_cpu *scpu, word pc, word x, word v)
 static INLINE int
 rsat (sim_cpu *scpu, word pc, word x)
 {
-  address_word cia = CIA_GET (scpu);
+  address_word cia = CPU_PC_GET (scpu);
   
   return (sim_core_read_aligned_2 (scpu, cia, read_map, x));
 }
@@ -191,7 +191,7 @@ rsat (sim_cpu *scpu, word pc, word x)
 static INLINE int
 rbat (sim_cpu *scpu, word pc, word x)
 {
-  address_word cia = CIA_GET (scpu);
+  address_word cia = CPU_PC_GET (scpu);
   
   return (sim_core_read_aligned_1 (scpu, cia, read_map, x));
 }
@@ -201,7 +201,7 @@ rbat (sim_cpu *scpu, word pc, word x)
 static INLINE int
 rlat (sim_cpu *scpu, word pc, word x)
 {
-  address_word cia = CIA_GET (scpu);
+  address_word cia = CPU_PC_GET (scpu);
   
   return (sim_core_read_aligned_4 (scpu, cia, read_map, x));
 }
@@ -243,7 +243,7 @@ sim_engine_run (SIM_DESC sd,
   word pc, opc;
   unsigned short inst;
   sim_cpu *scpu = STATE_CPU (sd, 0); /* FIXME */
-  address_word cia = CIA_GET (scpu);
+  address_word cia = CPU_PC_GET (scpu);
 
   pc = cpu.asregs.regs[PC_REGNO];
 
diff --git a/sim/moxie/sim-main.h b/sim/moxie/sim-main.h
index 6a2174b..3dd53ff 100644
--- a/sim/moxie/sim-main.h
+++ b/sim/moxie/sim-main.h
@@ -34,8 +34,6 @@ typedef struct _sim_cpu SIM_CPU;
 struct _sim_cpu {
 
   /* The following are internal simulator state variables: */
-#define CIA_GET(CPU) ((CPU)->registers[PCIDX] + 0)
-#define CIA_SET(CPU,CIA) ((CPU)->registers[PCIDX] = (CIA))
 
 /* To keep this default simulator simple, and fast, we use a direct
    vector of registers. The internal simulator engine then uses
@@ -54,4 +52,3 @@ struct sim_state {
 };
 
 #endif
-
diff --git a/sim/msp430/ChangeLog b/sim/msp430/ChangeLog
index 37204f2..4567039 100644
--- a/sim/msp430/ChangeLog
+++ b/sim/msp430/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/msp430/sim-main.h b/sim/msp430/sim-main.h
index d71217e..73f4680 100644
--- a/sim/msp430/sim-main.h
+++ b/sim/msp430/sim-main.h
@@ -54,9 +54,6 @@ struct sim_state
 #define MSP430_CPU(sd)       (STATE_CPU ((sd), 0))
 #define MSP430_CPU_STATE(sd) (MSP430_CPU ((sd)->state))
 
-#define CIA_GET(CPU)     ((CPU)->state.regs[0] + 0)
-#define CIA_SET(CPU,VAL) ((CPU)->state.regs[0] = (VAL))
-
 #include "sim-config.h"
 #include "sim-types.h"
 #include "sim-engine.h"
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index fc359ed..472597e 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,5 +1,9 @@
 2015-04-17  Mike Frysinger  <vapier@gentoo.org>
 
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
 	* interp.c (sh_pc_get, sh_pc_set): New functions.
 	(sim_open): Call CPU_PC_FETCH & CPU_PC_STORE for all cpus.
 
diff --git a/sim/sh/sim-main.h b/sim/sh/sim-main.h
index 3ae5f0f..405f1cb 100644
--- a/sim/sh/sim-main.h
+++ b/sim/sh/sim-main.h
@@ -23,9 +23,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 typedef address_word sim_cia;
 
-#define CIA_GET(cpu)     saved_state.asregs.pc
-#define CIA_SET(cpu,val) saved_state.asregs.pc = (val)
-
 typedef struct _sim_cpu SIM_CPU;
 
 #include "sim-base.h"
diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog
index 7146868..45b8d3f 100644
--- a/sim/sh64/ChangeLog
+++ b/sim/sh64/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/sh64/sim-main.h b/sim/sh64/sim-main.h
index b988e8e..99f0406 100644
--- a/sim/sh64/sim-main.h
+++ b/sim/sh64/sim-main.h
@@ -22,9 +22,6 @@ typedef struct _sim_cpu SIM_CPU;
 /* These must be defined before sim-base.h.  */
 typedef UDI sim_cia;
 
-#define CIA_GET(cpu)     CPU_PC_GET (cpu)
-#define CIA_SET(cpu,val) CPU_PC_SET ((cpu), (val) | (sh64_h_ism_get (cpu)))
-
 #include "sim-base.h"
 #include "cgen-sim.h"
 #include "sh64-sim.h"
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index bcc9bd5..dc3f38f 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h (CIA_GET, CIA_SET): Delete.
+
 2015-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-cpu.o.
diff --git a/sim/v850/sim-main.h b/sim/v850/sim-main.h
index 0a02565..acdf1d7 100644
--- a/sim/v850/sim-main.h
+++ b/sim/v850/sim-main.h
@@ -61,9 +61,6 @@ struct _sim_cpu
   sim_cpu_base base;
 };
 
-#define CIA_GET(CPU) ((CPU)->reg.pc + 0)
-#define CIA_SET(CPU,VAL) ((CPU)->reg.pc = (VAL))
-
 struct sim_state {
   sim_cpu *cpu[MAX_NR_PROCESSORS];
 #if 0
-- 
2.3.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]