aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-12-25 04:12:55 -0500
committerMike Frysinger <vapier@gentoo.org>2015-12-25 04:24:06 -0500
commit8a0ebee658862bec66191df192c1d3b09bf0c943 (patch)
tree4e714c457a1130fcbb2b2f79f26c23ebd0db77d5 /sim/common
parent91d6df784db745df2b0a6827de8306246083bc94 (diff)
downloadgdb-8a0ebee658862bec66191df192c1d3b09bf0c943.zip
gdb-8a0ebee658862bec66191df192c1d3b09bf0c943.tar.gz
gdb-8a0ebee658862bec66191df192c1d3b09bf0c943.tar.bz2
sim: move MACH/MODEL types into SIM_xxx namespace
The "MACH" and "MODEL" names are a bit generic and collide with symbols used by other sections of code (like h8300's opcodes). Since these are sim-specific types, they really should have a "SIM_" prefix.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog7
-rw-r--r--sim/common/sim-cpu.h4
-rw-r--r--sim/common/sim-model.c30
-rw-r--r--sim/common/sim-model.h20
4 files changed, 34 insertions, 27 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 52931d8..e36895a 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,12 @@
2015-12-25 Mike Frysinger <vapier@gentoo.org>
+ * sim-cpu.h: Rename MACH to SIM_MACH and MODEL to SIM_MODEL.
+ * sim-model.c: Likewise.
+ * sim-model.h: Likewise. Rename MACH_IMP_PROPERTIES to
+ SIM_MACH_IMP_PROPERTIES
+
+2015-12-25 Mike Frysinger <vapier@gentoo.org>
+
* sim-core.c (device_error): Delete.
(sim_core_map_attach): Delete calls to device_error.
(sim_core_attach): Likewise.
diff --git a/sim/common/sim-cpu.h b/sim/common/sim-cpu.h
index 18b9dc7..20838e8 100644
--- a/sim/common/sim-cpu.h
+++ b/sim/common/sim-cpu.h
@@ -102,10 +102,10 @@ typedef struct {
#ifdef SIM_HAVE_MODEL
/* Machine tables for this cpu. See sim-model.h. */
- const MACH *mach;
+ const SIM_MACH *mach;
#define CPU_MACH(cpu) ((cpu)->base.mach)
/* The selected model. */
- const MODEL *model;
+ const SIM_MODEL *model;
#define CPU_MODEL(cpu) ((cpu)->base.model)
/* Model data (profiling state, etc.). */
void *model_data;
diff --git a/sim/common/sim-model.c b/sim/common/sim-model.c
index db5f323..0d0c28d 100644
--- a/sim/common/sim-model.c
+++ b/sim/common/sim-model.c
@@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-assert.h"
#include "bfd.h"
-static void model_set (sim_cpu *, const MODEL *);
+static void model_set (sim_cpu *, const SIM_MODEL *);
static DECLARE_OPTION_HANDLER (model_option_handler);
@@ -59,7 +59,7 @@ model_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
{
case OPTION_MODEL :
{
- const MODEL *model = sim_model_lookup (arg);
+ const SIM_MODEL *model = sim_model_lookup (arg);
if (! model)
{
sim_io_eprintf (sd, "unknown model `%s'\n", arg);
@@ -71,8 +71,8 @@ model_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
case OPTION_MODEL_INFO :
{
- const MACH **machp;
- const MODEL *model;
+ const SIM_MACH **machp;
+ const SIM_MODEL *model;
for (machp = & sim_machs[0]; *machp != NULL; ++machp)
{
sim_io_printf (sd, "Models for architecture `%s':\n",
@@ -103,7 +103,7 @@ sim_model_install (SIM_DESC sd)
/* Subroutine of sim_model_set to set the model for one cpu. */
static void
-model_set (sim_cpu *cpu, const MODEL *model)
+model_set (sim_cpu *cpu, const SIM_MODEL *model)
{
CPU_MACH (cpu) = MODEL_MACH (model);
CPU_MODEL (cpu) = model;
@@ -115,7 +115,7 @@ model_set (sim_cpu *cpu, const MODEL *model)
If CPU is NULL, all cpus are set to MODEL. */
void
-sim_model_set (SIM_DESC sd, sim_cpu *cpu, const MODEL *model)
+sim_model_set (SIM_DESC sd, sim_cpu *cpu, const SIM_MODEL *model)
{
if (! cpu)
{
@@ -134,11 +134,11 @@ sim_model_set (SIM_DESC sd, sim_cpu *cpu, const MODEL *model)
/* Look up model named NAME.
Result is pointer to MODEL entry or NULL if not found. */
-const MODEL *
+const SIM_MODEL *
sim_model_lookup (const char *name)
{
- const MACH **machp;
- const MODEL *model;
+ const SIM_MACH **machp;
+ const SIM_MODEL *model;
for (machp = & sim_machs[0]; *machp != NULL; ++machp)
{
@@ -154,10 +154,10 @@ sim_model_lookup (const char *name)
/* Look up machine named NAME.
Result is pointer to MACH entry or NULL if not found. */
-const MACH *
+const SIM_MACH *
sim_mach_lookup (const char *name)
{
- const MACH **machp;
+ const SIM_MACH **machp;
for (machp = & sim_machs[0]; *machp != NULL; ++machp)
{
@@ -170,10 +170,10 @@ sim_mach_lookup (const char *name)
/* Look up a machine via its bfd name.
Result is pointer to MACH entry or NULL if not found. */
-const MACH *
+const SIM_MACH *
sim_mach_lookup_bfd_name (const char *name)
{
- const MACH **machp;
+ const SIM_MACH **machp;
for (machp = & sim_machs[0]; *machp != NULL; ++machp)
{
@@ -203,7 +203,7 @@ sim_model_init (SIM_DESC sd)
&& ! CPU_MACH (cpu))
{
/* Set the default model. */
- const MODEL *model = sim_model_lookup (WITH_DEFAULT_MODEL);
+ const SIM_MODEL *model = sim_model_lookup (WITH_DEFAULT_MODEL);
SIM_ASSERT (model != NULL);
sim_model_set (sd, NULL, model);
}
@@ -224,7 +224,7 @@ sim_model_init (SIM_DESC sd)
{
/* Use the default model for the selected machine.
The default model is the first one in the list. */
- const MACH *mach = sim_mach_lookup_bfd_name (STATE_ARCHITECTURE (sd)->printable_name);
+ const SIM_MACH *mach = sim_mach_lookup_bfd_name (STATE_ARCHITECTURE (sd)->printable_name);
if (mach == NULL)
{
diff --git a/sim/common/sim-model.h b/sim/common/sim-model.h
index d3323b5..5baa5ce 100644
--- a/sim/common/sim-model.h
+++ b/sim/common/sim-model.h
@@ -68,7 +68,7 @@ typedef struct {
This is zero if the SCACHE isn't in use for this variant. */
int scache_elm_size;
#define IMP_PROPS_SCACHE_ELM_SIZE(cpu_props) ((cpu_props)->scache_elm_size)
-} MACH_IMP_PROPERTIES;
+} SIM_MACH_IMP_PROPERTIES;
/* A machine variant. */
@@ -92,7 +92,7 @@ typedef struct {
#define MACH_MODELS(m) ((m)->models)
/* Pointer to the implementation properties of this mach. */
- const MACH_IMP_PROPERTIES *imp_props;
+ const SIM_MACH_IMP_PROPERTIES *imp_props;
#define MACH_IMP_PROPS(m) ((m)->imp_props)
/* Called by sim_model_set when the model of a cpu is set. */
@@ -103,14 +103,14 @@ typedef struct {
Used by cgen simulators to initialize the insn descriptor table. */
void (* prepare_run) (sim_cpu *);
#define MACH_PREPARE_RUN(m) ((m)->prepare_run)
-} MACH;
+} SIM_MACH;
/* A model (implementation) of a machine. */
typedef struct model {
const char *name;
#define MODEL_NAME(m) ((m)->name)
- const MACH *mach;
+ const SIM_MACH *mach;
#define MODEL_MACH(m) ((m)->mach)
/* An enum that distinguished the model. */
int num;
@@ -120,21 +120,21 @@ typedef struct model {
#define MODEL_TIMING(m) ((m)->timing)
void (* init) (sim_cpu *);
#define MODEL_INIT(m) ((m)->init)
-} MODEL;
+} SIM_MODEL;
/* Tables of supported machines. */
/* ??? In a simulator of multiple architectures, will need multiple copies of
this. Have an `archs' array that contains a pointer to the machs array
for each (which in turn has a pointer to the models array for each). */
-extern const MACH *sim_machs[];
+extern const SIM_MACH *sim_machs[];
/* Model module handlers. */
extern MODULE_INSTALL_FN sim_model_install;
/* Support routines. */
-extern void sim_model_set (SIM_DESC sd_, sim_cpu *cpu_, const MODEL *model_);
-extern const MODEL * sim_model_lookup (const char *name_);
-extern const MACH * sim_mach_lookup (const char *name_);
-extern const MACH * sim_mach_lookup_bfd_name (const char *bfd_name_);
+extern void sim_model_set (SIM_DESC sd_, sim_cpu *cpu_, const SIM_MODEL *model_);
+extern const SIM_MODEL *sim_model_lookup (const char *name_);
+extern const SIM_MACH *sim_mach_lookup (const char *name_);
+extern const SIM_MACH *sim_mach_lookup_bfd_name (const char *bfd_name_);
#endif /* SIM_MODEL_H */