sim: iq2000: invert sim_cpu storage
authorMike Frysinger <vapier@gentoo.org>
Tue, 1 Nov 2022 13:04:48 +0000 (18:49 +0545)
committerMike Frysinger <vapier@gentoo.org>
Wed, 21 Dec 2022 05:00:01 +0000 (00:00 -0500)
The cpu.h change is in generated cgen code, but that has been sent
upstream too, so the next regen should include it automatically.

sim/iq2000/cpu.h
sim/iq2000/sim-if.c
sim/iq2000/sim-main.h

index a204eeb0e350891c14b1cef188b04e0de62952da..0a9aa802f117bd5539d00fdc2e2c733468c1b34d 100644 (file)
@@ -61,7 +61,7 @@ CPU (h_gr[(index)]) = (x);\
 }\
 ;} while (0)
   } hardware;
-#define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
+#define CPU_CGEN_HW(cpu) (& IQ2000_SIM_CPU (cpu)->cpu_data.hardware)
 } IQ2000BF_CPU_DATA;
 
 /* Cover fns for register access.  */
index 34069f0a044bd5ec26389cc26be2fff59f62a8ce..1b1b3ac6e6153e5b6a4c212ab8161b78ed3080f7 100644 (file)
@@ -70,7 +70,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
   current_target_byte_order = BFD_ENDIAN_BIG;
 
   /* The cpu data is kept in a separately allocated chunk of memory.  */
-  if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
+  if (sim_cpu_alloc_all_extra (sd, 1, sizeof (struct iq2000_sim_cpu))
+      != SIM_RC_OK)
     {
       free_state (sd);
       return 0;
index bf060829088472979d27b4e227824433706f53ba..bb927fcf57c5ef65c58fd6443bd277b87bbdfad6 100644 (file)
@@ -4,6 +4,8 @@
 #ifndef SIM_MAIN_H
 #define SIM_MAIN_H
 
+#define SIM_HAVE_COMMON_SIM_CPU
+
 /* This is a global setting.  Different cpu families can't mix-n-match -scache
    and -pbb.  However some cpu families may use -simple while others use
    one of -scache/-pbb. ???? */
 #include "sim-base.h"
 #include "cgen-sim.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;
-
+struct iq2000_sim_cpu {
   /* 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 in the
@@ -42,6 +36,7 @@ struct _sim_cpu {
   IQ2000BF_CPU_DATA cpu_data;
 #endif
 };
+#define IQ2000_SIM_CPU(cpu) ((struct iq2000_sim_cpu *) CPU_ARCH_DATA (cpu))
 \f
 /* Misc.  */