summaryrefslogtreecommitdiff
path: root/sim/common/sim-base.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-01-21 22:51:00 -0500
committerMike Frysinger <vapier@gentoo.org>2021-05-17 01:05:08 -0400
commitf4fdd84587e80bc6e327b89b162504d306933609 (patch)
tree0bd611dd57279a85db41fea9503d7fa6e427ae7e /sim/common/sim-base.h
parent10c23a2c6fec069ef8279fc19f625348da70cd0d (diff)
downloadbinutils-gdb-f4fdd84587e80bc6e327b89b162504d306933609.tar.gz
sim: fully merge sim_state_base into sim_state
Now that all ports have migrated to the new framework, drop support for the old sim_state_base layout.
Diffstat (limited to 'sim/common/sim-base.h')
-rw-r--r--sim/common/sim-base.h88
1 files changed, 37 insertions, 51 deletions
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
index e552d94d02c..7dbf2943385 100644
--- a/sim/common/sim-base.h
+++ b/sim/common/sim-base.h
@@ -90,147 +90,127 @@ typedef struct _sim_cpu sim_cpu;
#ifdef CGEN_ARCH
# include "cgen-sim.h"
-# define SIM_HAVE_COMMON_SIM_STATE
#endif
-/* We require all sims to dynamically allocate cpus. See comment up top about
- struct sim_state. */
+struct sim_state {
+ /* All the cpus for this instance. */
+ sim_cpu *cpu[MAX_NR_PROCESSORS];
#if (WITH_SMP)
# define STATE_CPU(sd, n) ((sd)->cpu[n])
#else
# define STATE_CPU(sd, n) ((sd)->cpu[0])
#endif
-
-typedef struct {
-
/* Simulator's argv[0]. */
const char *my_name;
-#define STATE_MY_NAME(sd) ((sd)->base.my_name)
+#define STATE_MY_NAME(sd) ((sd)->my_name)
/* Who opened the simulator. */
SIM_OPEN_KIND open_kind;
-#define STATE_OPEN_KIND(sd) ((sd)->base.open_kind)
+#define STATE_OPEN_KIND(sd) ((sd)->open_kind)
/* The host callbacks. */
struct host_callback_struct *callback;
-#define STATE_CALLBACK(sd) ((sd)->base.callback)
+#define STATE_CALLBACK(sd) ((sd)->callback)
/* The type of simulation environment (user/operating). */
enum sim_environment environment;
-#define STATE_ENVIRONMENT(sd) ((sd)->base.environment)
+#define STATE_ENVIRONMENT(sd) ((sd)->environment)
#if 0 /* FIXME: Not ready yet. */
/* Stuff defined in sim-config.h. */
struct sim_config config;
-#define STATE_CONFIG(sd) ((sd)->base.config)
+#define STATE_CONFIG(sd) ((sd)->config)
#endif
/* List of installed module `init' handlers. */
struct module_list *modules;
-#define STATE_MODULES(sd) ((sd)->base.modules)
+#define STATE_MODULES(sd) ((sd)->modules)
/* Supported options. */
struct option_list *options;
-#define STATE_OPTIONS(sd) ((sd)->base.options)
+#define STATE_OPTIONS(sd) ((sd)->options)
/* Non-zero if -v specified. */
int verbose_p;
-#define STATE_VERBOSE_P(sd) ((sd)->base.verbose_p)
+#define STATE_VERBOSE_P(sd) ((sd)->verbose_p)
/* Non cpu-specific trace data. See sim-trace.h. */
TRACE_DATA trace_data;
-#define STATE_TRACE_DATA(sd) (& (sd)->base.trace_data)
+#define STATE_TRACE_DATA(sd) (& (sd)->trace_data)
/* If non NULL, the BFD architecture specified on the command line */
const struct bfd_arch_info *architecture;
-#define STATE_ARCHITECTURE(sd) ((sd)->base.architecture)
+#define STATE_ARCHITECTURE(sd) ((sd)->architecture)
/* If non NULL, the bfd target specified on the command line */
const char *target;
-#define STATE_TARGET(sd) ((sd)->base.target)
+#define STATE_TARGET(sd) ((sd)->target)
/* In standalone simulator, this is the program's arguments passed
on the command line. */
char **prog_argv;
-#define STATE_PROG_ARGV(sd) ((sd)->base.prog_argv)
+#define STATE_PROG_ARGV(sd) ((sd)->prog_argv)
/* The program's bfd. */
struct bfd *prog_bfd;
-#define STATE_PROG_BFD(sd) ((sd)->base.prog_bfd)
+#define STATE_PROG_BFD(sd) ((sd)->prog_bfd)
/* Symbol table for prog_bfd */
struct bfd_symbol **prog_syms;
-#define STATE_PROG_SYMS(sd) ((sd)->base.prog_syms)
+#define STATE_PROG_SYMS(sd) ((sd)->prog_syms)
/* Number of prog_syms symbols. */
long prog_syms_count;
-#define STATE_PROG_SYMS_COUNT(sd) ((sd)->base.prog_syms_count)
+#define STATE_PROG_SYMS_COUNT(sd) ((sd)->prog_syms_count)
/* The program's text section. */
struct bfd_section *text_section;
/* Starting and ending text section addresses from the bfd. */
bfd_vma text_start, text_end;
-#define STATE_TEXT_SECTION(sd) ((sd)->base.text_section)
-#define STATE_TEXT_START(sd) ((sd)->base.text_start)
-#define STATE_TEXT_END(sd) ((sd)->base.text_end)
+#define STATE_TEXT_SECTION(sd) ((sd)->text_section)
+#define STATE_TEXT_START(sd) ((sd)->text_start)
+#define STATE_TEXT_END(sd) ((sd)->text_end)
/* Start address, set when the program is loaded from the bfd. */
bfd_vma start_addr;
-#define STATE_START_ADDR(sd) ((sd)->base.start_addr)
+#define STATE_START_ADDR(sd) ((sd)->start_addr)
/* Size of the simulator's cache, if any.
This is not the target's cache. It is the cache the simulator uses
to process instructions. */
unsigned int scache_size;
-#define STATE_SCACHE_SIZE(sd) ((sd)->base.scache_size)
+#define STATE_SCACHE_SIZE(sd) ((sd)->scache_size)
/* core memory bus */
-#define STATE_CORE(sd) (&(sd)->base.core)
+#define STATE_CORE(sd) (&(sd)->core)
sim_core core;
/* Record of memory sections added via the memory-options interface. */
-#define STATE_MEMOPT(sd) ((sd)->base.memopt)
+#define STATE_MEMOPT(sd) ((sd)->memopt)
sim_memopt *memopt;
/* event handler */
-#define STATE_EVENTS(sd) (&(sd)->base.events)
+#define STATE_EVENTS(sd) (&(sd)->events)
sim_events events;
/* generic halt/resume engine */
sim_engine engine;
-#define STATE_ENGINE(sd) (&(sd)->base.engine)
+#define STATE_ENGINE(sd) (&(sd)->engine)
/* generic watchpoint support */
sim_watchpoints watchpoints;
-#define STATE_WATCHPOINTS(sd) (&(sd)->base.watchpoints)
+#define STATE_WATCHPOINTS(sd) (&(sd)->watchpoints)
#if WITH_HW
struct sim_hw *hw;
-#define STATE_HW(sd) ((sd)->base.hw)
+#define STATE_HW(sd) ((sd)->hw)
#endif
/* Should image loads be performed using the LMA or VMA? Older
simulators use the VMA while newer simulators prefer the LMA. */
int load_at_lma_p;
-#define STATE_LOAD_AT_LMA_P(SD) ((SD)->base.load_at_lma_p)
-
- /* Marker for those wanting to do sanity checks.
- This should remain the last member of this struct to help catch
- miscompilation errors. */
- int magic;
-#define SIM_MAGIC_NUMBER 0x4242
-#define STATE_MAGIC(sd) ((sd)->base.magic)
-} sim_state_base;
-
-#ifdef SIM_HAVE_COMMON_SIM_STATE
-/* TODO: Merge sim_state & sim_state_base. */
-struct sim_state {
- /* All the cpus for this instance. */
- sim_cpu *cpu[MAX_NR_PROCESSORS];
-
- /* All the common state. */
- sim_state_base base;
+#define STATE_LOAD_AT_LMA_P(SD) ((SD)->load_at_lma_p)
/* Pointer for sim target to store arbitrary state data. Normally the
target should define a struct and use it here. */
@@ -242,8 +222,14 @@ struct sim_state {
CGEN_STATE cgen_state;
#endif
#define STATE_CGEN_STATE(sd) ((sd)->cgen_state)
+
+ /* Marker for those wanting to do sanity checks.
+ This should remain the last member of this struct to help catch
+ miscompilation errors. */
+ int magic;
+#define SIM_MAGIC_NUMBER 0x4242
+#define STATE_MAGIC(sd) ((sd)->magic)
};
-#endif
/* Functions for allocating/freeing a sim_state. */
SIM_DESC sim_state_alloc_extra (SIM_OPEN_KIND kind, host_callback *callback,