aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-base.h
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>1997-05-01 18:05:37 +0000
committerDavid Edelsohn <dje.gcc@gmail.com>1997-05-01 18:05:37 +0000
commitc967f1874a9a38bdc0040f218b6905f4987ab600 (patch)
tree9ce497975c88d89234605916e6013936afebd153 /sim/common/sim-base.h
parent2c8f0de695ce97cd6c09eca707e1a216c8b69943 (diff)
downloadgdb-c967f1874a9a38bdc0040f218b6905f4987ab600.zip
gdb-c967f1874a9a38bdc0040f218b6905f4987ab600.tar.gz
gdb-c967f1874a9a38bdc0040f218b6905f4987ab600.tar.bz2
* Makefile.in (sim-options_h): Define.
(sim-{module,options,trace,profile,utils}.o): Clean up dependencies. (sim-model.o): Add new rule. (cgen-{scache,trace,utils}.o): Add new rules. * aclocal.m4 (SIM_AC_OPTION_{SCACHE,DEFAULT_MODEL}): Add. * cgen-scache.c (scache_print_profile): Change `sd' arg to `cpu'. Indent output by 2 spaces. * cgen-scache.h (scache_print_profile): Update. * cgen-trace.c (trace_insn_fini): Indent output by 2 spaces. Use trace_printf, not fprintf. (trace_extract): Use trace_printf, not cgen_trace_printf. * genmloop.sh (!FAST case): Increment `insn_count'. * sim-base.h (sim_state_base): Only include scache_size if WITH_SCACHE. (sim_cpu_base): Rename member `sd' to `state' to be consistent with access macro's name. * sim-core.c (sim_core_init): Use EXTERN_SIM_CORE to define it. Change return type to SIM_RC. (sim_core_{install,uninstall}): New functions. * sim-core.h (sim_core_{install,uninstall}): Declare. (sim_core_init): Use EXTERN_SIM_CORE to define it. Change return type to SIM_RC. * sim-model.h (models,machs,model_install): Declare. * sim-module.c (modules): Add scache_install, model_install. (sim_post_argv_init): Set cpu->state backlinks. * sim-options.c (standard_options): Delete --simcache-size,--max-insns. (standard_option_handler): Likewise. * sim-profile.c (PROFILE_{HISTOGRAM,LABEL}_WIDTH): Move to sim-profile.h. (*): Assume ANSI C. (profile_options): Delete --profile-simcache. (profile_option_handler): Likewise. (profile_print_insn): Change `sd' arg to `cpu'. Indent output 2 spaces. (profile_print_{memory,model}): Likewise. (profile_print_simcache): Delete. (profile_print_speed): New function. (profile_print): Rewrite. * sim-profile.h (PROFILE_scache): Renamed from PROFILE_simcache. (WITH_PROFILE_SCACHE_P): Renamed from WITH_PROFILE_SIMCACHE_P. (PROFILE_DATA): Delete members simcache_{hits,misses}. (PROFILE_COUNT_SIMCACHE_{HIT,MISS}): Delete. (PROFILE_{CALLBACK,CPU_CALLBACK}): New types. (profile_print): Update prototype.
Diffstat (limited to 'sim/common/sim-base.h')
-rw-r--r--sim/common/sim-base.h85
1 files changed, 25 insertions, 60 deletions
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
index 8b1ac93..c89070d 100644
--- a/sim/common/sim-base.h
+++ b/sim/common/sim-base.h
@@ -57,7 +57,7 @@ extern struct sim_state *current_state;
for a single processor or
struct sim_state {
- sim_cpu cpu[MAX_CPUS]; -- could be also be array of pointers
+ sim_cpu cpu[MAX_NR_PROCESSORS]; -- could be also be array of pointers
#define STATE_CPU(sd,n) (&(sd)->cpu[n])
... simulator specific members ...
sim_state_base base;
@@ -94,6 +94,18 @@ typedef struct {
#define STATE_CONFIG(sd) ((sd)->base.config)
#endif
+ /* List of installed module `init' handlers. */
+ MODULE_INIT_LIST *init_list;
+#define STATE_INIT_LIST(sd) ((sd)->base.init_list)
+ /* List of installed module `uninstall' handlers. */
+ MODULE_UNINSTALL_LIST *uninstall_list;
+#define STATE_UNINSTALL_LIST(sd) ((sd)->base.uninstall_list)
+
+ /* ??? This might be more appropriate in sim_cpu. */
+ /* Machine tables for this cpu. See sim-model.h. */
+ const MODEL *model;
+#define STATE_MODEL(sd) ((sd)->base.model)
+
/* Supported options. */
struct option_list *options;
#define STATE_OPTIONS(sd) ((sd)->base.options)
@@ -123,11 +135,13 @@ typedef struct {
SIM_ADDR start_addr;
#define STATE_START_ADDR(sd) ((sd)->base.start_addr)
+#if WITH_SCACHE
/* 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 simcache_size;
-#define STATE_SIMCACHE_SIZE(sd) ((sd)->base.simcache_size)
+ unsigned int scache_size;
+#define STATE_SCACHE_SIZE(sd) ((sd)->base.scache_size)
+#endif
/* FIXME: Move to top level sim_state struct (as some struct)? */
#ifdef SIM_HAVE_FLATMEM
@@ -149,34 +163,12 @@ typedef struct {
typedef struct {
/* Backlink to main state struct. */
- SIM_DESC sd;
-#define CPU_STATE(cpu) ((cpu)->base.sd)
-
- /* Maximum number of traceable entities. */
-#ifndef MAX_TRACE_VALUES
-#define MAX_TRACE_VALUES 12
-#endif
+ SIM_DESC state;
+#define CPU_STATE(cpu) ((cpu)->base.state)
- /* Boolean array of specified tracing flags. */
- /* ??? It's not clear that using an array vs a bit mask is faster.
- Consider the case where one wants to test whether any of several bits
- are set. */
- char trace_flags[MAX_TRACE_VALUES];
-#define CPU_TRACE_FLAGS(cpu) ((cpu)->base.trace_flags)
- /* Standard values. */
-#define TRACE_INSN_IDX 0
-#define TRACE_DECODE_IDX 1
-#define TRACE_EXTRACT_IDX 2
-#define TRACE_LINENUM_IDX 3
-#define TRACE_MEMORY_IDX 4
-#define TRACE_MODEL_IDX 5
-#define TRACE_ALU_IDX 6
-#define TRACE_NEXT_IDX 8 /* simulator specific trace bits begin here */
-
- /* Tracing output goes to this or stdout if NULL.
- We can't store `stdout' here as stdout goes through a callback. */
- FILE *trace_file;
-#define CPU_TRACE_FILE(cpu) ((cpu)->base.trace_file)
+ /* Trace data. See sim-trace.h. */
+ TRACE_DATA trace_data;
+#define CPU_TRACE_DATA(cpu) (& (cpu)->base.trace_data)
/* Maximum number of debuggable entities.
This debugging is not intended for normal use.
@@ -198,36 +190,9 @@ typedef struct {
FILE *debug_file;
#define CPU_DEBUG_FILE(cpu) ((cpu)->base.debug_file)
-#ifdef SIM_HAVE_PROFILE
- /* Maximum number of profilable entities. */
-#ifndef MAX_PROFILE_VALUES
-#define MAX_PROFILE_VALUES 8
-#endif
-
- /* Boolean array of specified profiling flags. */
- char profile_flags[MAX_PROFILE_VALUES];
-#define CPU_PROFILE_FLAGS(cpu) ((cpu)->base.profile_flags)
- /* Standard masks. */
-#define PROFILE_INSN_MASK 0
-#define PROFILE_MEMORY_MASK 1
-#define PROFILE_MODEL_MASK 2
-#define PROFILE_SIMCACHE_MASK 3
-#define PROFILE_NEXT_MASK 6 /* simulator specific profile bits begin here */
-
- /* PC profiling attempts to determine function usage by sampling the PC
- every so many instructions. */
-#ifdef SIM_HAVE_PROFILE_PC
- unsigned int profile_pc_freq;
-#define STATE_PROFILE_PC_FREQ(sd) ((sd)->base.profile_pc_freq)
- unsigned int profile_pc_size;
-#define STATE_PROFILE_PC_SIZE(sd) ((sd)->base.profile_pc_size)
-#endif
-
- /* Profile output goes to this or stdout if NULL.
- We can't store `stderr' here as stdout goes through a callback. */
- FILE *profile_file;
-#define CPU_PROFILE_FILE(cpu) ((cpu)->base.profile_file)
-#endif /* SIM_HAVE_PROFILE */
+ /* Profile data. See sim-profile.h. */
+ PROFILE_DATA profile_data;
+#define CPU_PROFILE_DATA(cpu) (& (cpu)->base.profile_data)
} sim_cpu_base;
/* Functions for allocating/freeing a sim_state. */