aboutsummaryrefslogtreecommitdiff
path: root/sim/mn10300
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-04-16 02:11:12 -0400
committerMike Frysinger <vapier@gentoo.org>2015-04-17 02:44:30 -0400
commit034685f9ce92cf6dfb6656745365b6a5904a8e84 (patch)
treec4b591263048d0a9d89af68c9abd8e69786ed2f7 /sim/mn10300
parent27b97b40bca216097d16d53fa9408a70cd281479 (diff)
downloadgdb-034685f9ce92cf6dfb6656745365b6a5904a8e84.zip
gdb-034685f9ce92cf6dfb6656745365b6a5904a8e84.tar.gz
gdb-034685f9ce92cf6dfb6656745365b6a5904a8e84.tar.bz2
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.
Diffstat (limited to 'sim/mn10300')
-rw-r--r--sim/mn10300/ChangeLog12
-rw-r--r--sim/mn10300/dv-mn103cpu.c12
-rw-r--r--sim/mn10300/interp.c12
-rw-r--r--sim/mn10300/sim-main.h3
4 files changed, 24 insertions, 15 deletions
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;