Fix TCL error in gdb.python/py-format-string.exp.
[deliverable/binutils-gdb.git] / sim / common / sim-model.h
index 52728152e14a27479ad1f4aadb059d5f8fab43a6..7e10e12a8f84a88290a377c5b18d9874960af954 100644 (file)
@@ -1,27 +1,31 @@
 /* Architecture, machine, and model support.
 /* Architecture, machine, and model support.
-   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997-2020 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Nomenclature:
    architecture = one of sparc, mips, sh, etc.
    in the sparc architecture, mach = one of v6, v7, v8, sparclite, etc.
    in the v8 mach, model = one of supersparc, etc.
 
 /* Nomenclature:
    architecture = one of sparc, mips, sh, etc.
    in the sparc architecture, mach = one of v6, v7, v8, sparclite, etc.
    in the v8 mach, model = one of supersparc, etc.
+
+   To use the model framework, your arch needs to do a few things:
+   (1) Call SIM_AC_OPTION_DEFAULT_MODEL() in configure.ac.
+   (2) Define enum mach_attr in sim-main.h.
+   (3) Define sim_machs array (and all the callbacks it uses).
 */
 
 /* This file is intended to be included by sim-basics.h.  */
 */
 
 /* This file is intended to be included by sim-basics.h.  */
@@ -43,6 +47,15 @@ typedef struct {
 #define MAX_UNITS 1
 #endif
 
 #define MAX_UNITS 1
 #endif
 
+#ifndef WITH_DEFAULT_MODEL
+/* Just a stub for ports that do not define models.  */
+enum mach_attr { _MACH_NONE };
+# define WITH_DEFAULT_MODEL NULL
+# define WITH_MODEL_P 0
+#else
+# define WITH_MODEL_P 1
+#endif
+
 typedef int (MODEL_FN) (sim_cpu *, void *);
 
 typedef struct {
 typedef int (MODEL_FN) (sim_cpu *, void *);
 
 typedef struct {
@@ -69,7 +82,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)
      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.  */
 
 
 /* A machine variant.  */
 
@@ -93,7 +106,7 @@ typedef struct {
 #define MACH_MODELS(m) ((m)->models)
 
   /* Pointer to the implementation properties of this mach.  */
 #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.  */
 #define MACH_IMP_PROPS(m) ((m)->imp_props)
 
   /* Called by sim_model_set when the model of a cpu is set.  */
@@ -104,14 +117,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)
      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)
 
 /* 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;
 #define MODEL_MACH(m) ((m)->mach)
   /* An enum that distinguished the model.  */
   int num;
@@ -121,21 +134,21 @@ typedef struct model {
 #define MODEL_TIMING(m) ((m)->timing)
   void (* init) (sim_cpu *);
 #define MODEL_INIT(m) ((m)->init)
 #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).  */
 
 /* 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.  */
 
 /* 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 */
 
 #endif /* SIM_MODEL_H */
This page took 0.024781 seconds and 4 git commands to generate.