Browse Source
2_13-branch'.
Sprout from kseitz_interps-20020528-branch 2002-06-18 21:15:59 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch'
Cherrypick from master 2002-07-11 20:14:41 UTC DJ Delorie <dj@redhat.com> '* configure.in: Remove two redundant tests.':
COPYING.LIBGLOSS
ChangeLog
Makefile.in
config-ml.in
config.sub
config/ChangeLog
configure
configure.in
etc/ChangeLog
etc/texi2pod.pl
include/ChangeLog
include/bfdlink.h
include/demangle.h
include/dis-asm.h
include/elf/ChangeLog
include/elf/alpha.h
include/elf/common.h
include/elf/dwarf2.h
include/elf/sh.h
include/elf/vax.h
include/fibheap.h
include/gdb/ChangeLog
include/gdb/sim-d10v.h
include/getopt.h
include/hashtab.h
include/libiberty.h
include/opcode/ChangeLog
include/opcode/a29k.h
include/opcode/convex.h
include/opcode/dlx.h
include/opcode/i386.h
include/opcode/mips.h
include/opcode/or32.h
include/partition.h
include/sort.h
include/splay-tree.h
ltcf-cxx.sh
Delete:
include/callback.h
include/remote-sim.h
cagney_sysregs-20020825-branch
binutils-2_13-branchpoint
38 changed files with 1915 additions and 1963 deletions
@ -0,0 +1,186 @@ |
|||
The libgloss subdirectory is a collection of software from several sources. |
|||
Each have their own copyrights embedded in each file that they concern. |
|||
|
|||
(1) University of California, Berkeley |
|||
|
|||
Copyright (c) 1990 The Regents of the University of California. |
|||
All rights reserved. |
|||
|
|||
Redistribution and use in source and binary forms are permitted |
|||
provided that the above copyright notice and this paragraph are |
|||
duplicated in all such forms and that any documentation, |
|||
and other materials related to such distribution and use |
|||
acknowledge that the software was developed |
|||
by the University of California, Berkeley. The name of the |
|||
University may not be used to endorse or promote products derived |
|||
from this software without specific prior written permission. |
|||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
|||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
|||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
|||
|
|||
(2) DJ Delorie |
|||
|
|||
Copyright (C) 1993 DJ Delorie |
|||
All rights reserved. |
|||
|
|||
Redistribution and use in source and binary forms is permitted |
|||
provided that the above copyright notice and following paragraph are |
|||
duplicated in all such forms. |
|||
|
|||
This file is distributed WITHOUT ANY WARRANTY; without even the implied |
|||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|||
|
|||
(3) GPL (fr30 directory only) |
|||
|
|||
Copyright (C) 1998 Free Software Foundation, Inc. |
|||
Contributed by Cygnus Solutions. |
|||
|
|||
This file is part of GNU CC. |
|||
|
|||
GNU CC 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. |
|||
|
|||
GNU CC 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 GNU CC; see the file COPYING. If not, write to |
|||
the Free Software Foundation, 59 Temple Place - Suite 330, |
|||
Boston, MA 02111-1307, USA. |
|||
|
|||
(4) Advanced Micro Devices |
|||
|
|||
Copyright 1989, 1990 Advanced Micro Devices, Inc. |
|||
|
|||
This software is the property of Advanced Micro Devices, Inc (AMD) which |
|||
specifically grants the user the right to modify, use and distribute this |
|||
software provided this notice is not removed or altered. All other rights |
|||
are reserved by AMD. |
|||
|
|||
AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS |
|||
SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL |
|||
DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR |
|||
USE OF THIS SOFTWARE. |
|||
|
|||
So that all may benefit from your experience, please report any problems |
|||
or suggestions about this software to the 29K Technical Support Center at |
|||
800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or |
|||
0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. |
|||
|
|||
Advanced Micro Devices, Inc. |
|||
29K Support Products |
|||
Mail Stop 573 |
|||
5900 E. Ben White Blvd. |
|||
Austin, TX 78741 |
|||
800-292-9263 |
|||
|
|||
(5) Array Technology Corporation and MIPS (mips/lsi33k-stub.h) |
|||
|
|||
COPYRIGHT (C) 1991, 1992 ARRAY TECHNOLOGY CORPORATION |
|||
All Rights Reserved |
|||
|
|||
This software is confidential information which is proprietary to and |
|||
a trade secret of ARRAY Technology Corporation. Use, duplication, or |
|||
disclosure is subject to the terms of a separate license agreement. |
|||
|
|||
Copyright 1985 by MIPS Computer Systems, Inc. |
|||
|
|||
(6) University of Utah and the Computer Systems Laboratory (CSL) |
|||
|
|||
Copyright (c) 1990,1994 The University of Utah and |
|||
the Computer Systems Laboratory (CSL). All rights reserved. |
|||
|
|||
Permission to use, copy, modify and distribute this software is hereby |
|||
granted provided that (1) source code retains these copyright, permission, |
|||
and disclaimer notices, and (2) redistributions including binaries |
|||
reproduce the notices in supporting documentation, and (3) all advertising |
|||
materials mentioning features or use of this software display the following |
|||
acknowledgement: ``This product includes software developed by the |
|||
Computer Systems Laboratory at the University of Utah.'' |
|||
|
|||
THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS |
|||
IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF |
|||
ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. |
|||
|
|||
CSL requests users of this software to return to csl-dist@cs.utah.edu any |
|||
improvements that they make and grant CSL redistribution rights. |
|||
|
|||
(7) Sun Microsystems |
|||
|
|||
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
|||
|
|||
Developed at SunPro, a Sun Microsystems, Inc. business. |
|||
Permission to use, copy, modify, and distribute this |
|||
software is freely granted, provided that this notice |
|||
is preserved. |
|||
|
|||
(8) Hewlett Packard |
|||
|
|||
(c) Copyright 1986 HEWLETT-PACKARD COMPANY |
|||
|
|||
To anyone who acknowledges that this file is provided "AS IS" |
|||
without any express or implied warranty: |
|||
permission to use, copy, modify, and distribute this file |
|||
for any purpose is hereby granted without fee, provided that |
|||
the above copyright notice and this notice appears in all |
|||
copies, and that the name of Hewlett-Packard Company not be |
|||
used in advertising or publicity pertaining to distribution |
|||
of the software without specific, written prior permission. |
|||
Hewlett-Packard Company makes no representations about the |
|||
suitability of this software for any purpose. |
|||
|
|||
(9) Hans-Peter Nilsson |
|||
|
|||
Copyright (C) 2001 Hans-Peter Nilsson |
|||
|
|||
Permission to use, copy, modify, and distribute this software is |
|||
freely granted, provided that the above copyright notice, this notice |
|||
and the following disclaimer are preserved with no changes. |
|||
|
|||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
|||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
|||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|||
PURPOSE. |
|||
|
|||
(10) No Copyright |
|||
|
|||
THIS SOFTWARE IS NOT COPYRIGHTED |
|||
|
|||
(11) Default copyright |
|||
|
|||
Unless otherwise stated in each remaining libgloss file, the remaining |
|||
files in the libgloss subdirectory are governed by the following copyright. |
|||
This includes copyrights attributed to Cygnus Solutions and Cygnus Support |
|||
which are now owned by Red Hat Incorporated. |
|||
|
|||
Copyright (c) 1994, 1997, 2001, 2002 Red Hat Incorporated. |
|||
All rights reserved. |
|||
|
|||
Redistribution and use in source and binary forms, with or without |
|||
modification, are permitted provided that the following conditions are met: |
|||
|
|||
Redistributions of source code must retain the above copyright |
|||
notice, this list of conditions and the following disclaimer. |
|||
|
|||
Redistributions in binary form must reproduce the above copyright |
|||
notice, this list of conditions and the following disclaimer in the |
|||
documentation and/or other materials provided with the distribution. |
|||
|
|||
The name of Red Hat Incorporated may not be used to endorse |
|||
or promote products derived from this software without specific |
|||
prior written permission. |
|||
|
|||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY |
|||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|||
File diff suppressed because it is too large
@ -1,270 +0,0 @@ |
|||
/* Remote target system call callback support.
|
|||
Copyright 1997 Free Software Foundation, Inc. |
|||
Contributed by Cygnus Solutions. |
|||
|
|||
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 2 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, write to the Free Software |
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|||
|
|||
/* This interface isn't intended to be specific to any particular kind
|
|||
of remote (hardware, simulator, whatever). As such, support for it |
|||
(e.g. sim/common/callback.c) should *not* live in the simulator source |
|||
tree, nor should it live in the gdb source tree. */ |
|||
|
|||
/* There are various ways to handle system calls:
|
|||
|
|||
1) Have a simulator intercept the appropriate trap instruction and |
|||
directly perform the system call on behalf of the target program. |
|||
This is the typical way of handling system calls for embedded targets. |
|||
[Handling system calls for embedded targets isn't that much of an |
|||
oxymoron as running compiler testsuites make use of the capability.] |
|||
|
|||
This method of system call handling is done when STATE_ENVIRONMENT |
|||
is ENVIRONMENT_USER. |
|||
|
|||
2) Have a simulator emulate the hardware as much as possible. |
|||
If the program running on the real hardware communicates with some sort |
|||
of target manager, one would want to be able to run this program on the |
|||
simulator as well. |
|||
|
|||
This method of system call handling is done when STATE_ENVIRONMENT |
|||
is ENVIRONMENT_OPERATING. |
|||
*/ |
|||
|
|||
#ifndef CALLBACK_H |
|||
#define CALLBACK_H |
|||
|
|||
/* ??? The reason why we check for va_start here should be documented. */ |
|||
|
|||
#ifndef va_start |
|||
#include <ansidecl.h> |
|||
#ifdef ANSI_PROTOTYPES |
|||
#include <stdarg.h> |
|||
#else |
|||
#include <varargs.h> |
|||
#endif |
|||
#endif |
|||
|
|||
/* Mapping of host/target values. */ |
|||
/* ??? For debugging purposes, one might want to add a string of the
|
|||
name of the symbol. */ |
|||
|
|||
typedef struct { |
|||
int host_val; |
|||
int target_val; |
|||
} CB_TARGET_DEFS_MAP; |
|||
|
|||
#define MAX_CALLBACK_FDS 10 |
|||
|
|||
/* Forward decl for stat/fstat. */ |
|||
struct stat; |
|||
|
|||
typedef struct host_callback_struct host_callback; |
|||
|
|||
struct host_callback_struct |
|||
{ |
|||
int (*close) PARAMS ((host_callback *,int)); |
|||
int (*get_errno) PARAMS ((host_callback *)); |
|||
int (*isatty) PARAMS ((host_callback *, int)); |
|||
int (*lseek) PARAMS ((host_callback *, int, long , int)); |
|||
int (*open) PARAMS ((host_callback *, const char*, int mode)); |
|||
int (*read) PARAMS ((host_callback *,int, char *, int)); |
|||
int (*read_stdin) PARAMS (( host_callback *, char *, int)); |
|||
int (*rename) PARAMS ((host_callback *, const char *, const char *)); |
|||
int (*system) PARAMS ((host_callback *, const char *)); |
|||
long (*time) PARAMS ((host_callback *, long *)); |
|||
int (*unlink) PARAMS ((host_callback *, const char *)); |
|||
int (*write) PARAMS ((host_callback *,int, const char *, int)); |
|||
int (*write_stdout) PARAMS ((host_callback *, const char *, int)); |
|||
void (*flush_stdout) PARAMS ((host_callback *)); |
|||
int (*write_stderr) PARAMS ((host_callback *, const char *, int)); |
|||
void (*flush_stderr) PARAMS ((host_callback *)); |
|||
int (*stat) PARAMS ((host_callback *, const char *, struct stat *)); |
|||
int (*fstat) PARAMS ((host_callback *, int, struct stat *)); |
|||
|
|||
/* When present, call to the client to give it the oportunity to
|
|||
poll any io devices for a request to quit (indicated by a nonzero |
|||
return value). */ |
|||
int (*poll_quit) PARAMS ((host_callback *)); |
|||
|
|||
/* Used when the target has gone away, so we can close open
|
|||
handles and free memory etc etc. */ |
|||
int (*shutdown) PARAMS ((host_callback *)); |
|||
int (*init) PARAMS ((host_callback *)); |
|||
|
|||
/* depreciated, use vprintf_filtered - Talk to the user on a console. */ |
|||
void (*printf_filtered) PARAMS ((host_callback *, const char *, ...)); |
|||
|
|||
/* Talk to the user on a console. */ |
|||
void (*vprintf_filtered) PARAMS ((host_callback *, const char *, va_list)); |
|||
|
|||
/* Same as vprintf_filtered but to stderr. */ |
|||
void (*evprintf_filtered) PARAMS ((host_callback *, const char *, va_list)); |
|||
|
|||
/* Print an error message and "exit".
|
|||
In the case of gdb "exiting" means doing a longjmp back to the main |
|||
command loop. */ |
|||
void (*error) PARAMS ((host_callback *, const char *, ...)); |
|||
|
|||
int last_errno; /* host format */ |
|||
|
|||
int fdmap[MAX_CALLBACK_FDS]; |
|||
char fdopen[MAX_CALLBACK_FDS]; |
|||
char alwaysopen[MAX_CALLBACK_FDS]; |
|||
|
|||
/* System call numbers. */ |
|||
CB_TARGET_DEFS_MAP *syscall_map; |
|||
/* Errno values. */ |
|||
CB_TARGET_DEFS_MAP *errno_map; |
|||
/* Flags to the open system call. */ |
|||
CB_TARGET_DEFS_MAP *open_map; |
|||
/* Signal numbers. */ |
|||
CB_TARGET_DEFS_MAP *signal_map; |
|||
/* Layout of `stat' struct.
|
|||
The format is a series of "name,length" pairs separated by colons. |
|||
Empty space is indicated with a `name' of "space". |
|||
All padding must be explicitly mentioned. |
|||
Lengths are in bytes. If this needs to be extended to bits, |
|||
use "name.bits". |
|||
Example: "st_dev,4:st_ino,4:st_mode,4:..." */ |
|||
const char *stat_map; |
|||
|
|||
/* Marker for those wanting to do sanity checks.
|
|||
This should remain the last member of this struct to help catch |
|||
miscompilation errors. */ |
|||
#define HOST_CALLBACK_MAGIC 4705 /* teds constant */ |
|||
int magic; |
|||
}; |
|||
|
|||
extern host_callback default_callback; |
|||
|
|||
/* Canonical versions of system call numbers.
|
|||
It's not intended to willy-nilly throw every system call ever heard |
|||
of in here. Only include those that have an important use. |
|||
??? One can certainly start a discussion over the ones that are currently |
|||
here, but that will always be true. */ |
|||
|
|||
/* These are used by the ANSI C support of libc. */ |
|||
#define CB_SYS_exit 1 |
|||
#define CB_SYS_open 2 |
|||
#define CB_SYS_close 3 |
|||
#define CB_SYS_read 4 |
|||
#define CB_SYS_write 5 |
|||
#define CB_SYS_lseek 6 |
|||
#define CB_SYS_unlink 7 |
|||
#define CB_SYS_getpid 8 |
|||
#define CB_SYS_kill 9 |
|||
#define CB_SYS_fstat 10 |
|||
/*#define CB_SYS_sbrk 11 - not currently a system call, but reserved. */ |
|||
|
|||
/* ARGV support. */ |
|||
#define CB_SYS_argvlen 12 |
|||
#define CB_SYS_argv 13 |
|||
|
|||
/* These are extras added for one reason or another. */ |
|||
#define CB_SYS_chdir 14 |
|||
#define CB_SYS_stat 15 |
|||
#define CB_SYS_chmod 16 |
|||
#define CB_SYS_utime 17 |
|||
#define CB_SYS_time 18 |
|||
|
|||
/* Struct use to pass and return information necessary to perform a
|
|||
system call. */ |
|||
/* FIXME: Need to consider target word size. */ |
|||
|
|||
typedef struct cb_syscall { |
|||
/* The target's value of what system call to perform. */ |
|||
int func; |
|||
/* The arguments to the syscall. */ |
|||
long arg1, arg2, arg3, arg4; |
|||
|
|||
/* The result. */ |
|||
long result; |
|||
/* Some system calls have two results. */ |
|||
long result2; |
|||
/* The target's errno value, or 0 if success.
|
|||
This is converted to the target's value with host_to_target_errno. */ |
|||
int errcode; |
|||
|
|||
/* Working space to be used by memory read/write callbacks. */ |
|||
PTR p1; |
|||
PTR p2; |
|||
long x1,x2; |
|||
|
|||
/* Callbacks for reading/writing memory (e.g. for read/write syscalls).
|
|||
??? long or unsigned long might be better to use for the `count' |
|||
argument here. We mimic sim_{read,write} for now. Be careful to |
|||
test any changes with -Wall -Werror, mixed signed comparisons |
|||
will get you. */ |
|||
int (*read_mem) PARAMS ((host_callback * /*cb*/, struct cb_syscall * /*sc*/, |
|||
unsigned long /*taddr*/, char * /*buf*/, |
|||
int /*bytes*/)); |
|||
int (*write_mem) PARAMS ((host_callback * /*cb*/, struct cb_syscall * /*sc*/, |
|||
unsigned long /*taddr*/, const char * /*buf*/, |
|||
int /*bytes*/)); |
|||
|
|||
/* For sanity checking, should be last entry. */ |
|||
int magic; |
|||
} CB_SYSCALL; |
|||
|
|||
/* Magic number sanity checker. */ |
|||
#define CB_SYSCALL_MAGIC 0x12344321 |
|||
|
|||
/* Macro to initialize CB_SYSCALL. Called first, before filling in
|
|||
any fields. */ |
|||
#define CB_SYSCALL_INIT(sc) \ |
|||
do { \ |
|||
memset ((sc), 0, sizeof (*(sc))); \ |
|||
(sc)->magic = CB_SYSCALL_MAGIC; \ |
|||
} while (0) |
|||
|
|||
/* Return codes for various interface routines. */ |
|||
|
|||
typedef enum { |
|||
CB_RC_OK = 0, |
|||
/* generic error */ |
|||
CB_RC_ERR, |
|||
/* either file not found or no read access */ |
|||
CB_RC_ACCESS, |
|||
CB_RC_NO_MEM |
|||
} CB_RC; |
|||
|
|||
/* Read in target values for system call numbers, errno values, signals. */ |
|||
CB_RC cb_read_target_syscall_maps PARAMS ((host_callback *, const char *)); |
|||
|
|||
/* Translate target to host syscall function numbers. */ |
|||
int cb_target_to_host_syscall PARAMS ((host_callback *, int)); |
|||
|
|||
/* Translate host to target errno value. */ |
|||
int cb_host_to_target_errno PARAMS ((host_callback *, int)); |
|||
|
|||
/* Translate target to host open flags. */ |
|||
int cb_target_to_host_open PARAMS ((host_callback *, int)); |
|||
|
|||
/* Translate target signal number to host. */ |
|||
int cb_target_to_host_signal PARAMS ((host_callback *, int)); |
|||
|
|||
/* Translate host signal number to target. */ |
|||
int cb_host_to_target_signal PARAMS ((host_callback *, int)); |
|||
|
|||
/* Translate host stat struct to target.
|
|||
If stat struct ptr is NULL, just compute target stat struct size. |
|||
Result is size of target stat struct or 0 if error. */ |
|||
int cb_host_to_target_stat PARAMS ((host_callback *, const struct stat *, PTR)); |
|||
|
|||
/* Perform a system call. */ |
|||
CB_RC cb_syscall PARAMS ((host_callback *, CB_SYSCALL *)); |
|||
|
|||
#endif |
|||
@ -1,354 +0,0 @@ |
|||
/* This file defines the interface between the simulator and gdb.
|
|||
Copyright 1993, 1994, 1996, 1997, 1998, 2000 |
|||
Free Software Foundation, Inc. |
|||
|
|||
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 2 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, write to the Free Software |
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|||
|
|||
#if !defined (REMOTE_SIM_H) |
|||
#define REMOTE_SIM_H 1 |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* This file is used when building stand-alone simulators, so isolate this
|
|||
file from gdb. */ |
|||
|
|||
/* Pick up CORE_ADDR_TYPE if defined (from gdb), otherwise use same value as
|
|||
gdb does (unsigned int - from defs.h). */ |
|||
|
|||
#ifndef CORE_ADDR_TYPE |
|||
typedef unsigned int SIM_ADDR; |
|||
#else |
|||
typedef CORE_ADDR_TYPE SIM_ADDR; |
|||
#endif |
|||
|
|||
|
|||
/* Semi-opaque type used as result of sim_open and passed back to all
|
|||
other routines. "desc" is short for "descriptor". |
|||
It is up to each simulator to define `sim_state'. */ |
|||
|
|||
typedef struct sim_state *SIM_DESC; |
|||
|
|||
|
|||
/* Values for `kind' arg to sim_open. */ |
|||
|
|||
typedef enum { |
|||
SIM_OPEN_STANDALONE, /* simulator used standalone (run.c) */ |
|||
SIM_OPEN_DEBUG /* simulator used by debugger (gdb) */ |
|||
} SIM_OPEN_KIND; |
|||
|
|||
|
|||
/* Return codes from various functions. */ |
|||
|
|||
typedef enum { |
|||
SIM_RC_FAIL = 0, |
|||
SIM_RC_OK = 1, |
|||
SIM_RC_UNKNOWN_BREAKPOINT = 2, |
|||
SIM_RC_INSUFFICIENT_RESOURCES = 3, |
|||
SIM_RC_DUPLICATE_BREAKPOINT = 4 |
|||
} SIM_RC; |
|||
|
|||
|
|||
/* The bfd struct, as an opaque type. */ |
|||
|
|||
struct _bfd; |
|||
|
|||
|
|||
/* Main simulator entry points. */ |
|||
|
|||
|
|||
/* Create a fully initialized simulator instance.
|
|||
|
|||
(This function is called when the simulator is selected from the |
|||
gdb command line.) |
|||
|
|||
KIND specifies how the simulator shall be used. Currently there |
|||
are only two kinds: stand-alone and debug. |
|||
|
|||
CALLBACK specifies a standard host callback (defined in callback.h). |
|||
|
|||
ABFD, when non NULL, designates a target program. The program is |
|||
not loaded. |
|||
|
|||
ARGV is a standard ARGV pointer such as that passed from the |
|||
command line. The syntax of the argument list is is assumed to be |
|||
``SIM-PROG { SIM-OPTION } [ TARGET-PROGRAM { TARGET-OPTION } ]''. |
|||
The trailing TARGET-PROGRAM and args are only valid for a |
|||
stand-alone simulator. |
|||
|
|||
On success, the result is a non NULL descriptor that shall be |
|||
passed to the other sim_foo functions. While the simulator |
|||
configuration can be parameterized by (in decreasing precedence) |
|||
ARGV's SIM-OPTION, ARGV's TARGET-PROGRAM and the ABFD argument, the |
|||
successful creation of the simulator shall not dependent on the |
|||
presence of any of these arguments/options. |
|||
|
|||
Hardware simulator: The created simulator shall be sufficiently |
|||
initialized to handle, with out restrictions any client requests |
|||
(including memory reads/writes, register fetch/stores and a |
|||
resume). |
|||
|
|||
Process simulator: that process is not created until a call to |
|||
sim_create_inferior. FIXME: What should the state of the simulator |
|||
be? */ |
|||
|
|||
SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct _bfd *abfd, char **argv)); |
|||
|
|||
|
|||
/* Destory a simulator instance.
|
|||
|
|||
QUITTING is non-zero if we cannot hang on errors. |
|||
|
|||
This may involve freeing target memory and closing any open files |
|||
and mmap'd areas. You cannot assume sim_kill has already been |
|||
called. */ |
|||
|
|||
void sim_close PARAMS ((SIM_DESC sd, int quitting)); |
|||
|
|||
|
|||
/* Load program PROG into the simulators memory.
|
|||
|
|||
If ABFD is non-NULL, the bfd for the file has already been opened. |
|||
The result is a return code indicating success. |
|||
|
|||
Hardware simulator: Normally, each program section is written into |
|||
memory according to that sections LMA using physical (direct) |
|||
addressing. The exception being systems, such as PPC/CHRP, which |
|||
support more complicated program loaders. A call to this function |
|||
should not effect the state of the processor registers. Multiple |
|||
calls to this function are permitted and have an accumulative |
|||
effect. |
|||
|
|||
Process simulator: Calls to this function may be ignored. |
|||
|
|||
FIXME: Most hardware simulators load the image at the VMA using |
|||
virtual addressing. |
|||
|
|||
FIXME: For some hardware targets, before a loaded program can be |
|||
executed, it requires the manipulation of VM registers and tables. |
|||
Such manipulation should probably (?) occure in |
|||
sim_create_inferior. */ |
|||
|
|||
SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct _bfd *abfd, int from_tty)); |
|||
|
|||
|
|||
/* Prepare to run the simulated program.
|
|||
|
|||
ABFD, if not NULL, provides initial processor state information. |
|||
ARGV and ENV, if non NULL, are NULL terminated lists of pointers. |
|||
|
|||
Hardware simulator: This function shall initialize the processor |
|||
registers to a known value. The program counter and possibly stack |
|||
pointer shall be set using information obtained from ABFD (or |
|||
hardware reset defaults). ARGV and ENV, dependant on the target |
|||
ABI, may be written to memory. |
|||
|
|||
Process simulator: After a call to this function, a new process |
|||
instance shall exist. The TEXT, DATA, BSS and stack regions shall |
|||
all be initialized, ARGV and ENV shall be written to process |
|||
address space (according to the applicable ABI) and the program |
|||
counter and stack pointer set accordingly. */ |
|||
|
|||
SIM_RC sim_create_inferior PARAMS ((SIM_DESC sd, struct _bfd *abfd, char **argv, char **env)); |
|||
|
|||
|
|||
/* Fetch LENGTH bytes of the simulated program's memory. Start fetch
|
|||
at virtual address MEM and store in BUF. Result is number of bytes |
|||
read, or zero if error. */ |
|||
|
|||
int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); |
|||
|
|||
|
|||
/* Store LENGTH bytes from BUF into the simulated program's
|
|||
memory. Store bytes starting at virtual address MEM. Result is |
|||
number of bytes write, or zero if error. */ |
|||
|
|||
int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); |
|||
|
|||
|
|||
/* Fetch register REGNO storing its raw (target endian) value in the
|
|||
LENGTH byte buffer BUF. Return the actual size of the register or |
|||
zero if REGNO is not applicable. |
|||
|
|||
Legacy implementations ignore LENGTH and always return -1. |
|||
|
|||
If LENGTH does not match the size of REGNO no data is transfered |
|||
(the actual register size is still returned). */ |
|||
|
|||
int sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); |
|||
|
|||
|
|||
/* Store register REGNO from the raw (target endian) value in BUF.
|
|||
Return the actual size of the register or zero if REGNO is not |
|||
applicable. |
|||
|
|||
Legacy implementations ignore LENGTH and always return -1. |
|||
|
|||
If LENGTH does not match the size of REGNO no data is transfered |
|||
(the actual register size is still returned). */ |
|||
|
|||
int sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); |
|||
|
|||
|
|||
/* Print whatever statistics the simulator has collected.
|
|||
|
|||
VERBOSE is currently unused and must always be zero. */ |
|||
|
|||
void sim_info PARAMS ((SIM_DESC sd, int verbose)); |
|||
|
|||
|
|||
/* Run (or resume) the simulated program.
|
|||
|
|||
STEP, when non-zero indicates that only a single simulator cycle |
|||
should be emulated. |
|||
|
|||
SIGGNAL, if non-zero is a (HOST) SIGRC value indicating the type of |
|||
event (hardware interrupt, signal) to be delivered to the simulated |
|||
program. |
|||
|
|||
Hardware simulator: If the SIGRC value returned by |
|||
sim_stop_reason() is passed back to the simulator via SIGGNAL then |
|||
the hardware simulator shall correctly deliver the hardware event |
|||
indicated by that signal. If a value of zero is passed in then the |
|||
simulation will continue as if there were no outstanding signal. |
|||
The effect of any other SIGGNAL value is is implementation |
|||
dependant. |
|||
|
|||
Process simulator: If SIGRC is non-zero then the corresponding |
|||
signal is delivered to the simulated program and execution is then |
|||
continued. A zero SIGRC value indicates that the program should |
|||
continue as normal. */ |
|||
|
|||
void sim_resume PARAMS ((SIM_DESC sd, int step, int siggnal)); |
|||
|
|||
|
|||
/* Asynchronous request to stop the simulation.
|
|||
A nonzero return indicates that the simulator is able to handle |
|||
the request */ |
|||
|
|||
int sim_stop PARAMS ((SIM_DESC sd)); |
|||
|
|||
|
|||
/* Fetch the REASON why the program stopped.
|
|||
|
|||
SIM_EXITED: The program has terminated. SIGRC indicates the target |
|||
dependant exit status. |
|||
|
|||
SIM_STOPPED: The program has stopped. SIGRC uses the host's signal |
|||
numbering as a way of identifying the reaon: program interrupted by |
|||
user via a sim_stop request (SIGINT); a breakpoint instruction |
|||
(SIGTRAP); a completed single step (SIGTRAP); an internal error |
|||
condition (SIGABRT); an illegal instruction (SIGILL); Access to an |
|||
undefined memory region (SIGSEGV); Mis-aligned memory access |
|||
(SIGBUS). For some signals information in addition to the signal |
|||
number may be retained by the simulator (e.g. offending address), |
|||
that information is not directly accessable via this interface. |
|||
|
|||
SIM_SIGNALLED: The program has been terminated by a signal. The |
|||
simulator has encountered target code that causes the the program |
|||
to exit with signal SIGRC. |
|||
|
|||
SIM_RUNNING, SIM_POLLING: The return of one of these values |
|||
indicates a problem internal to the simulator. */ |
|||
|
|||
enum sim_stop { sim_running, sim_polling, sim_exited, sim_stopped, sim_signalled }; |
|||
|
|||
void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc)); |
|||
|
|||
|
|||
/* Passthru for other commands that the simulator might support.
|
|||
Simulators should be prepared to deal with any combination of NULL |
|||
or empty CMD. */ |
|||
|
|||
void sim_do_command PARAMS ((SIM_DESC sd, char *cmd)); |
|||
|
|||
/* Call these functions to set and clear breakpoints at ADDR. */ |
|||
|
|||
SIM_RC sim_set_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); |
|||
SIM_RC sim_clear_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); |
|||
SIM_RC sim_clear_all_breakpoints PARAMS ((SIM_DESC sd)); |
|||
|
|||
/* These functions are used to enable and disable breakpoints. */ |
|||
|
|||
SIM_RC sim_enable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); |
|||
SIM_RC sim_disable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); |
|||
SIM_RC sim_enable_all_breakpoints PARAMS ((SIM_DESC sd)); |
|||
SIM_RC sim_disable_all_breakpoints PARAMS ((SIM_DESC sd)); |
|||
|
|||
|
|||
/* Provide simulator with a default (global) host_callback_struct.
|
|||
THIS PROCEDURE IS DEPRECIATED. |
|||
GDB and NRUN do not use this interface. |
|||
This procedure does not take a SIM_DESC argument as it is |
|||
used before sim_open. */ |
|||
|
|||
void sim_set_callbacks PARAMS ((struct host_callback_struct *)); |
|||
|
|||
|
|||
/* Set the size of the simulator memory array.
|
|||
THIS PROCEDURE IS DEPRECIATED. |
|||
GDB and NRUN do not use this interface. |
|||
This procedure does not take a SIM_DESC argument as it is |
|||
used before sim_open. */ |
|||
|
|||
void sim_size PARAMS ((int i)); |
|||
|
|||
|
|||
/* Single-step simulator with tracing enabled.
|
|||
THIS PROCEDURE IS DEPRECIATED. |
|||
THIS PROCEDURE IS EVEN MORE DEPRECATED THAN SIM_SET_TRACE |
|||
GDB and NRUN do not use this interface. |
|||
This procedure returns: ``0'' indicating that the simulator should |
|||
be continued using sim_trace() calls; ``1'' indicating that the |
|||
simulation has finished. */ |
|||
|
|||
int sim_trace PARAMS ((SIM_DESC sd)); |
|||
|
|||
|
|||
/* Enable tracing.
|
|||
THIS PROCEDURE IS DEPRECIATED. |
|||
GDB and NRUN do not use this interface. |
|||
This procedure returns: ``0'' indicating that the simulator should |
|||
be continued using sim_trace() calls; ``1'' indicating that the |
|||
simulation has finished. */ |
|||
|
|||
void sim_set_trace PARAMS ((void)); |
|||
|
|||
|
|||
/* Configure the size of the profile buffer.
|
|||
THIS PROCEDURE IS DEPRECIATED. |
|||
GDB and NRUN do not use this interface. |
|||
This procedure does not take a SIM_DESC argument as it is |
|||
used before sim_open. */ |
|||
|
|||
void sim_set_profile_size PARAMS ((int n)); |
|||
|
|||
|
|||
/* Kill the running program.
|
|||
THIS PROCEDURE IS DEPRECIATED. |
|||
GDB and NRUN do not use this interface. |
|||
This procedure will be replaced as part of the introduction of |
|||
multi-cpu simulators. */ |
|||
|
|||
void sim_kill PARAMS ((SIM_DESC sd)); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* !defined (REMOTE_SIM_H) */ |
|||
Loading…
Reference in new issue