]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/m32r/sim-main.h
Revert last commit, build problems.
[thirdparty/binutils-gdb.git] / sim / m32r / sim-main.h
index c507dcc672043d74bd50f967c341f70dcf08d6c5..efd1e91fbe7dbaf893aa0ba21f89e0fbf7765970 100644 (file)
@@ -1,74 +1,69 @@
+
 /* Main header for the m32r.  */
 
+#ifndef SIM_MAIN_H
+#define SIM_MAIN_H
+
 #define USING_SIM_BASE_H /* FIXME: quick hack */
 
 struct _sim_cpu; /* FIXME: should be in sim-basics.h */
 typedef struct _sim_cpu SIM_CPU;
 
-/* sim-basics.h includes config.h but cgen-types.h must be included before
-   sim-basics.h and cgen-types.h needs config.h.  */
-#include "config.h"
-
+#include "symcat.h"
+#include "sim-basics.h"
 #include "cgen-types.h"
+#include "m32r-desc.h"
+#include "m32r-opc.h"
 #include "arch.h"
-#include "sim-basics.h"
 
 /* These must be defined before sim-base.h.  */
-typedef SI sim_cia;
+typedef USI sim_cia;
+
+#define CIA_GET(cpu)     CPU_PC_GET (cpu)
+#define CIA_SET(cpu,val) CPU_PC_SET ((cpu), (val))
 
-/* FIXME: Shouldn't be required to define these this early.  */
-#define SIM_ENGINE_HALT_HOOK(SD, LAST_CPU, CIA)
-#define SIM_ENGINE_RESTART_HOOK(SD, LAST_CPU, CIA)
+#define SIM_ENGINE_HALT_HOOK(sd, cpu, cia) \
+do { \
+  if (cpu) /* null if ctrl-c */ \
+    sim_pc_set ((cpu), (cia)); \
+} while (0)
+#define SIM_ENGINE_RESTART_HOOK(sd, cpu, cia) \
+do { \
+  sim_pc_set ((cpu), (cia)); \
+} while (0)
 
 #include "sim-base.h"
 #include "cgen-sim.h"
-/*#include "cgen-mem.h"*/
-#include "cgen-trace.h"
-#include "cpu-opc.h" /* Needed for INSN_NAME.  */
-#include "cpu-sim.h"
-
-#ifdef WANT_CPU_M32R
-#include "cpu.h"
-#include "decode.h"
-#endif
-/* start-sanitize-m32rx */
-#ifdef WANT_CPU_M32RX
-#include "cpux.h"
-#include "decodex.h"
-#endif
-/* end-sanitize-m32rx */
-#include "cpuall.h"
-
-/* Misc. profile data.  */
-typedef struct {
-  /* nop insn slot filler count */
-  unsigned int fillnop_count;
-} M32R_MISC_PROFILE;
+#include "m32r-sim.h"
+#include "opcode/cgen.h"
+\f
+/* The _sim_cpu struct.  */
 
 struct _sim_cpu {
+  /* sim/common cpu base.  */
   sim_cpu_base base;
 
   /* Static parts of cgen.  */
   CGEN_CPU cgen_cpu;
 
+  M32R_MISC_PROFILE m32r_misc_profile;
+#define CPU_M32R_MISC_PROFILE(cpu) (& (cpu)->m32r_misc_profile)
+
   /* CPU specific parts go here.
      Note that in files that don't need to access these pieces WANT_CPU_FOO
-     won't be defined and thus these parts won't appear.  This is ok.
+     won't be defined and thus these parts won't appear.  This is ok in the
+     sense that things work.  It is a source of bugs though.
      One has to of course be careful to not take the size of this
-     struct, etc.  */
-#if defined (WANT_CPU_M32R)
-  M32R_CPU_DATA cpu_data;
-/* start-sanitize-m32rx */
-#elif defined (WANT_CPU_M32RX)
-  M32RX_CPU_DATA cpu_data;
-  PARALLEL_EXEC par_exec;
-#define CPU_PAR_EXEC(cpu) (& (cpu)->par_exec)
-/* end-sanitize-m32rx */
+     struct and no structure members accessed in non-cpu specific files can
+     go after here.  Oh for a better language.  */
+#if defined (WANT_CPU_M32RBF)
+  M32RBF_CPU_DATA cpu_data;
+#elif defined (WANT_CPU_M32RXF)
+  M32RXF_CPU_DATA cpu_data;
 #endif
-
-  M32R_MISC_PROFILE m32r_misc_profile;
-#define CPU_M32R_MISC_PROFILE(cpu) ((cpu)->m32r_misc_profile)
 };
+\f
+/* The sim_state struct.  */
 
 struct sim_state {
   sim_cpu *cpu;
@@ -78,6 +73,16 @@ struct sim_state {
 
   sim_state_base base;
 };
+\f
+/* Misc.  */
+
+/* Catch address exceptions.  */
+extern SIM_CORE_SIGNAL_FN m32r_core_signal;
+#define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \
+m32r_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \
+                 (TRANSFER), (ERROR))
 
 /* Default memory size.  */
 #define M32R_DEFAULT_MEM_SIZE 0x800000 /* 8M */
+
+#endif /* SIM_MAIN_H */