mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 02:24:46 +08:00
Add ABFD argument to sim_open call. Pass through to sim_config so
that image properties such as endianness can be checked. More strongly document the expected behavour of each of the sim_* interfaces. Add default endian argument to simulator config macro SIM_AC_OPTION_ENDIAN. Use in sim_config.
This commit is contained in:
parent
04f295b648
commit
247fccdeb5
@ -1,3 +1,7 @@
|
||||
Mon Aug 25 12:21:46 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* remote-sim.c (gdbsim_open): Pass exec_bfd to sim_open call.
|
||||
|
||||
Sun Aug 24 21:16:59 1997 Geoffrey Noer <noer@cygnus.com>
|
||||
|
||||
* ocd.c: comment out sections that create and flush wigglers.log
|
||||
|
@ -515,7 +515,7 @@ gdbsim_open (args, from_tty)
|
||||
make_cleanup (freeargv, (char *) argv);
|
||||
|
||||
init_callbacks ();
|
||||
gdbsim_desc = sim_open (SIM_OPEN_DEBUG, &gdb_callback, argv);
|
||||
gdbsim_desc = sim_open (SIM_OPEN_DEBUG, &gdb_callback, exec_bfd, argv);
|
||||
|
||||
if (gdbsim_desc == 0)
|
||||
error ("unable to create simulator instance");
|
||||
|
@ -1,6 +1,7 @@
|
||||
Thu Aug 14 12:54:07 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
Mon Aug 25 10:50:51 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* callback.h (cb_printf, cb_eprintf): Declare.
|
||||
* remote-sim.h (sim_open): Add ABFD arg. Change ARGV to PARGV.
|
||||
Document.
|
||||
|
||||
Fri Aug 8 16:43:56 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
|
@ -64,45 +64,114 @@ struct _bfd;
|
||||
/* Main simulator entry points. */
|
||||
|
||||
|
||||
/* Create a simulator instance.
|
||||
/* 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 will be used. Currently there are only
|
||||
two kinds: standalone and debug.
|
||||
CALLBACK specifies a standard host callback (defined in callback.h).
|
||||
ARGV is passed from the command line and can be used to select whatever
|
||||
run time options the simulator provides. It is the standard NULL
|
||||
terminated array of pointers, with argv[0] being the program name.
|
||||
The result is a descriptor that shall be passed to the other
|
||||
sim_foo functions. */
|
||||
|
||||
SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, char **argv));
|
||||
KIND specifies how the simulator will 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 } ]''.
|
||||
|
||||
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.
|
||||
|
||||
For a simulator modeling real hardware, 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).
|
||||
|
||||
For a simulator modeling a process, 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.
|
||||
QUITTING is non-zero if we cannot hang on errors. */
|
||||
called. */
|
||||
|
||||
void sim_close PARAMS ((SIM_DESC sd, int quitting));
|
||||
|
||||
|
||||
/* Load program PROG into the simulator.
|
||||
/* 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. */
|
||||
The result is a return code indicating success.
|
||||
|
||||
For a simulator modeling real hardware, the client is permitted to
|
||||
make multiple calls to this function. Such calls have an
|
||||
accumulative effect.
|
||||
|
||||
For a simulator modeling a process, calls to this function may be
|
||||
ignored. */
|
||||
|
||||
SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct _bfd *abfd, int from_tty));
|
||||
|
||||
|
||||
/* Prepare to run the simulated program.
|
||||
ARGV and ENV are NULL terminated lists of pointers. */
|
||||
|
||||
ARGV and ENV are NULL terminated lists of pointers.
|
||||
|
||||
For a simulator modeling real hardware, this function shall
|
||||
initialize the processor registers to a known value. The program
|
||||
counter shall be set to the start address obtained from the last
|
||||
program loaded (or the hardware reset default). The ARGV and ENV
|
||||
arguments can be ignored.
|
||||
|
||||
For a simulator modeling a process, 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. (NB: A simulator
|
||||
may in fact initialize the TEXT, DATA and BSS sections during an
|
||||
earlier stage).
|
||||
|
||||
--
|
||||
|
||||
FIXME: Is the below a better definition - assuming that ABFD arg is
|
||||
added.
|
||||
|
||||
Prepare to run the simulated program.
|
||||
|
||||
ABFD, if not NULL, can be used to obtain initial processor state
|
||||
information (eg PC value).
|
||||
ARGV and ENV, if non NULL, are NULL terminated lists of pointers.
|
||||
|
||||
For a simulator modeling real hardware, this function shall
|
||||
initialize the processor registers to a known value. The program
|
||||
counter shall be set to the start address obtained from the ABFD
|
||||
struct (or the hardware reset default). The ARGV and ENV arguments
|
||||
can be ignored.
|
||||
|
||||
For a simulator modeling a process, 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, char **argv, char **env));
|
||||
|
||||
|
||||
/* Read LENGTH bytes of the simulated program's memory and store in BUF.
|
||||
Result is number of bytes read, or zero if error. */
|
||||
/* Read LENGTH bytes of the simulated program's memory 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));
|
||||
|
||||
@ -113,7 +182,8 @@ int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)
|
||||
int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length));
|
||||
|
||||
|
||||
/* Fetch register REGNO and store the raw (target endian) value in BUF. */
|
||||
/* Fetch register REGNO and store the raw (target endian) value in
|
||||
BUF. */
|
||||
|
||||
void sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf));
|
||||
|
||||
@ -124,6 +194,7 @@ void sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf));
|
||||
|
||||
|
||||
/* 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));
|
||||
@ -142,14 +213,18 @@ 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 indicates the reason:
|
||||
program interrupted by user via a sim_stop request (SIGINT); a
|
||||
breakpoint instruction (SIGTRAP); a completed step (SIGTRAP); an
|
||||
internal error condition (SIGABRT).
|
||||
|
||||
SIM_SIGNALLED: The simulator encountered target code that requires
|
||||
the signal SIGRC to be delivered to the simulated program.
|
||||
|
||||
SIM_RUNNING, SIM_POLLING: The return of one of these values
|
||||
indicates a problem internal to the simulator. */
|
||||
|
||||
@ -163,10 +238,10 @@ void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc));
|
||||
or empty CMD. */
|
||||
|
||||
void sim_do_command PARAMS ((SIM_DESC sd, char *cmd));
|
||||
|
||||
|
||||
|
||||
/* Provide simulator with a default (global) host_callback_struct.
|
||||
THIS PROCEDURE IS IS DEPRECIATED.
|
||||
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. */
|
||||
@ -175,7 +250,7 @@ void sim_set_callbacks PARAMS ((struct host_callback_struct *));
|
||||
|
||||
|
||||
/* Set the size of the simulator memory array.
|
||||
THIS PROCEDURE IS IS DEPRECIATED.
|
||||
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. */
|
||||
@ -184,7 +259,7 @@ void sim_size PARAMS ((int i));
|
||||
|
||||
|
||||
/* Run a simulation with tracing enabled.
|
||||
THIS PROCEDURE IS IS DEPRECIATED.
|
||||
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. */
|
||||
@ -193,7 +268,7 @@ int sim_trace PARAMS ((SIM_DESC sd));
|
||||
|
||||
|
||||
/* Configure the size of the profile buffer.
|
||||
THIS PROCEDURE IS IS DEPRECIATED.
|
||||
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. */
|
||||
@ -202,12 +277,11 @@ void sim_set_profile_size PARAMS ((int n));
|
||||
|
||||
|
||||
/* Kill the running program.
|
||||
THIS PROCEDURE IS IS DEPRECIATED.
|
||||
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));
|
||||
|
||||
|
||||
#endif /* !defined (REMOTE_SIM_H) */
|
||||
|
@ -1,5 +1,32 @@
|
||||
Mon Aug 25 16:26:53 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure.in (sparc*-*-*, only_if_enabled): Set
|
||||
only_if_enabled=yes. Check only_if_enabled before enabling a
|
||||
simulator.
|
||||
* configure: Regenerate.
|
||||
|
||||
start-sanitize-v850e
|
||||
Mon Aug 18 10:56:59 1997 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* configure.in (extra_subdirs): Add v850e target.
|
||||
|
||||
end-sanitize-v850e
|
||||
start-sanitize-v850eq
|
||||
Mon Aug 18 10:56:59 1997 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* configure.in (extra_subdirs): Add v850eq target.
|
||||
|
||||
end-sanitize-v850eq
|
||||
Fri Jul 25 11:40:47 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* configure.in (sparc*-*-*): Don't build erc32.
|
||||
* configure: Regenerate.
|
||||
|
||||
Thu Apr 24 00:47:20 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* configure.in (m32r-*-*): New target.
|
||||
* configure: Regenerate.
|
||||
|
||||
* Makefile.in (autoconf-common, autoconf-changelog): Change $* to $@.
|
||||
|
||||
Mon Apr 21 22:57:55 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
@ -1,3 +1,21 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 15:35:45 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* wrapper.c (sim_open): Add ABFD argument.
|
||||
|
||||
Tue May 20 10:13:26 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* wrapper.c (sim_open): Add callback argument.
|
||||
(sim_set_callbacks): Drop SIM_DESC argument.
|
||||
|
||||
Thu Apr 24 00:39:51 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
|
||||
Fri Apr 18 13:32:23 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* wrapper.c (sim_stop): Stub sim_stop function.
|
||||
|
@ -146,6 +146,13 @@ sim_trace (sd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
sim_stop (sd)
|
||||
SIM_DESC sd;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
sim_resume (sd, step, siggnal)
|
||||
SIM_DESC sd;
|
||||
@ -252,12 +259,15 @@ sim_fetch_register (sd, rn, memory)
|
||||
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind, argv)
|
||||
sim_open (kind, ptr, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback *ptr;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
sim_kind = kind;
|
||||
myname = argv[0];
|
||||
sim_callback = ptr;
|
||||
return (SIM_DESC) 1;
|
||||
}
|
||||
|
||||
@ -327,8 +337,7 @@ sim_do_command (sd, cmd)
|
||||
|
||||
|
||||
void
|
||||
sim_set_callbacks (sd, ptr)
|
||||
SIM_DESC sd;
|
||||
sim_set_callbacks (ptr)
|
||||
host_callback *ptr;
|
||||
{
|
||||
sim_callback = ptr;
|
||||
|
@ -1,8 +1,40 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 12:11:06 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* aclocal.m4 (sim-endian): Add second argument to
|
||||
SIM_AC_OPTION_ENDIAN. First is hardwired endian, second is
|
||||
default endian when not hardwired.
|
||||
|
||||
* sim-config.h (WITH_DEFAULT_TARGET_BYTE_ORDER): New macro, if all
|
||||
else failes value for target byte order.
|
||||
|
||||
* sim-config.c (sim_config): Add abfd arguments. Set
|
||||
STATE_PROG_BFD accordingly. Determine prefered_target_byte_order
|
||||
from same.
|
||||
(sim_config): Return SIM_RC, don't abort.
|
||||
(bfd.h): Include.
|
||||
|
||||
* run.c (main): Update call to sim_open - add ABFD argument.
|
||||
* nrun.c (main): Add NULL ABFD argument.
|
||||
|
||||
Thu Aug 14 12:48:57 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* callback.c (os_poll_quit): Make static.
|
||||
Call sim_cb_eprintf, not p->eprintf.
|
||||
(sim_cb_printf, sim_cb_eprintf): New functions.
|
||||
* sim-utils.h (sim_cb_printf, sim_cb_eprintf): Declare.
|
||||
|
||||
* sim-basics.h (zalloc,zfree,sim_add_commas,SIM_ELAPSED_TIME,
|
||||
sim_elapsed_time_get,sim_elapsed_time_since): Move decls to
|
||||
sim-utils.h. #include sim-utils.h.
|
||||
* sim-utils.h: Above decls moved here.
|
||||
(sim_analyze_program,sim_load_file): Use `struct _bfd', not `bfd'.
|
||||
|
||||
* sim-watch.c (action_watchpoint): Fix thinkos.
|
||||
|
||||
Thu Jul 24 08:48:05 1997 Stu Grossman (grossman@critters.cygnus.com)
|
||||
|
||||
|
110
sim/common/aclocal.m4
vendored
110
sim/common/aclocal.m4
vendored
@ -118,13 +118,27 @@ AC_SUBST(sim_stdio)
|
||||
|
||||
|
||||
dnl --enable-sim-trace is for users of the simulator
|
||||
dnl the allowable values are work-in-progress
|
||||
dnl The argument is either a bitmask of things to enable [exactly what is
|
||||
dnl up to the simulator], or is a comma separated list of names of tracing
|
||||
dnl elements to enable. The latter is only supported on simulators that
|
||||
dnl use WITH_TRACE.
|
||||
AC_ARG_ENABLE(sim-trace,
|
||||
[ --enable-sim-trace=opts Enable tracing flags],
|
||||
[case "${enableval}" in
|
||||
yes) sim_trace="-DTRACE=1 -DWITH_TRACE=1";;
|
||||
yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
|
||||
no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
|
||||
*) sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
|
||||
[[-0-9]]*)
|
||||
sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
|
||||
[[a-z]]*)
|
||||
sim_trace=""
|
||||
for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
|
||||
if test x"$sim_trace" = x; then
|
||||
sim_trace="-DWITH_TRACE='(TRACE_$x"
|
||||
else
|
||||
sim_trace="${sim_trace}|TRACE_$x"
|
||||
fi
|
||||
done
|
||||
sim_trace="$sim_trace)'" ;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
|
||||
echo "Setting sim trace = $sim_trace" 6>&1
|
||||
@ -132,6 +146,35 @@ fi],[sim_trace=""])dnl
|
||||
AC_SUBST(sim_trace)
|
||||
|
||||
|
||||
dnl --enable-sim-profile
|
||||
dnl The argument is either a bitmask of things to enable [exactly what is
|
||||
dnl up to the simulator], or is a comma separated list of names of profiling
|
||||
dnl elements to enable. The latter is only supported on simulators that
|
||||
dnl use WITH_PROFILE.
|
||||
AC_ARG_ENABLE(sim-profile,
|
||||
[ --enable-sim-profile=opts Enable profiling flags],
|
||||
[case "${enableval}" in
|
||||
yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
|
||||
no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
|
||||
[[-0-9]]*)
|
||||
sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
|
||||
[[a-z]]*)
|
||||
sim_profile=""
|
||||
for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
|
||||
if test x"$sim_profile" = x; then
|
||||
sim_profile="-DWITH_PROFILE='(PROFILE_$x"
|
||||
else
|
||||
sim_profile="${sim_profile}|PROFILE_$x"
|
||||
fi
|
||||
done
|
||||
sim_profile="$sim_profile)'" ;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
|
||||
echo "Setting sim profile = $sim_profile" 6>&1
|
||||
fi],[sim_profile=""])dnl
|
||||
AC_SUBST(sim_profile)
|
||||
|
||||
|
||||
dnl Types used by common code
|
||||
AC_TYPE_SIGNAL
|
||||
|
||||
@ -205,20 +248,30 @@ AC_SUBST(sim_assert)
|
||||
|
||||
dnl --enable-sim-endian={yes,no,big,little} is for simulators
|
||||
dnl that support both big and little endian targets.
|
||||
dnl arg[1] is hardwired target endianness.
|
||||
dnl arg[2] is default target endianness.
|
||||
AC_DEFUN(SIM_AC_OPTION_ENDIAN,
|
||||
[
|
||||
default_sim_endian="ifelse([$1],,,-DWITH_TARGET_BYTE_ORDER=[$1])"
|
||||
wire_endian="ifelse([$1],,ifelse([$2],,,[$2]),[$1])"
|
||||
default_endian="ifelse([$2],,ifelse([$1],,,[$1]),[$2])"
|
||||
default_sim_endian="ifelse([$1],,ifelse([$2],,,-DWITH_DEFAULT_TARGET_BYTE_ORDER=[$2]),-DWITH_TARGET_BYTE_ORDER=[$1])"
|
||||
AC_ARG_ENABLE(sim-endian,
|
||||
[ --enable-sim-endian=endian Specify target byte endian orientation.],
|
||||
[case "${enableval}" in
|
||||
yes) case "$target" in
|
||||
*powerpc-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
|
||||
*powerpcle-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
|
||||
*) echo "Unknown target $target" 1>&6; sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
|
||||
esac;;
|
||||
no) sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
|
||||
b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
|
||||
l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
|
||||
yes) if test x"$wire_endian" != x; then
|
||||
sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
|
||||
else
|
||||
echo "No hard-wired endian for target $target" 1>&6
|
||||
sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
|
||||
fi;;
|
||||
no) if test x"$default_endian" != x; then
|
||||
sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
|
||||
else
|
||||
echo "No default endian for target $target" 1>&6
|
||||
sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
|
||||
fi;;
|
||||
*) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
|
||||
@ -275,6 +328,43 @@ AC_SUBST(sim_float)
|
||||
])
|
||||
|
||||
|
||||
dnl The argument is the default cache size if none is specified.
|
||||
AC_DEFUN(SIM_AC_OPTION_SCACHE,
|
||||
[
|
||||
default_sim_scache="ifelse([$1],,0,[$1])"
|
||||
AC_ARG_ENABLE(sim-scache,
|
||||
[ --enable-sim-scache=size Specify simulator execution cache size.],
|
||||
[case "${enableval}" in
|
||||
yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
|
||||
no) sim_scace= ;;
|
||||
[[0-9]]*) sim_cache=${enableval};;
|
||||
*) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
|
||||
sim_scache="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
|
||||
echo "Setting scache size = $sim_scache" 6>&1
|
||||
fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
|
||||
AC_SUBST(sim_scache)
|
||||
])
|
||||
|
||||
|
||||
dnl The argument is the default model if none is specified.
|
||||
AC_DEFUN(SIM_AC_OPTION_DEFAULT_MODEL,
|
||||
[
|
||||
default_sim_default_model="ifelse([$1],,0,[$1])"
|
||||
AC_ARG_ENABLE(sim-default-model,
|
||||
[ --enable-sim-default-model=model Specify default model to simulate.],
|
||||
[case "${enableval}" in
|
||||
yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
|
||||
*) sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
|
||||
echo "Setting default model = $sim_default_model" 6>&1
|
||||
fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
|
||||
AC_SUBST(sim_default_model)
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(SIM_AC_OPTION_HARDWARE,
|
||||
[
|
||||
AC_ARG_ENABLE(sim-hardware,
|
||||
|
@ -15,40 +15,54 @@ 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. */
|
||||
|
||||
#include <signal.h>
|
||||
#include "sim-main.h"
|
||||
|
||||
#ifdef HAVE_ENVIRON
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
static void usage PARAMS ((void));
|
||||
static void usage (void);
|
||||
|
||||
extern host_callback default_callback;
|
||||
|
||||
static char *myname;
|
||||
|
||||
static SIM_DESC sd;
|
||||
|
||||
static RETSIGTYPE
|
||||
cntrl_c (int sig)
|
||||
{
|
||||
if (! sim_stop (sd))
|
||||
{
|
||||
fprintf (stderr, "Quit!\n");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *name;
|
||||
char **prog_argv = NULL;
|
||||
enum sim_stop reason;
|
||||
int sigrc;
|
||||
SIM_DESC sd;
|
||||
RETSIGTYPE (*prev_sigint) ();
|
||||
|
||||
myname = argv[0] + strlen (argv[0]);
|
||||
while (myname > argv[0] && myname[-1] != '/')
|
||||
--myname;
|
||||
|
||||
sim_set_callbacks (NULL, &default_callback);
|
||||
default_callback.init (&default_callback);
|
||||
|
||||
/* Create an instance of the simulator. */
|
||||
sd = sim_open (SIM_OPEN_STANDALONE, argv);
|
||||
default_callback.init (&default_callback);
|
||||
sd = sim_open (SIM_OPEN_STANDALONE, &default_callback, NULL, argv);
|
||||
if (sd == 0)
|
||||
exit (1);
|
||||
if (STATE_MAGIC (sd) != SIM_MAGIC_NUMBER)
|
||||
{
|
||||
fprintf (stderr, "Internal error - bad magic number in simulator struct\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Was there a program to run? */
|
||||
prog_argv = STATE_PROG_ARGV (sd);
|
||||
@ -72,7 +86,9 @@ main (argc, argv)
|
||||
#endif
|
||||
|
||||
/* Run the program. */
|
||||
prev_sigint = signal (SIGINT, cntrl_c);
|
||||
sim_resume (sd, 0, 0);
|
||||
signal (SIGINT, prev_sigint);
|
||||
|
||||
/* Print any stats the simulator collected. */
|
||||
sim_info (sd, 0);
|
||||
@ -104,6 +120,11 @@ main (argc, argv)
|
||||
|
||||
case sim_exited:
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf (stderr, "program in undefined state (%d:%d)\n", reason, sigrc);
|
||||
break;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -58,7 +58,6 @@ static char *myname;
|
||||
|
||||
|
||||
/* NOTE: sim_size() and sim_trace() are going away */
|
||||
extern void sim_size PARAMS ((int i));
|
||||
extern int sim_trace PARAMS ((SIM_DESC sd));
|
||||
|
||||
extern int getopt ();
|
||||
@ -104,6 +103,12 @@ main (ac, av)
|
||||
no_args[2] = "set-later";
|
||||
#endif
|
||||
|
||||
/* FIXME: This is currently being migrated into sim_open.
|
||||
Simulators that use functions such as sim_size() still require
|
||||
this. */
|
||||
default_callback.init (&default_callback);
|
||||
sim_set_callbacks (&default_callback);
|
||||
|
||||
/* FIXME: This is currently being rewritten to have each simulator
|
||||
do all argv processing. */
|
||||
|
||||
@ -212,8 +217,7 @@ main (ac, av)
|
||||
|
||||
/* Ensure that any run-time initialisation that needs to be
|
||||
performed by the simulator can occur. */
|
||||
default_callback.init (&default_callback);
|
||||
sd = sim_open (SIM_OPEN_STANDALONE, &default_callback, sim_argv);
|
||||
sd = sim_open (SIM_OPEN_STANDALONE, &default_callback, abfd, sim_argv);
|
||||
if (sd == 0)
|
||||
exit (1);
|
||||
|
||||
|
@ -19,7 +19,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "sim-state.h"
|
||||
#include "sim-main.h"
|
||||
#include "bfd.h"
|
||||
|
||||
|
||||
int current_host_byte_order;
|
||||
@ -31,7 +32,7 @@ int current_environment;
|
||||
#endif
|
||||
|
||||
#if defined (WITH_ALIGNMENT)
|
||||
int current_alignment;
|
||||
enum sim_alignments current_alignment;
|
||||
#endif
|
||||
|
||||
#if defined (WITH_FLOATING_POINT)
|
||||
@ -94,22 +95,22 @@ config_environment_to_a (int environment)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (WITH_ALIGNMENT)
|
||||
static const char *
|
||||
config_alignment_to_a (int alignment)
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case MIXED_ALIGNMENT:
|
||||
return "MIXED_ALIGNMENT";
|
||||
case NONSTRICT_ALIGNMENT:
|
||||
return "NONSTRICT_ALIGNMENT";
|
||||
case STRICT_ALIGNMENT:
|
||||
return "STRICT_ALIGNMENT";
|
||||
case 0:
|
||||
return "0";
|
||||
case FORCED_ALIGNMENT:
|
||||
return "FORCED_ALIGNMENT";
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (WITH_FLOATING_POINT)
|
||||
@ -130,10 +131,48 @@ config_floating_point_to_a (int floating_point)
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
SIM_RC
|
||||
sim_config (SIM_DESC sd,
|
||||
int prefered_target_byte_order)
|
||||
struct _bfd *abfd)
|
||||
{
|
||||
int prefered_target_byte_order;
|
||||
|
||||
/* clone the bfd struct (or open prog_name directly) */
|
||||
{
|
||||
const char *prog_name;
|
||||
if (STATE_PROG_ARGV (sd) == NULL)
|
||||
{
|
||||
if (abfd != NULL)
|
||||
prog_name = bfd_get_filename (abfd);
|
||||
else
|
||||
prog_name = NULL;
|
||||
}
|
||||
else
|
||||
prog_name = *STATE_PROG_ARGV (sd);
|
||||
if (prog_name != NULL)
|
||||
{
|
||||
abfd = bfd_openr (prog_name, 0);
|
||||
if (abfd == NULL)
|
||||
{
|
||||
sim_io_eprintf (sd, "%s: can't open \"%s\": %s\n",
|
||||
STATE_MY_NAME (sd),
|
||||
prog_name,
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
STATE_PROG_BFD (sd) = abfd;
|
||||
}
|
||||
else
|
||||
STATE_PROG_BFD (sd) = NULL;
|
||||
}
|
||||
|
||||
/* extract all relevant information */
|
||||
if (abfd == NULL)
|
||||
prefered_target_byte_order = 0;
|
||||
else
|
||||
prefered_target_byte_order = (bfd_little_endian(abfd)
|
||||
? LITTLE_ENDIAN
|
||||
: BIG_ENDIAN);
|
||||
|
||||
/* set the host byte order */
|
||||
current_host_byte_order = 1;
|
||||
@ -144,16 +183,19 @@ sim_config (SIM_DESC sd,
|
||||
|
||||
/* verify the host byte order */
|
||||
if (CURRENT_HOST_BYTE_ORDER != current_host_byte_order)
|
||||
sim_io_error (sd, "host (%s) and configured (%s) byte order in conflict",
|
||||
config_byte_order_to_a (current_host_byte_order),
|
||||
config_byte_order_to_a (CURRENT_HOST_BYTE_ORDER));
|
||||
{
|
||||
sim_io_eprintf (sd, "host (%s) and configured (%s) byte order in conflict",
|
||||
config_byte_order_to_a (current_host_byte_order),
|
||||
config_byte_order_to_a (CURRENT_HOST_BYTE_ORDER));
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
|
||||
|
||||
/* set the target byte order */
|
||||
#if (WITH_DEVICES)
|
||||
if (current_target_byte_order == 0)
|
||||
current_target_byte_order
|
||||
= (tree_find_boolean_property(root, "/options/little-endian?")
|
||||
= (tree_find_boolean_property (root, "/options/little-endian?")
|
||||
? LITTLE_ENDIAN
|
||||
: BIG_ENDIAN);
|
||||
#endif
|
||||
@ -162,17 +204,22 @@ sim_config (SIM_DESC sd,
|
||||
current_target_byte_order = prefered_target_byte_order;
|
||||
if (current_target_byte_order == 0)
|
||||
current_target_byte_order = WITH_TARGET_BYTE_ORDER;
|
||||
if (current_target_byte_order == 0)
|
||||
current_target_byte_order = WITH_DEFAULT_TARGET_BYTE_ORDER;
|
||||
|
||||
/* verify the target byte order */
|
||||
if (CURRENT_TARGET_BYTE_ORDER == 0)
|
||||
sim_io_error (sd, "target byte order unspecified");
|
||||
{
|
||||
sim_io_eprintf (sd, "target byte order unspecified");
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
if (CURRENT_TARGET_BYTE_ORDER != current_target_byte_order)
|
||||
sim_io_error (sd, "target (%s) and configured (%s) byte order in conflict",
|
||||
sim_io_eprintf (sd, "target (%s) and configured (%s) byte order in conflict",
|
||||
config_byte_order_to_a (current_target_byte_order),
|
||||
config_byte_order_to_a (CURRENT_TARGET_BYTE_ORDER));
|
||||
if (prefered_target_byte_order != 0
|
||||
&& CURRENT_TARGET_BYTE_ORDER != prefered_target_byte_order)
|
||||
sim_io_error (sd, "target (%s) and specified (%s) byte order in conflict",
|
||||
sim_io_eprintf (sd, "target (%s) and specified (%s) byte order in conflict",
|
||||
config_byte_order_to_a (CURRENT_TARGET_BYTE_ORDER),
|
||||
config_byte_order_to_a (prefered_target_byte_order));
|
||||
|
||||
@ -185,15 +232,31 @@ sim_config (SIM_DESC sd,
|
||||
|
||||
/* verify the stdio */
|
||||
if (CURRENT_STDIO == 0)
|
||||
sim_io_error (sd, "target standard IO unspecified");
|
||||
{
|
||||
sim_io_eprintf (sd, "target standard IO unspecified");
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
if (CURRENT_STDIO != current_stdio)
|
||||
sim_io_error (sd, "target (%s) and configured (%s) standard IO in conflict",
|
||||
config_stdio_to_a (CURRENT_STDIO),
|
||||
config_stdio_to_a (current_stdio));
|
||||
|
||||
|
||||
{
|
||||
sim_io_eprintf (sd, "target (%s) and configured (%s) standard IO in conflict",
|
||||
config_stdio_to_a (CURRENT_STDIO),
|
||||
config_stdio_to_a (current_stdio));
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
|
||||
|
||||
/* check the value of MSB */
|
||||
if (WITH_TARGET_WORD_MSB != 0
|
||||
&& WITH_TARGET_WORD_MSB != (WITH_TARGET_WORD_BITSIZE - 1))
|
||||
{
|
||||
sim_io_eprintf (sd, "target bitsize (%d) contradicts target most significant bit (%d)",
|
||||
WITH_TARGET_WORD_BITSIZE, WITH_TARGET_WORD_MSB);
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
|
||||
|
||||
#if defined (WITH_ENVIRONMENT)
|
||||
|
||||
|
||||
/* set the environment */
|
||||
#if (WITH_DEVICES)
|
||||
if (current_environment == 0)
|
||||
@ -214,19 +277,25 @@ sim_config (SIM_DESC sd,
|
||||
#endif
|
||||
if (current_environment == 0)
|
||||
current_environment = WITH_ENVIRONMENT;
|
||||
|
||||
|
||||
/* verify the environment */
|
||||
if (CURRENT_ENVIRONMENT == 0)
|
||||
sim_io_error (sd, "target environment unspecified");
|
||||
{
|
||||
sim_io_eprintf (sd, "target environment unspecified");
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
if (CURRENT_ENVIRONMENT != current_environment)
|
||||
sim_io_error (sd, "target (%s) and configured (%s) environment in conflict",
|
||||
config_environment_to_a (CURRENT_ENVIRONMENT),
|
||||
config_environment_to_a (current_environment));
|
||||
{
|
||||
sim_io_eprintf (sd, "target (%s) and configured (%s) environment in conflict",
|
||||
config_environment_to_a (CURRENT_ENVIRONMENT),
|
||||
config_environment_to_a (current_environment));
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined (WITH_ALIGNMENT)
|
||||
|
||||
|
||||
/* set the alignment */
|
||||
#if defined (WITH_DEVICES)
|
||||
if (current_alignment == 0)
|
||||
@ -237,34 +306,45 @@ sim_config (SIM_DESC sd,
|
||||
#endif
|
||||
if (current_alignment == 0)
|
||||
current_alignment = WITH_ALIGNMENT;
|
||||
|
||||
|
||||
/* verify the alignment */
|
||||
if (CURRENT_ALIGNMENT == 0)
|
||||
sim_io_error (sd, "target alignment unspecified");
|
||||
{
|
||||
sim_io_eprintf (sd, "target alignment unspecified");
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
if (CURRENT_ALIGNMENT != current_alignment)
|
||||
sim_io_error (sd, "target (%s) and configured (%s) alignment in conflict",
|
||||
config_alignment_to_a (CURRENT_ALIGNMENT),
|
||||
config_alignment_to_a (current_alignment));
|
||||
{
|
||||
sim_io_eprintf (sd, "target (%s) and configured (%s) alignment in conflict",
|
||||
config_alignment_to_a (CURRENT_ALIGNMENT),
|
||||
config_alignment_to_a (current_alignment));
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined (WITH_FLOAING_POINT)
|
||||
|
||||
|
||||
/* set the floating point */
|
||||
if (current_floating_point == 0)
|
||||
current_floating_point = WITH_FLOATING_POINT;
|
||||
|
||||
|
||||
/* verify the floating point */
|
||||
if (CURRENT_FLOATING_POINT == 0)
|
||||
sim_io_error (sd, "target floating-point unspecified");
|
||||
{
|
||||
sim_io_eprintf (sd, "target floating-point unspecified");
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
if (CURRENT_FLOATING_POINT != current_floating_point)
|
||||
sim_io_error (sd, "target (%s) and configured (%s) floating-point in conflict",
|
||||
config_alignment_to_a (CURRENT_FLOATING_POINT),
|
||||
config_alignment_to_a (current_floating_point));
|
||||
|
||||
{
|
||||
sim_io_eprintf (sd, "target (%s) and configured (%s) floating-point in conflict",
|
||||
config_alignment_to_a (CURRENT_FLOATING_POINT),
|
||||
config_alignment_to_a (current_floating_point));
|
||||
return SIM_RC_FAIL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
return SIM_RC_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -278,15 +358,24 @@ print_sim_config (SIM_DESC sd)
|
||||
sim_io_printf (sd, "Compiled on %s %s\n", __DATE__, __TIME__);
|
||||
#endif
|
||||
|
||||
sim_io_printf (sd, "WITH_TARGET_BYTE_ORDER = %s\n",
|
||||
sim_io_printf (sd, "WITH_TARGET_BYTE_ORDER = %s\n",
|
||||
config_byte_order_to_a (WITH_TARGET_BYTE_ORDER));
|
||||
|
||||
sim_io_printf (sd, "WITH_HOST_BYTE_ORDER = %s\n",
|
||||
sim_io_printf (sd, "WITH_DEFAULT_TARGET_BYTE_ORDER = %s\n",
|
||||
config_byte_order_to_a (WITH_DEFAULT_TARGET_BYTE_ORDER));
|
||||
|
||||
sim_io_printf (sd, "WITH_HOST_BYTE_ORDER = %s\n",
|
||||
config_byte_order_to_a (WITH_HOST_BYTE_ORDER));
|
||||
|
||||
sim_io_printf (sd, "WITH_STDIO = %s\n",
|
||||
sim_io_printf (sd, "WITH_STDIO = %s\n",
|
||||
config_stdio_to_a (WITH_STDIO));
|
||||
|
||||
sim_io_printf (sd, "WITH_TARGET_WORD_BITSIZE = %d\n",
|
||||
WITH_TARGET_WORD_BITSIZE);
|
||||
|
||||
sim_io_printf (sd, "WITH_TARGET_WORD_MSB = %d\n",
|
||||
WITH_TARGET_WORD_MSB);
|
||||
|
||||
#if defined (WITH_XOR_ENDIAN)
|
||||
sim_io_printf (sd, "WITH_XOR_ENDIAN = %d\n", WITH_XOR_ENDIAN);
|
||||
#endif
|
||||
|
@ -222,6 +222,10 @@
|
||||
#define WITH_TARGET_BYTE_ORDER 0 /*unknown*/
|
||||
#endif
|
||||
|
||||
#ifndef WITH_DEFAULT_TARGET_BYTE_ORDER
|
||||
#define WITH_DEFAULT_TARGET_BYTE_ORDER 0 /* fatal */
|
||||
#endif
|
||||
|
||||
extern int current_host_byte_order;
|
||||
#define CURRENT_HOST_BYTE_ORDER (WITH_HOST_BYTE_ORDER \
|
||||
? WITH_HOST_BYTE_ORDER \
|
||||
@ -235,12 +239,16 @@ extern int current_target_byte_order;
|
||||
|
||||
/* XOR endian.
|
||||
|
||||
In addition to the above, the simulator can support the's horrible
|
||||
XOR endian mode (for instance implemented by the PowerPC). This
|
||||
feature makes it possible to control the endian mode of a processor
|
||||
using the MSR. */
|
||||
In addition to the above, the simulator can support the horrible
|
||||
XOR endian mode (as found in the PowerPC and MIPS ISA). See
|
||||
sim-core for more information.
|
||||
|
||||
/* #define WITH_XOR_ENDIAN 8 */
|
||||
If WITH_XOR_ENDIAN is non-zero, it specifies the number of bytes
|
||||
potentially involved in the XOR munge. A typical value is 8. */
|
||||
|
||||
#ifndef WITH_XOR_ENDIAN
|
||||
#define WITH_XOR_ENDIAN 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -258,23 +266,20 @@ extern int current_target_byte_order;
|
||||
|
||||
Sets a limit on the number of processors that can be simulated. If
|
||||
WITH_SMP is set to zero (0), the simulator is restricted to
|
||||
suporting only on processor (and as a consequence leaves the SMP
|
||||
suporting only one processor (and as a consequence leaves the SMP
|
||||
code out of the build process).
|
||||
|
||||
The actual number of processors is taken from the device
|
||||
/options/smp@<nr-cpu> */
|
||||
|
||||
#if defined (WITH_SMP)
|
||||
|
||||
#if WITH_SMP
|
||||
#if defined (WITH_SMP) && WITH_SMP > 0
|
||||
#define MAX_NR_PROCESSORS WITH_SMP
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifndef MAX_NR_PROCESSORS
|
||||
#define MAX_NR_PROCESSORS 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Word size of host/target:
|
||||
|
||||
@ -369,29 +374,35 @@ extern int current_environment;
|
||||
|
||||
/* Alignment:
|
||||
|
||||
The PowerPC may or may not handle miss aligned transfers. An
|
||||
implementation normally handles miss aligned transfers in big
|
||||
endian mode but generates an exception in little endian mode.
|
||||
A processor architecture may or may not handle miss aligned
|
||||
transfers.
|
||||
|
||||
This model. Instead allows both little and big endian modes to
|
||||
either take exceptions or handle miss aligned transfers.
|
||||
As alternatives: both little and big endian modes take an exception
|
||||
(STRICT_ALIGNMENT); big and little endian models handle mis aligned
|
||||
transfers (NONSTRICT_ALIGNMENT); or the address is forced into
|
||||
alignment using a mask (FORCED_ALIGNMENT).
|
||||
|
||||
If 0 is specified then for big-endian mode miss alligned accesses
|
||||
are permitted (NONSTRICT_ALIGNMENT) while in little-endian mode the
|
||||
processor will fault on them (STRICT_ALIGNMENT). */
|
||||
Mixed alignment should be specified when the simulator needs to be
|
||||
able to change the alignment requirements on the fly (eg for
|
||||
bi-endian support). */
|
||||
|
||||
#if defined (WITH_ALIGNMENT)
|
||||
enum sim_alignments {
|
||||
MIXED_ALIGNMENT,
|
||||
NONSTRICT_ALIGNMENT,
|
||||
STRICT_ALIGNMENT,
|
||||
FORCED_ALIGNMENT,
|
||||
};
|
||||
|
||||
#define NONSTRICT_ALIGNMENT 1
|
||||
#define STRICT_ALIGNMENT 2
|
||||
extern enum sim_alignments current_alignment;
|
||||
|
||||
#if !defined (WITH_ALIGNMENT)
|
||||
#define WITH_ALIGNMENT NONSTRICT_ALIGNMENT
|
||||
#endif
|
||||
|
||||
extern int current_alignment;
|
||||
#define CURRENT_ALIGNMENT (WITH_ALIGNMENT \
|
||||
? WITH_ALIGNMENT \
|
||||
: current_alignment)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Floating point suport:
|
||||
@ -414,6 +425,18 @@ extern int current_floating_point;
|
||||
|
||||
|
||||
|
||||
/* Engine module.
|
||||
|
||||
Use the common start/stop/restart framework (sim-engine).
|
||||
Simulators using the other modules but not the engine should define
|
||||
WITH_ENGINE=0. */
|
||||
|
||||
#ifndef WITH_ENGINE
|
||||
#define WITH_ENGINE 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Debugging:
|
||||
|
||||
Control the inclusion of debugging code.
|
||||
@ -428,7 +451,14 @@ extern int current_floating_point;
|
||||
code */
|
||||
|
||||
#ifndef WITH_TRACE
|
||||
#define WITH_TRACE 1
|
||||
#define WITH_TRACE (-1)
|
||||
#endif
|
||||
|
||||
/* Include the profiling code. Disabling this eliminates all profiling
|
||||
code. */
|
||||
|
||||
#ifndef WITH_PROFILE
|
||||
#define WITH_PROFILE (-1)
|
||||
#endif
|
||||
|
||||
|
||||
@ -515,26 +545,10 @@ extern int current_stdio;
|
||||
|
||||
/* complete/verify/print the simulator configuration */
|
||||
|
||||
extern SIM_RC sim_config
|
||||
(SIM_DESC sd,
|
||||
struct _bfd *abfd);
|
||||
|
||||
/* For prefered_target_byte_order arugment */
|
||||
|
||||
#if defined (bfd_little_endian)
|
||||
#define PREFERED_TARGET_BYTE_ORDER(IMAGE) ((IMAGE) == NULL \
|
||||
? 0 \
|
||||
: bfd_little_endian(IMAGE) \
|
||||
? LITTLE_ENDIAN \
|
||||
: BIG_ENDIAN)
|
||||
#else
|
||||
#define PREFERED_TARGET_BYTE_ORDER(IMAGE) ((IMAGE) == NULL \
|
||||
? 0 \
|
||||
: !(IMAGE)->xvec->byteorder_big_p \
|
||||
? LITTLE_ENDIAN \
|
||||
: BIG_ENDIAN)
|
||||
#endif
|
||||
|
||||
|
||||
extern void sim_config (SIM_DESC sd,
|
||||
int prefered_target_byte_order);
|
||||
|
||||
extern void print_sim_config (SIM_DESC sd);
|
||||
|
||||
|
29
sim/configure
vendored
29
sim/configure
vendored
@ -1273,6 +1273,7 @@ fi
|
||||
# Assume simulator can be built with cc.
|
||||
# If the user passes --enable-sim built it regardless of $(CC).
|
||||
only_if_gcc=no
|
||||
only_if_enabled=no
|
||||
extra_subdirs=common
|
||||
|
||||
# WHEN ADDING ENTRIES TO THIS MATRIX:
|
||||
@ -1292,6 +1293,7 @@ case "${target}" in
|
||||
# end-sanitize-d30v
|
||||
h8300*-*-*) sim_target=h8300 ;;
|
||||
h8500-*-*) sim_target=h8500 ;;
|
||||
m32r-*-*) sim_target=m32r ;;
|
||||
mips*-*-*)
|
||||
# The MIPS simulator can only be compiled by gcc.
|
||||
sim_target=mips
|
||||
@ -1328,6 +1330,20 @@ case "${target}" in
|
||||
only_if_gcc=yes
|
||||
;;
|
||||
# end-sanitize-v850
|
||||
# start-sanitize-v850e
|
||||
v850e-*-*)
|
||||
# The V850 simulator can only be compiled by gcc.
|
||||
sim_target=v850
|
||||
only_if_gcc=yes
|
||||
;;
|
||||
# end-sanitize-v850e
|
||||
# start-sanitize-v850eq
|
||||
v850eq-*-*)
|
||||
# The V850 simulator can only be compiled by gcc.
|
||||
sim_target=v850
|
||||
only_if_gcc=yes
|
||||
;;
|
||||
# end-sanitize-v850eq
|
||||
w65-*-*) sim_target=w65 ;;
|
||||
z8k*-*-*) sim_target=z8k ;;
|
||||
sparc64-*-*)
|
||||
@ -1337,6 +1353,9 @@ case "${target}" in
|
||||
# The SPARC simulator can only be compiled by gcc.
|
||||
sim_target=erc32
|
||||
only_if_gcc=yes
|
||||
# Unfortunately erc32 won't build on many hosts, so only enable
|
||||
# it if the user really really wants it.
|
||||
only_if_enabled=yes
|
||||
;;
|
||||
*) sim_target=none ;;
|
||||
esac
|
||||
@ -1352,9 +1371,13 @@ yes)
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if test ${only_if_gcc} = yes ; then
|
||||
if test "${GCC}" != yes ; then
|
||||
sim_target=none
|
||||
if test ${only_if_enabled} = yes ; then
|
||||
sim_target=none
|
||||
else
|
||||
if test ${only_if_gcc} = yes ; then
|
||||
if test "${GCC}" != yes ; then
|
||||
sim_target=none
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
@ -38,6 +38,7 @@ esac])
|
||||
# Assume simulator can be built with cc.
|
||||
# If the user passes --enable-sim built it regardless of $(CC).
|
||||
only_if_gcc=no
|
||||
only_if_enabled=no
|
||||
extra_subdirs=common
|
||||
|
||||
# WHEN ADDING ENTRIES TO THIS MATRIX:
|
||||
@ -116,10 +117,10 @@ case "${target}" in
|
||||
sparc*-*-*)
|
||||
# The SPARC simulator can only be compiled by gcc.
|
||||
sim_target=erc32
|
||||
# Unfortunately erc32 won't build on many hosts, so don't
|
||||
# build it at all
|
||||
sim_target=none
|
||||
only_if_gcc=yes
|
||||
# Unfortunately erc32 won't build on many hosts, so only enable
|
||||
# it if the user really really wants it.
|
||||
only_if_enabled=yes
|
||||
;;
|
||||
*) sim_target=none ;;
|
||||
esac
|
||||
@ -135,9 +136,13 @@ yes)
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if test ${only_if_gcc} = yes ; then
|
||||
if test "${GCC}" != yes ; then
|
||||
sim_target=none
|
||||
if test ${only_if_enabled} = yes ; then
|
||||
sim_target=none
|
||||
else
|
||||
if test ${only_if_gcc} = yes ; then
|
||||
if test "${GCC}" != yes ; then
|
||||
sim_target=none
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
@ -1,3 +1,21 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 15:39:29 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Add ABFD argument.
|
||||
|
||||
Tue May 20 10:14:45 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Add callback argument.
|
||||
(sim_set_callbacks): Remove SIM_DESC argument.
|
||||
|
||||
Thu Apr 24 00:39:51 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
|
||||
Tue Apr 22 10:29:23 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Undo patch to add -E support.
|
||||
|
@ -36,7 +36,6 @@ static void do_long PARAMS ((uint32 ins));
|
||||
static void do_2_short PARAMS ((uint16 ins1, uint16 ins2, enum _leftright leftright));
|
||||
static void do_parallel PARAMS ((uint16 ins1, uint16 ins2));
|
||||
static char *add_commas PARAMS ((char *buf, int sizeof_buf, unsigned long value));
|
||||
extern void sim_size PARAMS ((int power));
|
||||
static void init_system PARAMS ((void));
|
||||
extern void sim_set_profile PARAMS ((int n));
|
||||
extern void sim_set_profile_size PARAMS ((int n));
|
||||
@ -456,8 +455,10 @@ sim_read (sd, addr, buffer, size)
|
||||
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind, argv)
|
||||
sim_open (kind, callback, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback *callback;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
struct simops *s;
|
||||
@ -466,14 +467,11 @@ sim_open (kind, argv)
|
||||
char **p;
|
||||
|
||||
sim_kind = kind;
|
||||
d10v_callback = callback;
|
||||
myname = argv[0];
|
||||
|
||||
for (p = argv + 1; *p; ++p)
|
||||
{
|
||||
/* Ignore endian specification. */
|
||||
if (strcmp (*p, "-E") == 0)
|
||||
++p;
|
||||
else
|
||||
#ifdef DEBUG
|
||||
if (strcmp (*p, "-t") == 0)
|
||||
d10v_debug = DEBUG;
|
||||
@ -834,8 +832,7 @@ sim_kill (sd)
|
||||
}
|
||||
|
||||
void
|
||||
sim_set_callbacks (sd, p)
|
||||
SIM_DESC sd;
|
||||
sim_set_callbacks (p)
|
||||
host_callback *p;
|
||||
{
|
||||
d10v_callback = p;
|
||||
|
@ -1,3 +1,25 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 16:19:49 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interf.c (sim_open): Add ABFD argument. Change ARGV to PARGV.
|
||||
|
||||
Mon Jun 30 11:45:25 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* Makefile.in (install-sis): Change $(srcdir)/sis to sis.
|
||||
|
||||
Wed May 28 09:46:13 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interf.c (sim_set_callbacks): Drop SD argument - not applicable.
|
||||
(sim_open): Add callback arg, save it.
|
||||
|
||||
Thu Apr 24 00:39:51 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
|
||||
Tue Apr 22 11:05:01 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* interf.c (sim_open): Undo patch to add -E support.
|
||||
|
@ -115,7 +115,7 @@ run_sim(sregs, go, icount, dis)
|
||||
if (sis_verbose)
|
||||
(*sim_callback->printf_filtered) (sim_callback,
|
||||
"SW BP hit at %x\n", sregs->pc);
|
||||
sim_stop();
|
||||
sim_halt();
|
||||
restore_stdio();
|
||||
clearerr(stdin);
|
||||
return (BPT_HIT);
|
||||
@ -133,7 +133,7 @@ run_sim(sregs, go, icount, dis)
|
||||
go = icount = 0;
|
||||
}
|
||||
}
|
||||
sim_stop();
|
||||
sim_halt();
|
||||
sregs->tottime += time(NULL) - sregs->starttime;
|
||||
restore_stdio();
|
||||
clearerr(stdin);
|
||||
@ -155,8 +155,7 @@ run_sim(sregs, go, icount, dis)
|
||||
}
|
||||
|
||||
void
|
||||
sim_set_callbacks (sd, ptr)
|
||||
SIM_DESC sd;
|
||||
sim_set_callbacks (ptr)
|
||||
host_callback *ptr;
|
||||
{
|
||||
sim_callback = ptr;
|
||||
@ -169,8 +168,10 @@ sim_size (memsize)
|
||||
}
|
||||
|
||||
SIM_DESC
|
||||
sim_open(kind, argv)
|
||||
sim_open (kind, callback, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
struct host_callback_struct *callback;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
|
||||
@ -180,6 +181,8 @@ sim_open(kind, argv)
|
||||
int grdl = 0;
|
||||
int freq = 15;
|
||||
|
||||
sim_callback = callback;
|
||||
|
||||
(*sim_callback->printf_filtered) (sim_callback, "\n SIS - SPARC instruction simulator %s\n", sis_version);
|
||||
(*sim_callback->printf_filtered) (sim_callback, " Bug-reports to Jiri Gaisler ESA/ESTEC (jgais@wd.estec.esa.nl)\n");
|
||||
while (argv[argc])
|
||||
|
@ -1,5 +1,21 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 15:47:41 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* compile.c (sim_open): Add ABFD argument.
|
||||
|
||||
Tue May 20 10:16:48 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* compile.c (sim_open): Add callback argument.
|
||||
(sim_set_callbacks): Delete SIM_DESC argument.
|
||||
|
||||
Wed Apr 30 10:22:29 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* compile.c (sim_load): Call bfd_get_mach instead of examining
|
||||
bfd fields directly.
|
||||
* tconfig.in (SIM_PRE_LOAD): Delete, no longer used.
|
||||
|
||||
Thu Apr 24 00:39:51 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
@ -916,6 +916,15 @@ case O(name, SB): \
|
||||
if(s) store (&code->dst,ea); goto next; \
|
||||
}
|
||||
|
||||
int
|
||||
sim_stop (sd)
|
||||
SIM_DESC sd;
|
||||
{
|
||||
cpu.state = SIM_STATE_STOPPED;
|
||||
cpu.exception = SIGINT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
sim_resume (sd, step, siggnal)
|
||||
SIM_DESC sd;
|
||||
@ -1705,29 +1714,13 @@ sim_resume (sd, step, siggnal)
|
||||
;
|
||||
/* if (cpu.regs[8] ) abort(); */
|
||||
|
||||
#if defined (WIN32)
|
||||
/* Poll after every 100th insn, */
|
||||
if (poll_count++ > 100)
|
||||
{
|
||||
poll_count = 0;
|
||||
if (win32pollquit())
|
||||
{
|
||||
control_c();
|
||||
}
|
||||
if ((*sim_callback->poll_quit) != NULL
|
||||
&& (*sim_callback->poll_quit) (sim_callback))
|
||||
sim_stop (sd);
|
||||
}
|
||||
#endif
|
||||
#if defined(__GO32__)
|
||||
/* Poll after every 100th insn, */
|
||||
if (poll_count++ > 100)
|
||||
{
|
||||
poll_count = 0;
|
||||
if (kbhit ())
|
||||
{
|
||||
int c = getkey ();
|
||||
control_c ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
while (cpu.state == SIM_STATE_RUNNING);
|
||||
@ -2027,12 +2020,15 @@ sim_kill (sd)
|
||||
}
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind,argv)
|
||||
sim_open (kind, ptr, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
struct host_callback_struct *ptr;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
sim_kind = kind;
|
||||
myname = argv[0];
|
||||
sim_callback = ptr;
|
||||
/* fudge our descriptor */
|
||||
return (SIM_DESC) 1;
|
||||
}
|
||||
@ -2065,10 +2061,13 @@ sim_load (sd, prog, abfd, from_tty)
|
||||
prog_bfd = bfd_openr (prog, "coff-h8300");
|
||||
if (prog_bfd != NULL)
|
||||
{
|
||||
/* Set the cpu type. We ignore failure from bfd_check_format
|
||||
and bfd_openr as sim_load_file checks too. */
|
||||
if (bfd_check_format (prog_bfd, bfd_object))
|
||||
{
|
||||
set_h8300h (prog_bfd->arch_info->mach == bfd_mach_h8300h
|
||||
|| prog_bfd->arch_info->mach == bfd_mach_h8300s);
|
||||
unsigned long mach = bfd_get_mach (prog_bfd);
|
||||
set_h8300h (mach == bfd_mach_h8300h
|
||||
|| mach == bfd_mach_h8300s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2143,8 +2142,7 @@ sim_do_command (sd, cmd)
|
||||
}
|
||||
|
||||
void
|
||||
sim_set_callbacks (sd, ptr)
|
||||
SIM_DESC sd;
|
||||
sim_set_callbacks (ptr)
|
||||
struct host_callback_struct *ptr;
|
||||
{
|
||||
sim_callback = ptr;
|
||||
|
@ -1,3 +1,28 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 15:54:08 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim-if.c (sim_open): Add ABFD argument.
|
||||
|
||||
Tue Jul 22 10:16:16 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* sim-main.h (M32R_DEFAULT_MEM_SIZE): New macro.
|
||||
* sim-if.c (sim_open): Use it.
|
||||
|
||||
Wed Jun 4 12:48:12 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim-main.h (WITH_ENGINE): Disable the common engine for now.
|
||||
|
||||
Tue May 27 14:15:44 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim-if.c (sim_read): Pass NULL cpu to sim_core_read_buffer.
|
||||
(sim_write): Ditto for write.
|
||||
|
||||
* m32r.c (do_trap): Ditto for read/write.
|
||||
|
||||
Tue May 20 10:18:25 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim-if.c (sim_open): Add callback argument.
|
||||
|
1932
sim/m32r/configure
vendored
Executable file
1932
sim/m32r/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
@ -26,8 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "sim-core.h"
|
||||
#include "cpu-sim.h"
|
||||
|
||||
struct host_callback_struct *sim_callback;
|
||||
|
||||
/* Global state until sim_open starts creating and returning it
|
||||
[and the other simulator i/f fns take it as an argument]. */
|
||||
struct sim_state sim_global_state;
|
||||
@ -38,8 +36,10 @@ STATE current_state;
|
||||
/* Create an instance of the simulator. */
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind, argv)
|
||||
sim_open (kind, callback, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback *callback;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
int i;
|
||||
@ -48,7 +48,7 @@ sim_open (kind, argv)
|
||||
/* FIXME: until we alloc one, use the global. */
|
||||
memset (sd, 0, sizeof (sim_global_state));
|
||||
STATE_OPEN_KIND (sd) = kind;
|
||||
STATE_CALLBACK (sd) = sim_callback;
|
||||
STATE_CALLBACK (sd) = callback;
|
||||
|
||||
if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
|
||||
return 0;
|
||||
@ -80,14 +80,10 @@ sim_open (kind, argv)
|
||||
cgen_init (sd);
|
||||
|
||||
/* FIXME:wip */
|
||||
sim_core_attach (sd,
|
||||
NULL,
|
||||
attach_raw_memory,
|
||||
access_read_write_exec,
|
||||
0, 0, 0x100000, NULL, NULL);
|
||||
sim_core_attach (sd, NULL, attach_raw_memory, access_read_write_exec,
|
||||
0, 0, M32R_DEFAULT_MEM_SIZE, NULL, NULL);
|
||||
|
||||
/* We could only do this if profiling has been enabled, but the
|
||||
structure member is small so we don't bother. */
|
||||
/* Only needed for profiling, but the structure member is small. */
|
||||
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
|
||||
memset (& CPU_M32R_PROFILE (STATE_CPU (sd, i)), 0,
|
||||
sizeof (CPU_M32R_PROFILE (STATE_CPU (sd, i))));
|
||||
@ -212,17 +208,6 @@ sim_info (sd, verbose)
|
||||
profile_print (sd, STATE_VERBOSE_P (sd), NULL, print_m32r_misc_cpu);
|
||||
}
|
||||
|
||||
void
|
||||
sim_set_callbacks (sd, p)
|
||||
SIM_DESC sd;
|
||||
host_callback *p;
|
||||
{
|
||||
if (sd == NULL)
|
||||
sim_callback = p;
|
||||
else
|
||||
STATE_CALLBACK (sd) = p;
|
||||
}
|
||||
|
||||
/* The contents of BUF are in target byte order. */
|
||||
|
||||
void
|
||||
@ -300,7 +285,7 @@ sim_read (sd, addr, buf, len)
|
||||
int len;
|
||||
{
|
||||
#if 1
|
||||
return sim_core_read_buffer (sd, sim_core_read_map,
|
||||
return sim_core_read_buffer (sd, NULL, sim_core_read_map,
|
||||
buf, addr, len);
|
||||
#else
|
||||
return (*STATE_MEM_READ (sd)) (sd, addr, buf, len);
|
||||
@ -315,7 +300,7 @@ sim_write (sd, addr, buf, len)
|
||||
int len;
|
||||
{
|
||||
#if 1
|
||||
return sim_core_write_buffer (sd, sim_core_write_map,
|
||||
return sim_core_write_buffer (sd, NULL, sim_core_write_map,
|
||||
buf, addr, len);
|
||||
#else
|
||||
return (*STATE_MEM_WRITE (sd)) (sd, addr, buf, len);
|
||||
|
@ -1,3 +1,26 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 15:59:48 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Add ABFD argument.
|
||||
(sim_load): Move call to sim_config from here.
|
||||
(sim_open): To here. Check return status.
|
||||
|
||||
start-sanitize-r5900
|
||||
* gencode.c (build_instruction): Do not define x8000000000000000,
|
||||
x7FFFFFFFFFFFFFFF, or xFFFFFFFF80000000.
|
||||
|
||||
end-sanitize-r5900
|
||||
start-sanitize-r5900
|
||||
Mon Jul 28 19:49:29 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* gencode.c (build_instruction): For "pdivw", "pdivbw" and
|
||||
"pdivuw" check for overflow due to signed divide by -1.
|
||||
|
||||
end-sanitize-r5900
|
||||
Fri Jul 25 15:00:45 1997 Gavin Koch <gavin@cygnus.com>
|
||||
|
||||
* gencode.c (build_instruction): Two arg MADD should
|
||||
|
609
sim/mips/configure
vendored
609
sim/mips/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -3927,9 +3927,6 @@ build_instruction (doisa, features, mips16, insn)
|
||||
printf(" signed64 t = ((unsigned64)HI_UW(0) << 32) | (unsigned64)LO_UW(0);\n");
|
||||
printf(" signed64 u = ((unsigned64)HI_UW(2) << 32) | (unsigned64)LO_UW(2);\n");
|
||||
printf(" signed64 x000000007FFFFFFF = LSMASK64 (31);\n");
|
||||
printf(" signed64 xFFFFFFFF80000000 = MSMASK64 (33);\n");
|
||||
printf(" signed64 x7FFFFFFFFFFFFFFF = LSMASK64 (63);\n");
|
||||
printf(" signed64 x8000000000000000 = MSMASK64 (1);\n");
|
||||
printf(" signed64 x0000000080000000 = x000000007FFFFFFF + 1;\n");
|
||||
printf(" signed64 minus0000000080000000 = -x0000000080000000;\n");
|
||||
printf(" if ( t > x000000007FFFFFFF )\n");
|
||||
|
@ -283,7 +283,14 @@ SUB_REG_FETCH - return as lvalue some sub-part of a "register"
|
||||
A - low part of "register"
|
||||
A1 - high part of register
|
||||
*/
|
||||
#define SUB_REG_FETCH(T,TC,A,A1,I) (*(((T*)(((I) < (TC)) ? (A) : (A1))) + ((I) % (TC))))
|
||||
#define SUB_REG_FETCH(T,TC,A,A1,I) \
|
||||
(*(((I) < (TC) ? (T*)(A) : (T*)(A1)) \
|
||||
+ (CURRENT_HOST_BYTE_ORDER == BIG_ENDIAN \
|
||||
? ((TC) - 1 - (I) % (TC)) \
|
||||
: ((I) % (TC)) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
/*
|
||||
GPR_<type>(R,I) - return, as lvalue, the I'th <type> of general register R
|
||||
@ -292,18 +299,16 @@ GPR_<type>(R,I) - return, as lvalue, the I'th <type> of general register R
|
||||
2 is B=byte H=halfword W=word D=doubleword
|
||||
*/
|
||||
|
||||
#define SUB_REG_SB(A,A1,I) SUB_REG_FETCH(signed char, BYTES_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_SH(A,A1,I) SUB_REG_FETCH(signed short, HALFWORDS_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_SW(A,A1,I) SUB_REG_FETCH(signed int, WORDS_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_SD(A,A1,I) SUB_REG_FETCH(signed long long, DOUBLEWORDS_IN_MIPS_REGS, A, A1, I)
|
||||
|
||||
#define SUB_REG_UB(A,A1,I) SUB_REG_FETCH(unsigned char, BYTES_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_UH(A,A1,I) SUB_REG_FETCH(unsigned short, HALFWORDS_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_UW(A,A1,I) SUB_REG_FETCH(unsigned int, WORDS_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_UD(A,A1,I) SUB_REG_FETCH(unsigned long long,DOUBLEWORDS_IN_MIPS_REGS, A, A1, I)
|
||||
|
||||
|
||||
#define SUB_REG_SB(A,A1,I) SUB_REG_FETCH(signed8, BYTES_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_SH(A,A1,I) SUB_REG_FETCH(signed16, HALFWORDS_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_SW(A,A1,I) SUB_REG_FETCH(signed32, WORDS_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_SD(A,A1,I) SUB_REG_FETCH(signed64, DOUBLEWORDS_IN_MIPS_REGS, A, A1, I)
|
||||
|
||||
#define SUB_REG_UB(A,A1,I) SUB_REG_FETCH(unsigned8, BYTES_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_UH(A,A1,I) SUB_REG_FETCH(unsigned16, HALFWORDS_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_UW(A,A1,I) SUB_REG_FETCH(unsigned32, WORDS_IN_MIPS_REGS, A, A1, I)
|
||||
#define SUB_REG_UD(A,A1,I) SUB_REG_FETCH(unsigned64, DOUBLEWORDS_IN_MIPS_REGS, A, A1, I)
|
||||
|
||||
#define GPR_SB(R,I) SUB_REG_SB(®isters[R], ®isters1[R], I)
|
||||
#define GPR_SH(R,I) SUB_REG_SH(®isters[R], ®isters1[R], I)
|
||||
#define GPR_SW(R,I) SUB_REG_SW(®isters[R], ®isters1[R], I)
|
||||
@ -769,9 +774,10 @@ interrupt_event (SIM_DESC sd, void *data)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind,cb,argv)
|
||||
sim_open (kind, cb, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback *cb;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
SIM_DESC sd = &simulator;
|
||||
@ -814,6 +820,14 @@ sim_open (kind,cb,argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Configure/verify the target byte order and other runtime
|
||||
configuration options */
|
||||
if (sim_config (sd, abfd) != SIM_RC_OK)
|
||||
{
|
||||
sim_module_uninstall (sd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sim_post_argv_init (sd) != SIM_RC_OK)
|
||||
{
|
||||
/* Uninstall the modules to avoid memory leaks,
|
||||
@ -1315,10 +1329,6 @@ sim_load (sd,prog,abfd,from_tty)
|
||||
return SIM_RC_FAIL;
|
||||
sim_analyze_program (sd, prog_bfd);
|
||||
|
||||
/* Configure/verify the target byte order and other runtime
|
||||
configuration options */
|
||||
sim_config (sd, PREFERED_TARGET_BYTE_ORDER(prog_bfd));
|
||||
|
||||
/* (re) Write the monitor trap address handlers into the monitor
|
||||
(eeprom) address space. This can only be done once the target
|
||||
endianness has been determined. */
|
||||
|
@ -1,3 +1,20 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 16:14:44 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Add ABFD argument.
|
||||
|
||||
Tue Jun 24 13:46:20 1997 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* interp.c (sim_resume): Clear State.exited.
|
||||
(sim_stop_reason): If State.exited is nonzero, then indicate that
|
||||
the simulator exited instead of stopped.
|
||||
* mn10300_sim.h (struct _state): Add exited field.
|
||||
* simops.c (syscall): Set State.exited for SYS_exit.
|
||||
|
||||
Wed Jun 11 22:07:56 1997 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* simops.c: Fix thinko in last change.
|
||||
|
@ -284,9 +284,10 @@ compare_simops (arg1, arg2)
|
||||
}
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind,cb,argv)
|
||||
sim_open (kind, cb, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback *cb;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
struct simops *s;
|
||||
@ -331,7 +332,7 @@ sim_open (kind,cb,argv)
|
||||
if (h->opcode == s->opcode
|
||||
&& h->mask == s->mask
|
||||
&& h->ops == s)
|
||||
continue;
|
||||
break;
|
||||
else
|
||||
h = h->next;
|
||||
}
|
||||
@ -404,6 +405,8 @@ sim_resume (sd, step, siggnal)
|
||||
else
|
||||
State.exception = 0;
|
||||
|
||||
State.exited = 0;
|
||||
|
||||
do
|
||||
{
|
||||
unsigned long insn, extension;
|
||||
@ -854,7 +857,10 @@ sim_stop_reason (sd, reason, sigrc)
|
||||
enum sim_stop *reason;
|
||||
int *sigrc;
|
||||
{
|
||||
*reason = sim_stopped;
|
||||
if (State.exited)
|
||||
*reason = sim_exited;
|
||||
else
|
||||
*reason = sim_stopped;
|
||||
if (State.exception == SIGQUIT)
|
||||
*sigrc = 0;
|
||||
else
|
||||
|
@ -1,7 +1,46 @@
|
||||
Mon Aug 25 16:17:06 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim_calls.c (sim_open): Add ABFD argument.
|
||||
|
||||
Thu Jul 3 10:18:06 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* ppc-instructions (PPC_INSN_INT): From Michael Thies - Monitoring
|
||||
CR register updates dependant on RC value had logic backwards.
|
||||
|
||||
* ppc-instructions (Load String Word Immediate): From Brad Parker
|
||||
- sense of wrap test in check for overwriting RA wrong.
|
||||
(Load String Word Indexed): Ditto.
|
||||
|
||||
* configure.in: From Erik Landry - set sim_default_model not
|
||||
sim_model for sim-default-model option.
|
||||
* configure: Regenerate.
|
||||
|
||||
* interrupts.c (check_masked_interrupts): Schedule a hardware
|
||||
interrupt delivery when FP interrupts get enabled.
|
||||
(program_interrupt): Generate FP exceptions instead of aborting.
|
||||
(deliver_hardware_interrupt): Deliver a FP exception if so
|
||||
enabled.
|
||||
|
||||
* registers.h: Add definition of fpscr_vx_bits.
|
||||
|
||||
* idecode_expression.h (FPSCR_END): Always update FEX and VX bits
|
||||
in FPSCR.
|
||||
(FPSCR_END): Explicitly check for possible floating point
|
||||
exception conditions.
|
||||
(FPSCR_BEGIN): Simplify.
|
||||
|
||||
* ppc-instructions (Move From FPSCR): Enable.
|
||||
(Move To FPSCR Bit 1): Ditto.
|
||||
(Move To FPSCR Bit 0): Ditto.
|
||||
(Move To FPSCR Field Immediate): Ditto.
|
||||
(Move to Condition Register from FPSCR): Simplify.
|
||||
(invalid_arithemetic_operation): Generate a QNaN when invalid
|
||||
operation exception disabled.
|
||||
|
||||
Tue May 20 10:22:50 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim_calls.c (sim_open): Add callback argument.
|
||||
(sim_set_callbacks): Delete SIM_DESC argument.
|
||||
(sim_set_callbacks): Delete.
|
||||
|
||||
Tue Apr 22 22:36:57 1997 Mike Meissner <meissner@cygnus.com>
|
||||
|
||||
|
@ -51,13 +51,17 @@
|
||||
static psim *simulator;
|
||||
static device *root_device;
|
||||
static const char *register_names[] = REGISTER_NAMES;
|
||||
static host_callback *callbacks;
|
||||
|
||||
/* For communication between sim_load and sim_create_inferior.
|
||||
This can be made to go away, please do. */
|
||||
static unsigned_word entry_point;
|
||||
|
||||
SIM_DESC
|
||||
sim_open (SIM_OPEN_KIND kind, host_callback *callback, char **argv)
|
||||
sim_open (SIM_OPEN_KIND kind,
|
||||
host_callback *callback,
|
||||
struct _bfd *abfd,
|
||||
char **argv)
|
||||
{
|
||||
callbacks = callback;
|
||||
|
||||
@ -295,8 +299,6 @@ sim_do_command (SIM_DESC sd, char *cmd)
|
||||
advanced operations (such as dup or write) must either be mapped to
|
||||
one of the below calls or handled internally */
|
||||
|
||||
static host_callback *callbacks;
|
||||
|
||||
int
|
||||
sim_io_read_stdin(char *buf,
|
||||
int sizeof_buf)
|
||||
@ -384,13 +386,6 @@ sim_io_flush_stdoutput(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sim_set_callbacks (host_callback *callback)
|
||||
{
|
||||
callbacks = callback;
|
||||
TRACE(trace_gdb, ("sim_set_callbacks called\n"));
|
||||
}
|
||||
|
||||
/****/
|
||||
|
||||
void *
|
||||
|
@ -1,3 +1,27 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 16:17:51 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Add ABFD argument.
|
||||
|
||||
Tue May 20 10:23:28 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Add callback argument.
|
||||
(sim_set_callbacks): Delete SIM_DESC argument.
|
||||
|
||||
Wed Apr 30 11:38:08 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* Makefile.in (SIM_EXTRA_CLEAN): Define.
|
||||
(clean targets): Delete.
|
||||
(sh-clean): New target.
|
||||
|
||||
Thu Apr 24 00:39:51 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
|
||||
Wed Apr 23 17:55:22 1997 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* tconfig.in: New file.
|
||||
|
@ -1173,19 +1173,32 @@ sim_set_profile_size (n)
|
||||
}
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind,argv)
|
||||
sim_open (kind, cb, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback *cb;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
char **p;
|
||||
|
||||
sim_kind = kind;
|
||||
myname = argv[0];
|
||||
callback = cb;
|
||||
|
||||
for (p = argv + 1; *p != NULL; ++p)
|
||||
{
|
||||
if (strcmp (*p, "-E") == 0)
|
||||
little_endian_p = strcmp (*++p, "big") != 0;
|
||||
{
|
||||
++p;
|
||||
if (*p == NULL)
|
||||
{
|
||||
/* FIXME: This doesn't use stderr, but then the rest of the
|
||||
file doesn't either. */
|
||||
callback->printf_filtered (callback, "Missing argument to `-E'.\n");
|
||||
return 0;
|
||||
}
|
||||
little_endian_p = strcmp (*p, "big") != 0;
|
||||
}
|
||||
else if (isdigit (**p))
|
||||
parse_and_set_memory_size (*p);
|
||||
}
|
||||
@ -1282,8 +1295,7 @@ sim_do_command (sd, cmd)
|
||||
}
|
||||
|
||||
void
|
||||
sim_set_callbacks (sd, p)
|
||||
SIM_DESC sd;
|
||||
sim_set_callbacks (p)
|
||||
host_callback *p;
|
||||
{
|
||||
callback = p;
|
||||
|
@ -1,3 +1,14 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 16:33:29 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* sim-calls.c (sim_open): Add ABFD argument.
|
||||
(sim_open): Move sim_config call to just after argument
|
||||
parsing. Check return status.
|
||||
|
||||
Fri Aug 8 21:52:27 1997 Mark Alexander <marka@cygnus.com>
|
||||
|
||||
* sim-calls.c (sim_store_register): Allow accumulators
|
||||
|
46
sim/tic80/configure
vendored
46
sim/tic80/configure
vendored
@ -1341,19 +1341,27 @@ fi
|
||||
|
||||
|
||||
|
||||
wire_endian="LITTLE_ENDIAN"
|
||||
default_endian="LITTLE_ENDIAN"
|
||||
default_sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN"
|
||||
# Check whether --enable-sim-endian or --disable-sim-endian was given.
|
||||
if test "${enable_sim_endian+set}" = set; then
|
||||
enableval="$enable_sim_endian"
|
||||
case "${enableval}" in
|
||||
yes) case "$target" in
|
||||
*powerpc-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
|
||||
*powerpcle-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
|
||||
*) echo "Unknown target $target" 1>&6; sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
|
||||
esac;;
|
||||
no) sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
|
||||
b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
|
||||
l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
|
||||
yes) if test x"$wire_endian" != x; then
|
||||
sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
|
||||
else
|
||||
echo "No hard-wired endian for target $target" 1>&6
|
||||
sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
|
||||
fi;;
|
||||
no) if test x"$default_endian" != x; then
|
||||
sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
|
||||
else
|
||||
echo "No default endian for target $target" 1>&6
|
||||
sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
|
||||
fi;;
|
||||
*) { echo "configure: error: "Unknown value $enableval for --enable-sim-endian"" 1>&2; exit 1; }; sim_endian="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
|
||||
@ -1399,14 +1407,14 @@ else
|
||||
|
||||
if test "x$cross_compiling" = "xno"; then
|
||||
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
|
||||
echo "configure:1403: checking whether byte ordering is bigendian" >&5
|
||||
echo "configure:1411: checking whether byte ordering is bigendian" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_cv_c_bigendian=unknown
|
||||
# See if sys/param.h defines the BYTE_ORDER macro.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1410 "configure"
|
||||
#line 1418 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -1417,11 +1425,11 @@ int main() {
|
||||
#endif
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:1429: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
# It does; now see whether it defined to BIG_ENDIAN or not.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1425 "configure"
|
||||
#line 1433 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -1432,7 +1440,7 @@ int main() {
|
||||
#endif
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:1444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ac_cv_c_bigendian=yes
|
||||
else
|
||||
@ -1452,7 +1460,7 @@ if test "$cross_compiling" = yes; then
|
||||
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1456 "configure"
|
||||
#line 1464 "configure"
|
||||
#include "confdefs.h"
|
||||
main () {
|
||||
/* Are we little or big endian? From Harbison&Steele. */
|
||||
@ -1465,7 +1473,7 @@ main () {
|
||||
exit (u.c[sizeof (long) - 1] == 1);
|
||||
}
|
||||
EOF
|
||||
if { (eval echo configure:1469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:1477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
ac_cv_c_bigendian=no
|
||||
else
|
||||
@ -1539,17 +1547,17 @@ for ac_hdr in stdlib.h unistd.h string.h strings.h
|
||||
do
|
||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||
echo "configure:1543: checking for $ac_hdr" >&5
|
||||
echo "configure:1551: checking for $ac_hdr" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1548 "configure"
|
||||
#line 1556 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <$ac_hdr>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1561: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
@ -1578,12 +1586,12 @@ done
|
||||
for ac_func in getpid kill
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:1582: checking for $ac_func" >&5
|
||||
echo "configure:1590: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1587 "configure"
|
||||
#line 1595 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1606,7 +1614,7 @@ $ac_func();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:1618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
|
@ -52,6 +52,7 @@ struct sim_state simulation = { 0 };
|
||||
SIM_DESC
|
||||
sim_open (SIM_OPEN_KIND kind,
|
||||
host_callback *callback,
|
||||
struct _bfd *abfd,
|
||||
char **argv)
|
||||
{
|
||||
SIM_DESC sd = &simulation;
|
||||
@ -73,6 +74,13 @@ sim_open (SIM_OPEN_KIND kind,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* establish the simulator configuration */
|
||||
if (sim_config (sd, abfd) != SIM_RC_OK)
|
||||
{
|
||||
sim_module_uninstall (sd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sim_post_argv_init (sd) != SIM_RC_OK)
|
||||
{
|
||||
/* Uninstall the modules to avoid memory leaks,
|
||||
@ -89,9 +97,6 @@ sim_open (SIM_OPEN_KIND kind,
|
||||
memset (&STATE_CPU (sd, 0)->cia, 0, sizeof STATE_CPU (sd, 0)->cia);
|
||||
CPU_STATE (STATE_CPU (sd, 0)) = sd;
|
||||
|
||||
/* establish the simulator configuration */
|
||||
sim_config (sd, LITTLE_ENDIAN/*d30v always big endian*/);
|
||||
|
||||
#define TIC80_MEM_START 0x2000000
|
||||
#define TIC80_MEM_SIZE 0x100000
|
||||
|
||||
|
@ -1,3 +1,12 @@
|
||||
Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* configure: Regenerated to track ../common/aclocal.m4 changes.
|
||||
* config.in: Ditto.
|
||||
|
||||
Mon Aug 25 11:31:23 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Add ABFD argument.
|
||||
|
||||
start-sanitize-v850e
|
||||
Fri Aug 22 10:39:28 1997 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
|
@ -76,6 +76,10 @@ host_callback *v850_callback;
|
||||
|
||||
int v850_debug;
|
||||
|
||||
/* non-zero if we opened prog_bfd */
|
||||
static int prog_bfd_was_opened_p;
|
||||
bfd *prog_bfd;
|
||||
|
||||
static SIM_OPEN_KIND sim_kind;
|
||||
static char *myname;
|
||||
|
||||
@ -110,7 +114,7 @@ static INLINE long
|
||||
hash(insn)
|
||||
long insn;
|
||||
{
|
||||
if ((insn & 0x0600) == 0
|
||||
if ( (insn & 0x0600) == 0
|
||||
|| (insn & 0x0700) == 0x0200
|
||||
|| (insn & 0x0700) == 0x0600
|
||||
|| (insn & 0x0780) == 0x0700)
|
||||
@ -234,6 +238,8 @@ map (addr)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "segmentation fault: access address: %x not below %x or above %x [ep = %x]\n", addr, low_end, high_start, State.regs[30]);
|
||||
|
||||
/* Signal a memory error. */
|
||||
State.exception = SIGSEGV;
|
||||
/* Point to a location not in main memory - renders invalid
|
||||
@ -290,104 +296,6 @@ store_mem (addr, len, data)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
do_format_1_2 (insn)
|
||||
uint32 insn;
|
||||
{
|
||||
struct hash_entry *h;
|
||||
|
||||
h = lookup_hash (insn);
|
||||
OP[0] = insn & 0x1f;
|
||||
OP[1] = (insn >> 11) & 0x1f;
|
||||
(h->ops->func) ();
|
||||
}
|
||||
|
||||
static void
|
||||
do_format_3 (insn)
|
||||
uint32 insn;
|
||||
{
|
||||
struct hash_entry *h;
|
||||
|
||||
h = lookup_hash (insn);
|
||||
OP[0] = (((insn & 0x70) >> 4) | ((insn & 0xf800) >> 8)) << 1;
|
||||
(h->ops->func) ();
|
||||
}
|
||||
|
||||
static void
|
||||
do_format_4 (insn)
|
||||
uint32 insn;
|
||||
{
|
||||
struct hash_entry *h;
|
||||
|
||||
h = lookup_hash (insn);
|
||||
OP[0] = (insn >> 11) & 0x1f;
|
||||
OP[1] = (insn & 0x7f);
|
||||
(h->ops->func) ();
|
||||
}
|
||||
|
||||
static void
|
||||
do_format_5 (insn)
|
||||
uint32 insn;
|
||||
{
|
||||
struct hash_entry *h;
|
||||
|
||||
h = lookup_hash (insn);
|
||||
OP[0] = (((insn & 0x3f) << 15) | ((insn >> 17) & 0x7fff)) << 1;
|
||||
OP[1] = (insn >> 11) & 0x1f;
|
||||
(h->ops->func) ();
|
||||
}
|
||||
|
||||
static void
|
||||
do_format_6 (insn)
|
||||
uint32 insn;
|
||||
{
|
||||
struct hash_entry *h;
|
||||
|
||||
h = lookup_hash (insn);
|
||||
OP[0] = (insn >> 16) & 0xffff;
|
||||
OP[1] = insn & 0x1f;
|
||||
OP[2] = (insn >> 11) & 0x1f;
|
||||
(h->ops->func) ();
|
||||
}
|
||||
|
||||
static void
|
||||
do_format_7 (insn)
|
||||
uint32 insn;
|
||||
{
|
||||
struct hash_entry *h;
|
||||
|
||||
h = lookup_hash (insn);
|
||||
OP[0] = insn & 0x1f;
|
||||
OP[1] = (insn >> 11) & 0x1f;
|
||||
OP[2] = (insn >> 16) & 0xffff;
|
||||
(h->ops->func) ();
|
||||
}
|
||||
|
||||
static void
|
||||
do_format_8 (insn)
|
||||
uint32 insn;
|
||||
{
|
||||
struct hash_entry *h;
|
||||
|
||||
h = lookup_hash (insn);
|
||||
OP[0] = insn & 0x1f;
|
||||
OP[1] = (insn >> 11) & 0x7;
|
||||
OP[2] = (insn >> 16) & 0xffff;
|
||||
(h->ops->func) ();
|
||||
}
|
||||
|
||||
static void
|
||||
do_format_9_10 (insn)
|
||||
uint32 insn;
|
||||
{
|
||||
struct hash_entry *h;
|
||||
|
||||
h = lookup_hash (insn);
|
||||
OP[0] = insn & 0x1f;
|
||||
OP[1] = (insn >> 11) & 0x1f;
|
||||
(h->ops->func) ();
|
||||
}
|
||||
|
||||
void
|
||||
sim_size (power)
|
||||
int power;
|
||||
@ -494,8 +402,10 @@ sim_write (sd, addr, buffer, size)
|
||||
}
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind,argv)
|
||||
sim_open (kind, cb, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback *cb;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
struct simops *s;
|
||||
@ -504,18 +414,19 @@ sim_open (kind,argv)
|
||||
|
||||
sim_kind = kind;
|
||||
myname = argv[0];
|
||||
v850_callback = cb;
|
||||
|
||||
for (p = argv + 1; *p; ++p)
|
||||
if (argv != NULL)
|
||||
{
|
||||
if (strcmp (*p, "-E") == 0)
|
||||
++p; /* ignore endian spec */
|
||||
else
|
||||
for (p = argv + 1; *p; ++p)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (strcmp (*p, "-t") == 0)
|
||||
v850_debug = DEBUG;
|
||||
else
|
||||
if (strcmp (*p, "-t") == 0)
|
||||
v850_debug = DEBUG;
|
||||
else
|
||||
#endif
|
||||
(*v850_callback->printf_filtered) (v850_callback, "ERROR: unsupported option(s): %s\n",*p);
|
||||
(*v850_callback->printf_filtered) (v850_callback, "ERROR: unsupported option(s): %s\n",*p);
|
||||
}
|
||||
}
|
||||
|
||||
/* put all the opcodes in the hash table */
|
||||
@ -547,7 +458,8 @@ sim_close (sd, quitting)
|
||||
SIM_DESC sd;
|
||||
int quitting;
|
||||
{
|
||||
/* nothing to do */
|
||||
if (prog_bfd != NULL && prog_bfd_was_opened_p)
|
||||
bfd_close (prog_bfd);
|
||||
}
|
||||
|
||||
void
|
||||
@ -594,58 +506,33 @@ sim_resume (sd, step, siggnal)
|
||||
|
||||
do
|
||||
{
|
||||
struct hash_entry * h;
|
||||
/* Fetch the current instruction. */
|
||||
inst = RLW (PC);
|
||||
inst = RLW (PC);
|
||||
oldpc = PC;
|
||||
opcode = (inst & 0x07e0) >> 5;
|
||||
|
||||
/* Decode the opcode field. */
|
||||
if ((opcode & 0x30) == 0
|
||||
|| (opcode & 0x38) == 0x10)
|
||||
{
|
||||
do_format_1_2 (inst & 0xffff);
|
||||
PC += 2;
|
||||
}
|
||||
else if ((opcode & 0x3C) == 0x18
|
||||
|| (opcode & 0x3C) == 0x1C
|
||||
|| (opcode & 0x3C) == 0x20
|
||||
|| (opcode & 0x3C) == 0x24
|
||||
|| (opcode & 0x3C) == 0x28)
|
||||
{
|
||||
do_format_4 (inst & 0xffff);
|
||||
PC += 2;
|
||||
}
|
||||
else if ((opcode & 0x3C) == 0x2C)
|
||||
{
|
||||
do_format_3 (inst & 0xffff);
|
||||
/* No PC update, it's done in the instruction. */
|
||||
}
|
||||
else if ((opcode & 0x38) == 0x30)
|
||||
{
|
||||
do_format_6 (inst);
|
||||
PC += 4;
|
||||
}
|
||||
else if ((opcode & 0x3C) == 0x38)
|
||||
{
|
||||
do_format_7 (inst);
|
||||
PC += 4;
|
||||
}
|
||||
else if ((opcode & 0x3E) == 0x3C)
|
||||
{
|
||||
do_format_5 (inst);
|
||||
/* No PC update, it's done in the instruction. */
|
||||
}
|
||||
else if ((opcode & 0x3F) == 0x3E)
|
||||
{
|
||||
do_format_8 (inst);
|
||||
PC += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
do_format_9_10 (inst);
|
||||
PC += 4;
|
||||
}
|
||||
h = lookup_hash (inst);
|
||||
OP[0] = inst & 0x1f;
|
||||
OP[1] = (inst >> 11) & 0x1f;
|
||||
OP[2] = (inst >> 16) & 0xffff;
|
||||
OP[3] = inst;
|
||||
|
||||
// fprintf (stderr, "PC = %x, SP = %x\n", PC, SP );
|
||||
|
||||
if (inst == 0)
|
||||
{
|
||||
fprintf (stderr, "NOP encountered!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
PC += h->ops->func ();
|
||||
|
||||
if (oldpc == PC)
|
||||
{
|
||||
fprintf (stderr, "simulator loop at %x\n", PC );
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check for and handle pending interrupts. */
|
||||
if (intgen_list && (have_nm_generator || !(PSW & PSW_ID)))
|
||||
{
|
||||
@ -792,8 +679,7 @@ sim_kill (sd)
|
||||
}
|
||||
|
||||
void
|
||||
sim_set_callbacks (sd, p)
|
||||
SIM_DESC sd;
|
||||
sim_set_callbacks (p)
|
||||
host_callback *p;
|
||||
{
|
||||
v850_callback = p;
|
||||
@ -1031,14 +917,14 @@ sim_load (sd, prog, abfd, from_tty)
|
||||
int from_tty;
|
||||
{
|
||||
extern bfd *sim_load_file (); /* ??? Don't know where this should live. */
|
||||
bfd *prog_bfd;
|
||||
|
||||
if (prog_bfd != NULL && prog_bfd_was_opened_p)
|
||||
bfd_close (prog_bfd);
|
||||
prog_bfd = sim_load_file (sd, myname, v850_callback, prog, abfd,
|
||||
sim_kind == SIM_OPEN_DEBUG);
|
||||
if (prog_bfd == NULL)
|
||||
return SIM_RC_FAIL;
|
||||
PC = bfd_get_start_address (prog_bfd);
|
||||
if (abfd == NULL)
|
||||
bfd_close (prog_bfd);
|
||||
prog_bfd_was_opened_p = abfd == NULL;
|
||||
return SIM_RC_OK;
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
Mon Aug 25 16:34:33 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Add ABFD argument. Change ARGV to PARGV.
|
||||
|
||||
Tue May 20 10:24:54 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* interp.c (sim_open): Add callback argument.
|
||||
|
@ -322,9 +322,10 @@ sim_kill ()
|
||||
}
|
||||
|
||||
void
|
||||
sim_open (kind,cb,argv)
|
||||
sim_open (kind, cb, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback *cb;
|
||||
struct _bfd *abfd;
|
||||
char **argv;
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user