aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog20
-rw-r--r--sim/common/aclocal.m459
-rw-r--r--sim/common/sim-config.c16
-rw-r--r--sim/common/sim-config.h27
-rw-r--r--sim/common/sim-types.h22
5 files changed, 108 insertions, 36 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 11cf423..67bee19 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,23 @@
+Sat Jan 31 18:15:41 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Sat Jan 31 18:03:55 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-types.h (address_word): Typedef according to
+ WITH_TARGET_ADDRESS_BITSIZE.
+ (signed_cell, unsigned_cell, natural_cell): Ditto using
+ WITH_TARGET_CELL_BITSIZE.
+
+ * sim-config.h (WITH_TARGET_ADDRESS_BITSIZE): Define.
+ (WITH_TARGET_CELL_BITSIZE): Define.
+ (WITH_HOST_WORD_BITSIZE): Delete.
+
+ * sim-config.c (print_sim_config): Update.
+
+ * aclocal.m4 (SIM_AC_OPTION_BITSIZE): Add support for
+ configuration of address and OpenFirmware cell sizes.
+
Fri Jan 30 09:36:33 1998 Andrew Cagney <cagney@b1.cygnus.com>
* sim-engine.h (sim_engine_run): Add argument nr_cpus.
diff --git a/sim/common/aclocal.m4 b/sim/common/aclocal.m4
index e5678d9..990dfa2 100644
--- a/sim/common/aclocal.m4
+++ b/sim/common/aclocal.m4
@@ -326,40 +326,65 @@ dnl --enable-sim-bitsize is for developers of the simulator
dnl It specifies the number of BITS in the target.
dnl arg[1] is the number of bits in a word
dnl arg[2] is the number assigned to the most significant bit
-dnl In the future this macro may also take arguments for specifying
-dnl the number of bits in an address and an Open Firmware cell.
+dnl arg[3] is the number of bits in an address
+dnl arg[4] is the number of bits in an OpenFirmware cell.
dnl FIXME: this information should be obtained from bfd/archure
AC_DEFUN(SIM_AC_OPTION_BITSIZE,
-wire_bitsize="[$1]"
-wire_msb="[$2]"
+wire_word_bitsize="[$1]"
+wire_word_msb="[$2]"
+wire_address_bitsize="[$3]"
+wire_cell_bitsize="[$4]"
[AC_ARG_ENABLE(sim-bitsize,
-[ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
-[case "${enableval}" in
- 64,63) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
- 32,31) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
- 64,0) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
- 32,0) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
- 32) if test x"$wire_msb" != x -a x"$wire_msb" != x0; then
+[ --enable-sim-bitsize=N Specify target bitsize (32 or 64).],
+[sim_bitsize=
+case "${enableval}" in
+ 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
+ 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
+ 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
+ 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
+ 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
else
sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
fi ;;
- 64) if test x"$wire_msb" != x -a x"$wire_msb" != x0; then
+ 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
else
sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
fi ;;
- *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64"); sim_bitsize="";;
+ *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64") ;;
+esac
+# address bitsize
+tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
+case x"${tmp}" in
+ x ) ;;
+ x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
+ x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
+ * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval. Expected 32 or 64") ;;
+esac
+# cell bitsize
+tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
+case x"${tmp}" in
+ x ) ;;
+ x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
+ x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
+ * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64") ;;
esac
if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
echo "Setting bitsize flags = $sim_bitsize" 6>&1
fi],
[sim_bitsize=""
-if test x"$wire_bitsize" != x; then
- sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_bitsize"
+if test x"$wire_word_bitsize" != x; then
+ sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
+fi
+if test x"$wire_word_msb" != x; then
+ sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
+fi
+if test x"$wire_address_bitsize" != x; then
+ sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
fi
-if test x"$wire_msb" != x; then
- sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_msb"
+if test x"$wire_cell_bitsize" != x; then
+ sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
fi])dnl
])
AC_SUBST(sim_bitsize)
diff --git a/sim/common/sim-config.c b/sim/common/sim-config.c
index b7913e4..278219e 100644
--- a/sim/common/sim-config.c
+++ b/sim/common/sim-config.c
@@ -163,7 +163,7 @@ sim_config (SIM_DESC sd)
/* set the target byte order */
-#if (WITH_DEVICES)
+#if (WITH_TREE_PROPERTIES)
if (current_target_byte_order == 0)
current_target_byte_order
= (tree_find_boolean_property (root, "/options/little-endian?")
@@ -227,7 +227,7 @@ sim_config (SIM_DESC sd)
/* set the environment */
-#if (WITH_DEVICES)
+#if (WITH_TREE_PROPERTIES)
if (current_environment == ALL_ENVIRONMENT)
{
const char *env =
@@ -249,7 +249,7 @@ sim_config (SIM_DESC sd)
/* set the alignment */
-#if defined (WITH_DEVICES)
+#if (WITH_TREE_PROPERTIES)
if (current_alignment == 0)
current_alignment =
(tree_find_boolean_property(root, "/openprom/options/strict-alignment?")
@@ -322,11 +322,17 @@ print_sim_config (SIM_DESC sd)
sim_io_printf (sd, "WITH_STDIO = %s\n",
config_stdio_to_a (WITH_STDIO));
+ sim_io_printf (sd, "WITH_TARGET_WORD_MSB = %d\n",
+ WITH_TARGET_WORD_MSB);
+
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);
+ sim_io_printf (sd, "WITH_TARGET_ADDRESS_BITSIZE = %d\n",
+ WITH_TARGET_ADDRESS_BITSIZE);
+
+ sim_io_printf (sd, "WITH_TARGET_CELL_BITSIZE = %d\n",
+ WITH_TARGET_CELL_BITSIZE);
sim_io_printf (sd, "WITH_ENVIRONMENT = %s\n",
config_environment_to_a (WITH_ENVIRONMENT));
diff --git a/sim/common/sim-config.h b/sim/common/sim-config.h
index f09eb98..330417d 100644
--- a/sim/common/sim-config.h
+++ b/sim/common/sim-config.h
@@ -204,6 +204,10 @@
/* INSERT HERE - additional hosts that do not have LITTLE_ENDIAN and
BIG_ENDIAN definitions available. */
+
+/* Until devices and tree properties are sorted out, tell sim-config.c
+ not to call the tree_find_foo fns. */
+#define WITH_TREE_PROPERTIES 0
/* endianness of the host/target:
@@ -272,7 +276,7 @@ extern int current_target_byte_order;
The actual number of processors is taken from the device
/options/smp@<nr-cpu> */
-#if defined (WITH_SMP) && WITH_SMP > 0
+#if defined (WITH_SMP) && (WITH_SMP > 0)
#define MAX_NR_PROCESSORS WITH_SMP
#endif
@@ -281,19 +285,24 @@ extern int current_target_byte_order;
#endif
-/* Word size of host/target:
+/* Size of target word, address and OpenFirmware Cell:
- Set these according to your host and target requirements. At this
- point in time, I've only compiled (not run) for a 64bit and never
- built for a 64bit host. This will always remain a compile time
- option */
+ The target word size is determined by the natural size of its
+ reginsters.
+
+ On most hosts, the address and cell are the same size as a target
+ word. */
#ifndef WITH_TARGET_WORD_BITSIZE
-#define WITH_TARGET_WORD_BITSIZE 32 /* compiled only */
+#define WITH_TARGET_WORD_BITSIZE 32
+#endif
+
+#ifndef WITH_TARGET_ADDRESS_BITSIZE
+#define WITH_TARGET_ADDRESS_BITSIZE WITH_TARGET_WORD_BITSIZE
#endif
-#ifndef WITH_HOST_WORD_BITSIZE
-#define WITH_HOST_WORD_BITSIZE 32 /* 64bit ready? */
+#ifndef WITH_TARGET_CELL_BITSIZE
+#define WITH_TARGET_CELL_BITSIZE WITH_TARGET_WORD_BITSIZE
#endif
diff --git a/sim/common/sim-types.h b/sim/common/sim-types.h
index 0adb01d..ddf9095 100644
--- a/sim/common/sim-types.h
+++ b/sim/common/sim-types.h
@@ -68,8 +68,6 @@ typedef unsigned long unsigned32;
typedef long long natural64;
typedef signed long long signed64;
typedef unsigned long long unsigned64;
-typedef struct { unsigned64 a[2]; } unsigned128;
-typedef struct { signed64 a[2]; } signed128;
#define UNSIGNED64(X) (X##ULL)
#define SIGNED64(X) (X##LL)
@@ -82,8 +80,6 @@ typedef struct { signed64 a[2]; } signed128;
typedef __int64 natural64;
typedef signed __int64 signed64;
typedef unsigned __int64 unsigned64;
-typeded struct { unsigned64 hi; unsigned64 lo; } unsigned128;
-typeded struct { signed64 hi; signed64 lo; } signed128;
#define UNSIGNED64(X) (X##ui64)
#define SIGNED64(X) (X##i64)
@@ -92,6 +88,10 @@ typeded struct { signed64 hi; signed64 lo; } signed128;
#define UNSIGNED32(X) (X##i32)
#endif /* _MSC_VER */
+
+typedef struct { unsigned64 a[2]; } unsigned128;
+typedef struct { signed64 a[2]; } signed128;
+
#else /* Not GNUC or _MSC_VER */
/* Not supported */
#endif
@@ -136,11 +136,23 @@ typedef signed32 signed_word;
/* Other instructions */
+#if (WITH_TARGET_ADDRESS_BITSIZE == 64)
+typedef unsigned64 address_word;
+#endif
+#if (WITH_TARGET_ADDRESS_BITSIZE == 32)
typedef unsigned32 address_word;
+#endif
-/* IEEE 1275 cell size - only support 32bit mode at present */
+/* IEEE 1275 cell size */
+#if (WITH_TARGET_CELL_BITSIZE == 64)
+typedef natural64 natural_cell;
+typedef unsigned64 unsigned_cell;
+typedef signed64 signed_cell;
+#endif
+#if (WITH_TARGET_CELL_BITSIZE == 32)
typedef natural32 natural_cell;
typedef unsigned32 unsigned_cell;
typedef signed32 signed_cell;
+#endif
#endif /* _SIM_TYPES_H_ */