aboutsummaryrefslogtreecommitdiff
path: root/sim/m32r/mloopx.in
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>1998-02-05 21:01:06 +0000
committerDoug Evans <dje@google.com>1998-02-05 21:01:06 +0000
commitb8a9943dd4f35984507734e2ad21ad60e4f42d4e (patch)
tree6452099c47e76691f105259bc6149a2e99886110 /sim/m32r/mloopx.in
parent5bd5a5c7a2647a21aa0662e56c323ac5f76bdbcd (diff)
downloadgdb-b8a9943dd4f35984507734e2ad21ad60e4f42d4e.zip
gdb-b8a9943dd4f35984507734e2ad21ad60e4f42d4e.tar.gz
gdb-b8a9943dd4f35984507734e2ad21ad60e4f42d4e.tar.bz2
* Makefile.in (m32r.o): Depend on cpu.h
(extract.o): Pass -DSCACHE_P. * mloop.in (extract{16,32}): Update call to m32r_decode. * arch.h,cpu.h,cpuall.h,decode.[ch]: Regenerate. * extract.c,model.c,sem-switch.c,sem.c: Regenerate. * sim-main.h: #include "ansidecl.h". Don't include cpu-opc.h, done by arch.h. start-sanitize-m32rx * Makefile.in (M32RX_OBJS): Build m32rx support now. (m32rx.o): New rule. * m32r-sim.h (m32rx_h_cr_[gs]et): Define. * m32rx.c (m32rx_{fetch,store}_register): Update {get,set} of PC. (m32rx_h_accums_get): New function. * mloopx.in: Update call to m32rx_decode. Rewrite exec loop. * cpux.h,decodex.[ch],modelx.c,readx.c,semx.c: Regenerate. end-sanitize-m32rx
Diffstat (limited to 'sim/m32r/mloopx.in')
-rw-r--r--sim/m32r/mloopx.in133
1 files changed, 133 insertions, 0 deletions
diff --git a/sim/m32r/mloopx.in b/sim/m32r/mloopx.in
new file mode 100644
index 0000000..533aca5
--- /dev/null
+++ b/sim/m32r/mloopx.in
@@ -0,0 +1,133 @@
+# Simulator main loop for m32rx. -*- C -*-
+# Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Simulators.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# 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.
+
+# Syntax:
+# /bin/sh mainloop.in init|support|{full,fast}-{extract,exec}-{scache,noscache}
+
+# ??? After a few more ports are done, revisit.
+# Will eventually need to machine generate a lot of this.
+
+case "x$1" in
+
+xsupport)
+
+cat <<EOF
+
+EOF
+
+;;
+
+xinit)
+
+cat <<EOF
+ USI insn,insn1,insn2;
+ DECODE *decode,*d1,*d2;
+ int icount,icount2;
+ ARGBUF abufs[MAX_PARALLEL_INSNS];
+ SEM_ARG sem_arg;
+
+EOF
+
+;;
+
+xfull-extract-* | xfast-extract-*)
+
+cat <<EOF
+{
+ PCADDR pc = CPU (h_pc);
+
+ if ((pc & 3) != 0)
+ {
+ insn1 = GETIMEMUHI (current_cpu, pc);
+ insn1 &= 0x7fff;
+ d1 = m32rx_decode (current_cpu, pc, insn1);
+ icount = 1;
+ }
+ else
+ {
+ insn1 = GETIMEMUSI (current_cpu, pc);
+ if ((SI) insn1 < 0)
+ {
+ d1 = m32rx_decode (current_cpu, pc, insn1 >> 16);
+ icount = 1;
+ }
+ else
+ {
+ if (insn & 0x8000)
+ {
+ insn2 = insn1 & 0x7fff;
+ insn1 = insn1 >> 16;
+ d1 = m32rx_decode (current_cpu, pc, insn1);
+ d2 = m32rx_decode (current_cpu, pc, insn2);
+ icount = 2;
+ }
+ else
+ {
+ insn1 = insn1 >> 16;
+ d1 = m32rx_decode (current_cpu, pc, insn1);
+ icount = 1;
+ }
+ }
+ }
+
+ icount2 = icount;
+ insn = insn1;
+ decode = d1;
+ do
+ {
+#define DEFINE_SWITCH
+#include "readx.c"
+
+ insn = insn2;
+ decode = d2;
+ }
+ while (--icount2 > 0);
+}
+EOF
+
+;;
+
+xfull-exec-* | xfast-exec-*)
+
+cat <<EOF
+{
+ decode = d1;
+ do
+ {
+ PCADDR new_pc;
+ TRACE_INSN_INIT (current_cpu);
+ TRACE_INSN (current_cpu, sc->argbuf.opcode, (const struct argbuf *) &sc->argbuf, sc->argbuf.addr);
+ new_pc = (*decode->semantic) (current_cpu, &sc->argbuf);
+ TRACE_INSN_FINI (current_cpu);
+ PROFILE_COUNT_INSN (current_cpu, pc, CGEN_INSN_INDEX (sc->argbuf.opcode));
+ CPU (h_pc) = new_pc;
+ decode = d2;
+ }
+ while (--icount > 0);
+}
+EOF
+
+;;
+
+*)
+ echo "Invalid argument to mainloop.in: $1" >&2
+ exit 1
+ ;;
+
+esac