X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Fcommon%2Fsim-base.h;h=f07ae52cb951455acd513941c545c89eb8f3e968;hb=160f8a8f32f5566077e4a4b13943bc7c70bc5da2;hp=0dae541094cd6e8b1d3c1c296598c3e727d1da78;hpb=78e9aa70febc3985a2c88dbc0c7a87d214231c3d;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h index 0dae541094..f07ae52cb9 100644 --- a/sim/common/sim-base.h +++ b/sim/common/sim-base.h @@ -1,6 +1,6 @@ /* Simulator pseudo baseclass. - Copyright 1997-2015 Free Software Foundation, Inc. + Copyright 1997-2020 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -28,9 +28,9 @@ along with this program. If not, see . */ information), include ``sim-base.h'': #include "sim-basics.h" - typedef address_word sim_cia; /-* If `sim_cia' is not an integral value (e.g. a struct), define CIA_ADDR to return the integral value. *-/ + /-* typedef struct {...} sim_cia; *-/ /-* #define CIA_ADDR(cia) (...) *-/ #include "sim-base.h" @@ -55,6 +55,10 @@ along with this program. If not, see . */ #ifndef SIM_BASE_H #define SIM_BASE_H +#ifdef __cplusplus +extern "C" { +#endif + /* Pre-declare certain types. */ /* typedef sim_cia; */ @@ -66,49 +70,30 @@ along with this program. If not, see . */ (e.g. for delay slot handling). */ #ifndef CIA_ADDR #define CIA_ADDR(cia) (cia) +typedef address_word sim_cia; #endif #ifndef INVALID_INSTRUCTION_ADDRESS #define INVALID_INSTRUCTION_ADDRESS ((address_word)0 - 1) #endif +/* TODO: Probably should just delete SIM_CPU. */ +typedef struct _sim_cpu SIM_CPU; typedef struct _sim_cpu sim_cpu; #include "sim-module.h" +#include "sim-arange.h" #include "sim-trace.h" #include "sim-core.h" #include "sim-events.h" #include "sim-profile.h" -#ifdef SIM_HAVE_MODEL #include "sim-model.h" -#endif #include "sim-io.h" #include "sim-engine.h" #include "sim-watch.h" #include "sim-memopt.h" #include "sim-cpu.h" - -/* Global pointer to current state while sim_resume is running. - On a machine with lots of registers, it might be possible to reserve - one of them for current_state. However on a machine with few registers - current_state can't permanently live in one and indirecting through it - will be slower [in which case one can have sim_resume set globals from - current_state for faster access]. - If CURRENT_STATE_REG is defined, it means current_state is living in - a global register. */ - - -#ifdef CURRENT_STATE_REG -/* FIXME: wip */ -#else -extern struct sim_state *current_state; -#endif - - -/* The simulator may provide different (and faster) definition. */ -#ifndef CURRENT_STATE -#define CURRENT_STATE current_state -#endif +#include "sim-assert.h" /* We require all sims to dynamically allocate cpus. See comment up top about @@ -181,6 +166,10 @@ typedef struct { struct bfd_symbol **prog_syms; #define STATE_PROG_SYMS(sd) ((sd)->base.prog_syms) + /* Number of prog_syms symbols. */ + long prog_syms_count; +#define STATE_PROG_SYMS_COUNT(sd) ((sd)->base.prog_syms_count) + /* The program's text section. */ struct bfd_section *text_section; /* Starting and ending text section addresses from the bfd. */ @@ -199,16 +188,6 @@ typedef struct { unsigned int scache_size; #define STATE_SCACHE_SIZE(sd) ((sd)->base.scache_size) - /* FIXME: Move to top level sim_state struct (as some struct)? */ -#ifdef SIM_HAVE_FLATMEM - unsigned int mem_size; -#define STATE_MEM_SIZE(sd) ((sd)->base.mem_size) - unsigned int mem_base; -#define STATE_MEM_BASE(sd) ((sd)->base.mem_base) - unsigned char *memory; -#define STATE_MEMORY(sd) ((sd)->base.memory) -#endif - /* core memory bus */ #define STATE_CORE(sd) (&(sd)->base.core) sim_core core; @@ -251,4 +230,8 @@ typedef struct { SIM_DESC sim_state_alloc (SIM_OPEN_KIND kind, host_callback *callback); void sim_state_free (SIM_DESC); +#ifdef __cplusplus +} +#endif + #endif /* SIM_BASE_H */