sim: m68hc11/mn10300/v850: delete redundant INLINE defines
[deliverable/binutils-gdb.git] / sim / mn10300 / interp.c
index 577cc7a0d00b8359f29bfaf4942fde2ff905e669..e5a90b546a0631d9df36daf2bae7d8a54a889669 100644 (file)
 
 #include "bfd.h"
 
-#ifndef INLINE
-#ifdef __GNUC__
-#define INLINE inline
-#else
-#define INLINE
-#endif
-#endif
-
 
 host_callback *mn10300_callback;
 int mn10300_debug;
@@ -84,6 +76,18 @@ static const OPTION mn10300_options[] =
 /* For compatibility */
 SIM_DESC simulator;
 
+static sim_cia
+mn10300_pc_get (sim_cpu *cpu)
+{
+  return PC;
+}
+
+static void
+mn10300_pc_set (sim_cpu *cpu, sim_cia pc)
+{
+  PC = pc;
+}
+
 /* These default values correspond to expected usage for the chip.  */
 
 SIM_DESC
@@ -92,11 +96,16 @@ sim_open (SIM_OPEN_KIND kind,
          struct bfd *abfd,
          char **argv)
 {
+  int i;
   SIM_DESC sd = sim_state_alloc (kind, cb);
   mn10300_callback = cb;
 
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* The cpu data is kept in a separately allocated chunk of memory.  */
+  if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK)
+    return 0;
+
   /* for compatibility */
   simulator = sd;
 
@@ -297,6 +306,15 @@ sim_open (SIM_OPEN_KIND kind,
 /*   STATE_CPU (sd, 0)->psw_mask = (PSW_NP | PSW_EP | PSW_ID | PSW_SAT */
 /*                          | PSW_CY | PSW_OV | PSW_S | PSW_Z); */
 
+  /* CPU specific initialization.  */
+  for (i = 0; i < MAX_NR_PROCESSORS; ++i)
+    {
+      SIM_CPU *cpu = STATE_CPU (sd, i);
+
+      CPU_PC_FETCH (cpu) = mn10300_pc_get;
+      CPU_PC_STORE (cpu) = mn10300_pc_set;
+    }
+
   return sd;
 }
 
@@ -320,7 +338,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;
@@ -396,7 +414,6 @@ sim_store_register (SIM_DESC sd,
   return length;
 }
 
-
 void
 mn10300_core_signal (SIM_DESC sd,
                     sim_cpu *cpu,
@@ -457,7 +474,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
@@ -471,7 +488,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);
@@ -486,7 +503,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;
 }
@@ -502,7 +519,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;
 }
 
@@ -524,7 +541,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)
     {
This page took 0.024632 seconds and 4 git commands to generate.