sim: bfin: invert sim_state storage
authorMike Frysinger <vapier@gentoo.org>
Fri, 22 Jan 2016 02:05:33 +0000 (21:05 -0500)
committerMike Frysinger <vapier@gentoo.org>
Mon, 17 May 2021 04:43:45 +0000 (00:43 -0400)
sim/bfin/ChangeLog
sim/bfin/interp.c
sim/bfin/sim-main.h

index c9b64b11f4251e38f406a0ec84b90fd73dc9d325..d5c55e07f453b71a7d2fd7cb21f53be56fc0182d 100644 (file)
@@ -1,3 +1,10 @@
+2021-05-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * interp.c (sim_open): Call sim_state_alloc_extra.
+       * sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Define.
+       (struct sim_state): Delete.
+       (STATE_BOARD_DATA): Define.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
        * bfin-sim.c, devices.c, dv-bfin_cec.c, dv-bfin_ctimer.c,
index 8e3a1214b7861669cec0e5fefad77177957e6a20..34357201934c92138167cbdbb770357511a5a816 100644 (file)
@@ -717,7 +717,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
 {
   char c;
   int i;
-  SIM_DESC sd = sim_state_alloc (kind, callback);
+  SIM_DESC sd = sim_state_alloc_extra (kind, callback,
+                                      sizeof (struct bfin_board_data));
 
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
index a09ea4961898f64148ac63df66bb56a3f96d285a..855a178bc4b43514d9e5cedb70ef3e3806e3af3a 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef _BFIN_MAIN_SIM_H_
 #define _BFIN_MAIN_SIM_H_
 
+#define SIM_HAVE_COMMON_SIM_STATE
+
 #include "sim-basics.h"
 #include "sim-signal.h"
 #include "arch.h"
@@ -37,14 +39,7 @@ struct _sim_cpu {
 };
 #define BFIN_CPU_STATE ((cpu)->state)
 
-struct sim_state {
-  sim_cpu *cpu[MAX_NR_PROCESSORS];
-
-  /* ... simulator specific members ... */
-  struct bfin_board_data board;
-#define STATE_BOARD_DATA(sd) (&(sd)->board)
-  sim_state_base base;
-};
+#define STATE_BOARD_DATA(sd) ((struct bfin_board_data *) STATE_ARCH_DATA (sd))
 
 #include "sim-config.h"
 #include "sim-types.h"