daily update
[external/binutils.git] / sim / common / sim-basics.h
index d33a0d5..dcaa4a3 100644 (file)
@@ -1,23 +1,24 @@
-/*  This file is part of the program psim.
+/* The common simulator framework for GDB, the GNU Debugger.
 
-    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
-    Copyright (C) 1997, Free Software Foundation, Inc.
+   Copyright 2002, 2004, 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
-    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
-    (at your option) any later version.
+   Contributed by Andrew Cagney and Red Hat.
 
-    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.
-    */
+   This file is part of GDB.
+
+   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 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.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #ifndef _SIM_BASICS_H_
@@ -27,7 +28,7 @@
 /* Basic configuration */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include "cconfig.h"
 #endif
 
 /* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will
 #include <stdio.h>
 #include <setjmp.h>
 
+#ifdef __CYGWIN32__
+extern int vasprintf (char **result, const char *format, va_list args);
+extern int asprintf (char **result, const char *format, ...);
+#endif
+
+
 #ifndef NULL
 #define NULL 0
 #endif
 
 
 
-       
 /* Some versions of GCC include an attribute operator, define it */
 
 #if !defined (__attribute__)
-#if (!defined(__GNUC__) \
-     || (__GNUC__ < 2) \
-     || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
+#if (!defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
 #define __attribute__(arg)
 #endif
 #endif
 
 
+/* Global types that code manipulates */
 
-/* Memory management with an allocator that clears memory before use. */
+typedef struct _device device;
+struct hw;
+struct _sim_fpu;
 
-void *zalloc (unsigned long size);
 
-#define ZALLOC(TYPE) (TYPE*)zalloc(sizeof (TYPE))
+/* Generic address space (maps) and access attributes */
 
-void zfree(void*);
+enum {
+  read_map = 0,
+  write_map = 1,
+  exec_map = 2,
+  io_map = 3,
+  nr_maps = 32, /* something small */
+};
 
-/* Turn VALUE into a string with commas.  */
-char *sim_add_commas (char *, int, unsigned long);
+enum {
+  access_invalid = 0,
+  access_read = 1 << read_map,
+  access_write = 1 << write_map,
+  access_exec = 1 << exec_map,
+  access_io = 1 << io_map,
+};
 
+enum {
+  access_read_write = (access_read | access_write),
+  access_read_exec = (access_read | access_exec),
+  access_write_exec = (access_write | access_exec),
+  access_read_write_exec = (access_read | access_write | access_exec),
+  access_read_io = (access_read | access_io),
+  access_write_io = (access_write | access_io),
+  access_read_write_io = (access_read | access_write | access_io),
+  access_exec_io = (access_exec | access_io),
+  access_read_exec_io = (access_read | access_exec | access_io),
+  access_write_exec_io = (access_write | access_exec | access_io),
+  access_read_write_exec_io = (access_read | access_write | access_exec | access_io),
+};
 
-/* Utilities for elapsed time reporting.  */
-/* Opaque type, known only inside sim_elapsed_time_foo fns.  */
-typedef unsigned long SIM_ELAPSED_TIME;
-/* Get reference point for future call to sim_time_elapsed.  */
-SIM_ELAPSED_TIME sim_elapsed_time_get (void);
-/* Elapsed time in milliseconds since START.  */
-unsigned long sim_elapsed_time_since (SIM_ELAPSED_TIME start);
 
+/* disposition of an object when things are reset */
 
-/* Global types that code manipulates */
+typedef enum {
+  permenant_object,
+  temporary_object,
+} object_disposition;
 
-typedef struct _device device;
 
+/* Memory transfer types */
 
-/* Address access attributes */
-typedef enum _access_type {
-  access_invalid = 0,
-  access_read = 1,
-  access_write = 2,
-  access_read_write = 3,
-  access_exec = 4,
-  access_read_exec = 5,
-  access_write_exec = 6,
-  access_read_write_exec = 7,
-} access_type;
+typedef enum _transfer_type {
+  read_transfer,
+  write_transfer,
+} transfer_type;
 
 
-/* Address attachement types */
-typedef enum _attach_type {
-  attach_invalid,
-  attach_raw_memory,
-  attach_callback,
-  /* ... */
-} attach_type;
+/* directions */
 
+typedef enum {
+  bidirect_port,
+  input_port,
+  output_port,
+} port_direction;
 
 
-/* Basic definitions - ordered so that nothing calls what comes after
-   it */
+\f
+/* Basic definitions - ordered so that nothing calls what comes after it.  */
 
+/* FIXME: conditionalizing tconfig.h on HAVE_CONFIG_H seems wrong.  */
 #ifdef HAVE_CONFIG_H
 #include "tconfig.h"
 #endif
+
 #include "ansidecl.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
 
 #include "sim-config.h"
 
-#include "sim-module.h"
-#include "sim-trace.h"
-#include "sim-profile.h"
-#include "sim-model.h"
-#include "sim-base.h"
-
 #include "sim-inline.h"
 
 #include "sim-types.h"
 #include "sim-bits.h"
 #include "sim-endian.h"
+#include "sim-signal.h"
+#include "sim-arange.h"
+
+#include "sim-utils.h"
+
+/* Note: Only the simpler interfaces are defined here.  More heavy
+   weight objects, such as core and events, are defined in the more
+   serious sim-base.h header. */
 
 #endif /* _SIM_BASICS_H_ */