2002-11-22 Andrew Cagney <ac131313@redhat.com>
* dv-core.c: Update copyright. sim/common contributed to the FSF.
* dv-glue.c, dv-pal.c, hw-base.c, hw-base.h, hw-device.c: Ditto.
* hw-device.h, hw-handles.c, hw-handles.h: Ditto.
* hw-instances.c, hw-instances.h, hw-properties.c: Ditto.
* hw-properties.h, hw-tree.c, hw-tree.h, sim-alu.h: Ditto.
* sim-basics.h, sim-bits.c, sim-bits.h, sim-config.c: Ditto.
* sim-config.h, sim-core.c, sim-core.h, sim-endian.c: Ditto.
* sim-endian.h, sim-events.c, sim-events.h, sim-inline.c: Ditto.
* sim-inline.h, sim-io.c, sim-io.h, sim-n-bits.h: Ditto.
* sim-n-core.h, sim-n-endian.h, sim-types.h: Ditto.
2002-11-23 01:12:05 +00:00
|
|
|
|
/* The common simulator framework for GDB, the GNU Debugger.
|
|
|
|
|
|
2016-01-01 04:33:14 +00:00
|
|
|
|
Copyright 2002-2016 Free Software Foundation, Inc.
|
2002-11-22 Andrew Cagney <ac131313@redhat.com>
* dv-core.c: Update copyright. sim/common contributed to the FSF.
* dv-glue.c, dv-pal.c, hw-base.c, hw-base.h, hw-device.c: Ditto.
* hw-device.h, hw-handles.c, hw-handles.h: Ditto.
* hw-instances.c, hw-instances.h, hw-properties.c: Ditto.
* hw-properties.h, hw-tree.c, hw-tree.h, sim-alu.h: Ditto.
* sim-basics.h, sim-bits.c, sim-bits.h, sim-config.c: Ditto.
* sim-config.h, sim-core.c, sim-core.h, sim-endian.c: Ditto.
* sim-endian.h, sim-events.c, sim-events.h, sim-inline.c: Ditto.
* sim-inline.h, sim-io.c, sim-io.h, sim-n-bits.h: Ditto.
* sim-n-core.h, sim-n-endian.h, sim-types.h: Ditto.
2002-11-23 01:12:05 +00:00
|
|
|
|
|
|
|
|
|
Contributed by Andrew Cagney and Red Hat.
|
|
|
|
|
|
|
|
|
|
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
|
2007-08-24 14:30:15 +00:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2002-11-22 Andrew Cagney <ac131313@redhat.com>
* dv-core.c: Update copyright. sim/common contributed to the FSF.
* dv-glue.c, dv-pal.c, hw-base.c, hw-base.h, hw-device.c: Ditto.
* hw-device.h, hw-handles.c, hw-handles.h: Ditto.
* hw-instances.c, hw-instances.h, hw-properties.c: Ditto.
* hw-properties.h, hw-tree.c, hw-tree.h, sim-alu.h: Ditto.
* sim-basics.h, sim-bits.c, sim-bits.h, sim-config.c: Ditto.
* sim-config.h, sim-core.c, sim-core.h, sim-endian.c: Ditto.
* sim-endian.h, sim-events.c, sim-events.h, sim-inline.c: Ditto.
* sim-inline.h, sim-io.c, sim-io.h, sim-n-bits.h: Ditto.
* sim-n-core.h, sim-n-endian.h, sim-types.h: Ditto.
2002-11-23 01:12:05 +00:00
|
|
|
|
(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
|
2007-08-24 14:30:15 +00:00
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
2015-06-20 03:46:10 +00:00
|
|
|
|
#ifndef SIM_BASICS_H
|
|
|
|
|
#define SIM_BASICS_H
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Basic configuration */
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2016-01-09 01:23:37 +00:00
|
|
|
|
#include "config.h"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will
|
|
|
|
|
bring potential conflicts out in the open */
|
|
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
|
|
|
2016-01-05 03:24:03 +00:00
|
|
|
|
#ifndef min
|
|
|
|
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef max
|
|
|
|
|
#define max(a, b) ((a) > (b) ? (a) : (b))
|
|
|
|
|
#endif
|
|
|
|
|
|
2011-03-15 03:16:17 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Some versions of GCC include an attribute operator, define it */
|
|
|
|
|
|
|
|
|
|
#if !defined (__attribute__)
|
|
|
|
|
#if (!defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
|
|
|
|
|
#define __attribute__(arg)
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Global types that code manipulates */
|
|
|
|
|
|
|
|
|
|
struct hw;
|
|
|
|
|
struct _sim_fpu;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Generic address space (maps) and access attributes */
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
read_map = 0,
|
|
|
|
|
write_map = 1,
|
|
|
|
|
exec_map = 2,
|
|
|
|
|
io_map = 3,
|
|
|
|
|
nr_maps = 32, /* something small */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* disposition of an object when things are reset */
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
permenant_object,
|
|
|
|
|
temporary_object,
|
|
|
|
|
} object_disposition;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Memory transfer types */
|
|
|
|
|
|
|
|
|
|
typedef enum _transfer_type {
|
|
|
|
|
read_transfer,
|
|
|
|
|
write_transfer,
|
|
|
|
|
} transfer_type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* directions */
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
bidirect_port,
|
|
|
|
|
input_port,
|
|
|
|
|
output_port,
|
|
|
|
|
} port_direction;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Basic definitions - ordered so that nothing calls what comes after it. */
|
|
|
|
|
|
|
|
|
|
#include "ansidecl.h"
|
2002-06-09 15:45:54 +00:00
|
|
|
|
#include "gdb/callback.h"
|
|
|
|
|
#include "gdb/remote-sim.h"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#include "sim-config.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. */
|
|
|
|
|
|
2015-06-20 03:46:10 +00:00
|
|
|
|
#endif /* SIM_BASICS_H */
|