Automatic date update in version.in
[deliverable/binutils-gdb.git] / sim / cris / sim-main.h
index 52640684054029eaba9b59d7499b60cf303ce37c..ff75cc209f920732659da6944b0be9d703c01a0c 100644 (file)
@@ -1,12 +1,12 @@
 /* Main header for the CRIS simulator, based on the m32r header.
 /* Main header for the CRIS simulator, based on the m32r header.
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2004-2020 Free Software Foundation, Inc.
    Contributed by Axis Communications.
 
 This file is part of the GNU simulators.
 
 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 Axis Communications.
 
 This file is part of the GNU simulators.
 
 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 of the License, or
+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,
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
@@ -14,9 +14,8 @@ 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.
 
 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/>.  */
 
 /* All FIXME:s present in m32r apply here too; I just refuse to blindly
    carry them over, as I don't know if they're really things that need
 
 /* All FIXME:s present in m32r apply here too; I just refuse to blindly
    carry them over, as I don't know if they're really things that need
@@ -25,10 +24,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #ifndef SIM_MAIN_H
 #define SIM_MAIN_H
 
 #ifndef SIM_MAIN_H
 #define SIM_MAIN_H
 
-#define USING_SIM_BASE_H
-
-struct _sim_cpu;
-typedef struct _sim_cpu SIM_CPU;
+/* This is a global setting.  Different cpu families can't mix-n-match -scache
+   and -pbb.  However some cpu families may use -simple while others use
+   one of -scache/-pbb.  */
+#define WITH_SCACHE_PBB 1
 
 #include "symcat.h"
 #include "sim-basics.h"
 
 #include "symcat.h"
 #include "sim-basics.h"
@@ -36,29 +35,9 @@ typedef struct _sim_cpu SIM_CPU;
 #include "cris-desc.h"
 #include "cris-opc.h"
 #include "arch.h"
 #include "cris-desc.h"
 #include "cris-opc.h"
 #include "arch.h"
-
-/* These must be defined before sim-base.h.  */
-typedef USI sim_cia;
-
-#define CIA_GET(cpu)     CPU_PC_GET (cpu)
-#define CIA_SET(cpu,val) CPU_PC_SET ((cpu), (val))
-
-#define SIM_ENGINE_HALT_HOOK(sd, cpu, cia) \
-do { \
-  if (cpu) /* Null if ctrl-c.  */ \
-    sim_pc_set ((cpu), (cia)); \
-} while (0)
-#define SIM_ENGINE_RESTART_HOOK(sd, cpu, cia) \
-do { \
-  sim_pc_set ((cpu), (cia)); \
-} while (0)
-
 #include "sim-base.h"
 #include "cgen-sim.h"
 #include "cris-sim.h"
 #include "sim-base.h"
 #include "cgen-sim.h"
 #include "cris-sim.h"
-
-/* For occurrences of ANDIF in decodev32.c.  */
-#include "cgen-ops.h"
 \f
 struct cris_sim_mmapped_page {
   USI addr;
 \f
 struct cris_sim_mmapped_page {
   USI addr;
@@ -120,6 +99,10 @@ struct cris_thread_info {
   char sigsuspended;
 };
 
   char sigsuspended;
 };
 
+typedef int (*cris_interrupt_delivery_fn) (SIM_CPU *,
+                                          enum cris_interrupt_type,
+                                          unsigned int);
+
 struct _sim_cpu {
   /* sim/common cpu base.  */
   sim_cpu_base base;
 struct _sim_cpu {
   /* sim/common cpu base.  */
   sim_cpu_base base;
@@ -135,6 +118,11 @@ struct _sim_cpu {
   CRIS_MISC_PROFILE cris_prev_misc_profile;
 #define CPU_CRIS_PREV_MISC_PROFILE(cpu) (& (cpu)->cris_prev_misc_profile)
 
   CRIS_MISC_PROFILE cris_prev_misc_profile;
 #define CPU_CRIS_PREV_MISC_PROFILE(cpu) (& (cpu)->cris_prev_misc_profile)
 
+#if WITH_HW
+  cris_interrupt_delivery_fn deliver_interrupt;
+#define CPU_CRIS_DELIVER_INTERRUPT(cpu) (cpu->deliver_interrupt)
+#endif
+
   /* Simulator environment data.  */
   USI endmem;
   USI endbrk;
   /* Simulator environment data.  */
   USI endmem;
   USI endbrk;
@@ -169,12 +157,26 @@ struct _sim_cpu {
      for sigmasks and sigpendings. */
   USI sighandler[64];
 
      for sigmasks and sigpendings. */
   USI sighandler[64];
 
+  /* This is a hack to implement just the parts of fcntl F_GETFL that
+     are used in open+fdopen calls for the standard scenario: for such
+     a call we check that the last syscall was open, we check that the
+     passed fd is the same returned then, and so we return the same
+     flags passed to open.  This way, we avoid complicating the
+     generic sim callback machinery by introducing fcntl
+     mechanisms.  */
+  USI last_syscall;
+  USI last_open_fd;
+  USI last_open_flags;
+
   /* Function for initializing CPU thread context, which varies in size
      with each CPU model.  They should be in some constant parts or
      initialized in *_init_cpu, but we can't modify that for now.  */
   void* (*make_thread_cpu_data) (SIM_CPU *, void *);
   size_t thread_cpu_data_size;
 
   /* Function for initializing CPU thread context, which varies in size
      with each CPU model.  They should be in some constant parts or
      initialized in *_init_cpu, but we can't modify that for now.  */
   void* (*make_thread_cpu_data) (SIM_CPU *, void *);
   size_t thread_cpu_data_size;
 
+  /* The register differs, so we dispatch to a CPU-specific function.  */
+  void (*set_target_thread_data) (SIM_CPU *, USI);
+
   /* CPU-model specific parts go here.
      Note that in files that don't need to access these pieces WANT_CPU_FOO
      won't be defined and thus these parts won't appear.  This is ok in the
   /* CPU-model specific parts go here.
      Note that in files that don't need to access these pieces WANT_CPU_FOO
      won't be defined and thus these parts won't appear.  This is ok in the
@@ -206,8 +208,7 @@ struct _sim_cpu {
 /* The sim_state struct.  */
 
 struct sim_state {
 /* The sim_state struct.  */
 
 struct sim_state {
-  sim_cpu *cpu;
-#define STATE_CPU(sd, n) (/*&*/ (sd)->cpu)
+  sim_cpu *cpu[MAX_NR_PROCESSORS];
 
   CGEN_STATE cgen_state;
 
 
   CGEN_STATE cgen_state;
 
@@ -225,6 +226,4 @@ cris_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \
 /* Default memory size.  */
 #define CRIS_DEFAULT_MEM_SIZE 0x800000 /* 8M */
 
 /* Default memory size.  */
 #define CRIS_DEFAULT_MEM_SIZE 0x800000 /* 8M */
 
-extern device cris_devices;
-
 #endif /* SIM_MAIN_H */
 #endif /* SIM_MAIN_H */
This page took 0.025206 seconds and 4 git commands to generate.