aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>1996-11-20 09:27:24 +0000
committerDavid Edelsohn <dje.gcc@gmail.com>1996-11-20 09:27:24 +0000
commitcee402dd996073c453c0dbd3340d238e10298a67 (patch)
tree8a80e567c9db671809db2b32ca25a197ce60d929 /sim
parentdb7d7ff8dd4e7fe0360101a368656b232754eb79 (diff)
downloadgdb-cee402dd996073c453c0dbd3340d238e10298a67.zip
gdb-cee402dd996073c453c0dbd3340d238e10298a67.tar.gz
gdb-cee402dd996073c453c0dbd3340d238e10298a67.tar.bz2
* Makefile.in: Delete all stuff moved to ../common/Make-common.in.
(SIM_OBJS,SIM_EXTRA_CFLAGS,SIM_EXTRA_CLEAN): Define. * configure.in: Simplify using macros in ../common/aclocal.m4. Call AC_CHECK_HEADERS(unistd.h). * configure: Regenerated. * config.in: New file. * interp.c: #include "callback.h". * simops.c: #include "config.h". #include <unistd.h> if present.
Diffstat (limited to 'sim')
-rw-r--r--sim/d10v/ChangeLog34
-rw-r--r--sim/d10v/configure.in72
-rw-r--r--sim/d10v/interp.c37
3 files changed, 62 insertions, 81 deletions
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 0976b6a..0e09259 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,37 @@
+Wed Nov 20 01:23:03 1996 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.in: Delete all stuff moved to ../common/Make-common.in.
+ (SIM_OBJS,SIM_EXTRA_CFLAGS,SIM_EXTRA_CLEAN): Define.
+ * configure.in: Simplify using macros in ../common/aclocal.m4.
+ Call AC_CHECK_HEADERS(unistd.h).
+ * configure: Regenerated.
+ * config.in: New file.
+ * interp.c: #include "callback.h".
+ * simops.c: #include "config.h". #include <unistd.h> if present.
+
+Fri Nov 8 16:19:55 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
+
+ * d10v-sim.h (simops): Add flag is_long.
+ (State): Add pc_changed. Instructions which update the PC should
+ use the JMP macro which sets this.
+ (JMP): New macro. Sets the PC and the pc_changed flag.
+
+ * gencode.c (write_opcodes): Add is_long field.
+
+ * interp.c (lookup_hash): If we blindly apply a short opcode's mask
+ to a long opcode we could get a false match. Check the opcode size.
+ (hash): Add a size field to the hash table.
+ (sim_open): Initialize size field in hash table.
+ (sim_resume): Change to logic for setting the PC. Used to increment the
+ PC if it had not been changed. This didn't allow single-instruction loops.
+ Now checks the flag State.pc_changed. Also now stops when ^C is received.
+ (dmem_addr): Fix translation of data segments to unified memory.
+ (sim_ctrl_c): New function. When ^C is received, set stop_simulator flag.
+
+ * simops.c: Changed all branch and jump instructions to use new JMP macro.
+ (OP_20000000): Corrected trace information to show this is a ldi.l, not
+ a ldi.s instruction.
+
Thu Oct 31 19:13:55 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
* interp.c (sim_fetch_register, sim_store_register): Fix bug where
diff --git a/sim/d10v/configure.in b/sim/d10v/configure.in
index d260088..b31f21c 100644
--- a/sim/d10v/configure.in
+++ b/sim/d10v/configure.in
@@ -2,74 +2,8 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.5)dnl
AC_INIT(Makefile.in)
-AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
-AC_CANONICAL_SYSTEM
-AC_ARG_PROGRAM
-AC_PROG_CC
-AC_PROG_INSTALL
-AC_C_BIGENDIAN
+SIM_AC_COMMON
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-AC_C_CROSS
-if test "x$cross_compiling" = "xno"; then
- CC_FOR_BUILD='$(CC)'
-else
- CC_FOR_BUILD=gcc
-fi
+AC_CHECK_HEADERS(unistd.h)
-. ${srcdir}/../../bfd/configure.host
-
-AC_ARG_ENABLE(sim-cflags,
-[ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
-[case "${enableval}" in
- yes) sim_cflags="-O2";;
- trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
- no) sim_cflags="";;
- *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
- echo "Setting sim cflags = $sim_cflags" 6>&1
-fi],[sim_cflags=""])dnl
-
-AC_ARG_ENABLE(sim-debug,
-[ --enable-sim-debug=opts Enable debugging flags],
-[case "${enableval}" in
- yes) sim_debug="-DDEBUG=7";;
- no) sim_debug="-DDEBUG=0";;
- *) sim_debug="-DDEBUG='(${enableval})'";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
- echo "Setting sim debug = $sim_debug" 6>&1
-fi],[sim_cflags=""])dnl
-
-AC_ARG_ENABLE(sim-bswap,
-[ --enable-sim-bswap Use the BSWAP instruction on Intel 486s and Pentiums.],
-[case "${enableval}" in
- yes) sim_bswap="-DUSE_BSWAP";;
- no) sim_bswap="";;
- *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
- echo "Setting bswap flags = $sim_bswap" 6>&1
-fi],[sim_bswap=""])dnl
-
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CFLAGS)
-AC_SUBST(HDEFINES)
-AR=${AR-ar}
-AC_SUBST(AR)
-AC_PROG_RANLIB
-AC_SUBST(sim_cflags)
-AC_SUBST(sim_debug)
-AC_SUBST(sim_bswap)
-
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-AC_C_CROSS
-if test "x$cross_compiling" = "xno"; then
- CC_FOR_BUILD='$(CC)'
-else
- CC_FOR_BUILD=gcc
-fi
-AC_SUBST(CC_FOR_BUILD)
-
-AC_OUTPUT(Makefile)
+SIM_AC_OUTPUT
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index f4c6fe1..b1ce780 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -1,5 +1,6 @@
#include <signal.h>
#include "sysdep.h"
+#include "callback.h"
#include "remote-sim.h"
#include "d10v_sim.h"
@@ -60,6 +61,7 @@ struct hash_entry
struct hash_entry *next;
long opcode;
long mask;
+ int size;
struct simops *ops;
};
@@ -88,7 +90,7 @@ lookup_hash (ins, size)
else
h = &hash_table[(ins & 0x7E00) >> 9];
- while ((ins & h->mask) != h->opcode)
+ while ((ins & h->mask) != h->opcode || h->size != size)
{
if (h->next == NULL)
{
@@ -493,6 +495,7 @@ sim_open (args)
h->ops = s;
h->mask = s->mask;
h->opcode = s->opcode;
+ h->size = s->is_long;
}
}
}
@@ -546,14 +549,14 @@ dmem_addr( addr )
/* unified memory */
/* this is ugly because we allocate unified memory in 128K segments and */
/* dmap addresses 16k segments */
- seg = (DMAP & 0x3ff) >> 2;
+ seg = (DMAP & 0x3ff) >> 3;
if (State.umem[seg] == NULL)
{
(*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unified memory region %d unmapped, pc = 0x%lx\n",
seg, (long)decode_pc ());
exit(1);
}
- return State.umem[seg] + (DMAP & 3) * 0x4000;
+ return State.umem[seg] + (DMAP & 7) * 0x4000;
}
return State.dmem + addr;
@@ -586,20 +589,32 @@ pc_addr()
}
+static int stop_simulator;
+
+static void
+sim_ctrl_c()
+{
+ stop_simulator = 1;
+}
+
+
+/* Run (or resume) the program. */
void
sim_resume (step, siggnal)
int step, siggnal;
{
+ void (*prev) ();
uint32 inst;
- reg_t oldpc = 0;
/* (*d10v_callback->printf_filtered) (d10v_callback, "sim_resume (%d,%d) PC=0x%x\n",step,siggnal,PC); */
-
State.exception = 0;
+ prev = signal(SIGINT, sim_ctrl_c);
+ stop_simulator = step;
+
do
{
inst = get_longword( pc_addr() );
- oldpc = PC;
+ State.pc_changed = 0;
ins_type_counters[ (int)INS_CYCLES ]++;
switch (inst & 0xC0000000)
{
@@ -628,16 +643,15 @@ sim_resume (step, siggnal)
else
PC = RPT_S;
}
-
- /* FIXME */
- if (PC == oldpc)
+ else if (!State.pc_changed)
PC++;
-
}
- while ( !State.exception && !step);
+ while ( !State.exception && !stop_simulator);
if (step && !State.exception)
State.exception = SIGTRAP;
+
+ signal(SIGINT, prev);
}
int
@@ -790,7 +804,6 @@ void
sim_set_callbacks(p)
host_callback *p;
{
-/* printf ("sim_set_callbacks\n"); */
d10v_callback = p;
}