diff options
Diffstat (limited to 'sim/common')
-rw-r--r-- | sim/common/ChangeLog | 32 | ||||
-rw-r--r-- | sim/common/aclocal.m4 | 110 | ||||
-rw-r--r-- | sim/common/nrun.c | 39 | ||||
-rw-r--r-- | sim/common/run.c | 10 | ||||
-rw-r--r-- | sim/common/sim-config.c | 187 | ||||
-rw-r--r-- | sim/common/sim-config.h | 106 |
6 files changed, 367 insertions, 117 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index ba550cc..7fc83af 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -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) diff --git a/sim/common/aclocal.m4 b/sim/common/aclocal.m4 index 68896d0..541420f 100644 --- a/sim/common/aclocal.m4 +++ b/sim/common/aclocal.m4 @@ -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, diff --git a/sim/common/nrun.c b/sim/common/nrun.c index 17fdfcc..16525c9 100644 --- a/sim/common/nrun.c +++ b/sim/common/nrun.c @@ -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 diff --git a/sim/common/run.c b/sim/common/run.c index dff278d..3f032d3 100644 --- a/sim/common/run.c +++ b/sim/common/run.c @@ -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); diff --git a/sim/common/sim-config.c b/sim/common/sim-config.c index c6ee907..5f2efc3 100644 --- a/sim/common/sim-config.c +++ b/sim/common/sim-config.c @@ -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 diff --git a/sim/common/sim-config.h b/sim/common/sim-config.h index 7278b3b..157eb1d 100644 --- a/sim/common/sim-config.h +++ b/sim/common/sim-config.h @@ -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,24 +266,21 @@ 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 -#define MAX_NR_PROCESSORS 1 #endif +#ifndef MAX_NR_PROCESSORS +#define MAX_NR_PROCESSORS 1 #endif - /* Word size of host/target: Set these according to your host and target requirements. At this @@ -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. + + 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). - This model. Instead allows both little and big endian modes to - either take exceptions or handle miss aligned transfers. + 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 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). */ +enum sim_alignments { + MIXED_ALIGNMENT, + NONSTRICT_ALIGNMENT, + STRICT_ALIGNMENT, + FORCED_ALIGNMENT, +}; -#if defined (WITH_ALIGNMENT) +extern enum sim_alignments current_alignment; -#define NONSTRICT_ALIGNMENT 1 -#define STRICT_ALIGNMENT 2 +#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); |