From 85d93de3d8e24b54516ece8ec95ab09e6786e102 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 21 Jan 2016 21:05:33 -0500 Subject: [PATCH] sim: bfin: invert sim_state storage --- sim/bfin/ChangeLog | 7 +++++++ sim/bfin/interp.c | 3 ++- sim/bfin/sim-main.h | 11 +++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog index c9b64b11f42..d5c55e07f45 100644 --- a/sim/bfin/ChangeLog +++ b/sim/bfin/ChangeLog @@ -1,3 +1,10 @@ +2021-05-17 Mike Frysinger + + * 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 * bfin-sim.c, devices.c, dv-bfin_cec.c, dv-bfin_ctimer.c, diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c index 8e3a1214b78..34357201934 100644 --- a/sim/bfin/interp.c +++ b/sim/bfin/interp.c @@ -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) diff --git a/sim/bfin/sim-main.h b/sim/bfin/sim-main.h index a09ea496189..855a178bc4b 100644 --- a/sim/bfin/sim-main.h +++ b/sim/bfin/sim-main.h @@ -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" -- 2.30.2