aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-09-22 00:24:46 +0000
committerAndrew Cagney <cagney@redhat.com>1997-09-22 00:24:46 +0000
commitb45caf050caea8283ab17a2f6cc76a2208763132 (patch)
treefab0ce895fbabaa22590490edea9826bc7219ce4 /sim/common
parent2c778bc53aafc06ac2b7705314efcebb5940ebab (diff)
downloadgdb-b45caf050caea8283ab17a2f6cc76a2208763132.zip
gdb-b45caf050caea8283ab17a2f6cc76a2208763132.tar.gz
gdb-b45caf050caea8283ab17a2f6cc76a2208763132.tar.bz2
Add support for --enable-sim-alignment to simulator common aclocal.m4
Add support for --alignment={strict,nonstrict,forced} to simulator common run-time options. For v850 use, make the default NONSTRICT_ALIGNMENT.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog18
-rw-r--r--sim/common/aclocal.m431
-rw-r--r--sim/common/sim-config.h27
-rw-r--r--sim/common/sim-options.c51
4 files changed, 108 insertions, 19 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 3d8e522..14261ef 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,21 @@
+Fri Sep 19 17:45:25 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Fri Sep 19 17:26:14 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-config.c (sim_config): Check for default alignment.
+
+ * sim-options.c (standard_option_handler): Add alignment option.
+
+ * aclocal.m4 (sim_alignment): Allow configuration of hardwired and
+ default alignment requirements on memory accesses.
+
+Fri Sep 19 11:51:35 1997 Jeffrey A Law (law@cygnus.com)
+
+ * sim-load.c (sim_load_file): Return failure if the executable
+ had no loadable sections.
+
Wed Sep 17 13:33:28 1997 Andrew Cagney <cagney@b1.cygnus.com>
* sim-events.c (ETRACE): Use trace_printf not sim_io_printf for
diff --git a/sim/common/aclocal.m4 b/sim/common/aclocal.m4
index dec7e69..d3e6843 100644
--- a/sim/common/aclocal.m4
+++ b/sim/common/aclocal.m4
@@ -21,7 +21,7 @@
AC_DEFUN(SIM_AC_COMMON,
[
# autoconf.info says this should be called right after AC_INIT.
-AC_CONFIG_HEADER(config.h:config.in)
+AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
AC_CANONICAL_SYSTEM
@@ -212,19 +212,36 @@ dnl and SIM_AC_OUTPUT lines.
dnl Specify the alignment restrictions of the target architecture.
dnl Without this option all possible alignment restrictions are accomidated.
+dnl arg[1] is hardwired target alignment
+dnl arg[2] is default target alignment
AC_DEFUN(SIM_AC_OPTION_ALIGNMENT,
+wire_alignment="ifelse([$2],,ifelse([$1],,,[$1]),[$2])"
+default_alignment="ifelse([$2],,ifelse([$1],,,[$1]),[$2])"
+default_sim_alignment="ifelse([$1],,ifelse([$2],,,-DWITH_DEFAULT_ALIGNMENT=[$2]),-DWITH_ALIGNMENT=[$1])"
[
AC_ARG_ENABLE(sim-alignment,
-[ --enable-sim-alignment=align Specify strict or nonstrict alignment.],
+[ --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses.],
[case "${enableval}" in
- yes | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
- no | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
- 0 | default | DEFAULT) sim_alignment="-DWITH_ALIGNMENT=0";;
- *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
+ strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
+ nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
+ forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
+ yes) if test x"$wire_alignment" != x; then
+ sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
+ else
+ echo "No hard-wired alignment for target $target" 1>&6
+ sim_alignment="-DWITH_ALIGNMENT=0"
+ fi;;
+ no) if test x"$default_alignment" != x; then
+ sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
+ else
+ echo "No default alignment for target $target" 1>&6
+ sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
+ fi;;
+ *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
esac
if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
echo "Setting alignment flags = $sim_alignment" 6>&1
-fi],[sim_alignment=""])dnl
+fi],[sim_alignment="${default_sim_alignment}"])dnl
AC_SUBST(sim_alignment)
])dnl
diff --git a/sim/common/sim-config.h b/sim/common/sim-config.h
index 59a8c37..cea3101 100644
--- a/sim/common/sim-config.h
+++ b/sim/common/sim-config.h
@@ -339,28 +339,22 @@ extern int current_environment;
-/* Callback/Default Memory.
+/* Callback & Modulo Memory.
Core includes a builtin memory type (raw_memory) that is
implemented using an array. raw_memory does not require any
additional functions etc.
Callback memory is where the core calls a core device for the data
- it requires.
+ it requires. Callback memory can be layered using priorities.
- Default memory is an extenstion of this where for addresses that do
- not map into either a callback or core memory range a default map
- can be used.
+ Modulo memory is a variation on raw_memory where ADDRESS & (MODULO
+ - 1) is used as the index into the memory array.
- The OEA model uses callback memory for devices and default memory
- for buses.
+ The OEA model uses callback memory for devices.
The VEA model uses callback memory to capture `page faults'.
- While it may be possible to eliminate callback/default memory (and
- hence also eliminate an additional test per memory fetch) it
- probably is not worth the effort.
-
BTW, while raw_memory could have been implemented as a callback,
profiling has shown that there is a biger win (at least for the
x86) in eliminating a function call for the most common
@@ -370,6 +364,10 @@ extern int current_environment;
#define WITH_CALLBACK_MEMORY 1
#endif
+#ifndef WITH_MODULO_MEMORY
+#define WITH_MODULO_MEMORY 0
+#endif
+
/* Alignment:
@@ -399,6 +397,13 @@ extern enum sim_alignments current_alignment;
#define WITH_ALIGNMENT NONSTRICT_ALIGNMENT
#endif
+#if !defined (WITH_DEFAULT_ALIGNMENT)
+#define WITH_DEFAULT_ALIGNMENT 0 /* fatal */
+#endif
+
+
+
+
#define CURRENT_ALIGNMENT (WITH_ALIGNMENT \
? WITH_ALIGNMENT \
: current_alignment)
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 96e1dba..6d4f3da 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -89,6 +89,7 @@ static DECLARE_OPTION_HANDLER (standard_option_handler);
#define OPTION_ARCHITECTURE (OPTION_START + 3)
#define OPTION_TARGET (OPTION_START + 4)
#define OPTION_ARCHITECTURE_INFO (OPTION_START + 5)
+#define OPTION_ALIGNMENT (OPTION_START + 6)
static const OPTION standard_options[] =
{
@@ -102,6 +103,10 @@ static const OPTION standard_options[] =
standard_option_handler },
#endif
+ { {"alignment", required_argument, NULL, OPTION_ALIGNMENT},
+ '\0', "strict|nonstrict|forced", "Set memory access alignment",
+ standard_option_handler },
+
{ {"debug", no_argument, NULL, 'D'},
'D', NULL, "Print debugging messages",
standard_option_handler },
@@ -194,6 +199,50 @@ standard_option_handler (sd, opt, arg, is_command)
break;
#endif
+ case OPTION_ALIGNMENT:
+ if (strcmp (arg, "strict") == 0)
+ {
+ if (WITH_ALIGNMENT == 0 || WITH_ALIGNMENT == STRICT_ALIGNMENT)
+ {
+ current_alignment = STRICT_ALIGNMENT;
+ break;
+ }
+ }
+ else if (strcmp (arg, "nonstrict") == 0)
+ {
+ if (WITH_ALIGNMENT == 0 || WITH_ALIGNMENT == NONSTRICT_ALIGNMENT)
+ {
+ current_alignment = NONSTRICT_ALIGNMENT;
+ break;
+ }
+ }
+ else if (strcmp (arg, "forced") == 0)
+ {
+ if (WITH_ALIGNMENT == 0 || WITH_ALIGNMENT == FORCED_ALIGNMENT)
+ {
+ current_alignment = FORCED_ALIGNMENT;
+ break;
+ }
+ }
+ else
+ {
+ sim_io_eprintf (sd, "Invalid alignment specification `%s'\n", arg);
+ return SIM_RC_FAIL;
+ }
+ switch (WITH_ALIGNMENT)
+ {
+ case STRICT_ALIGNMENT:
+ sim_io_eprintf (sd, "Simulator compiled for strict alignment only.\n");
+ break;
+ case NONSTRICT_ALIGNMENT:
+ sim_io_eprintf (sd, "Simulator compiled for nonsitrct alignment only.\n");
+ break;
+ case FORCED_ALIGNMENT:
+ sim_io_eprintf (sd, "Simulator compiled for forced alignment only.\n");
+ break;
+ }
+ return SIM_RC_FAIL;
+
case 'D' :
if (! WITH_DEBUG)
sim_io_eprintf (sd, "Debugging not compiled in, `-D' ignored\n");
@@ -556,7 +605,7 @@ sim_print_help (sd, is_command)
{
const char *chp = opt->doc;
- int doc_width = 80 - indent;
+ unsigned doc_width = 80 - indent;
while (strlen (chp) >= doc_width) /* some slack */
{
const char *end = chp + doc_width - 1;