From dde54cb8459c5916e2e0bce83cc899a97e04f4d9 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Mon, 9 Feb 1998 22:51:21 +0000 Subject: [PATCH] * genmloop.sh (@cpu@_engine_run): Delete `current_state'. (engine_resume): Likewise. Make `engine' volatile. Save copy of cpu pointer in volatile object. --- sim/common/ChangeLog | 6 + sim/common/genmloop.sh | 423 ++++++++++++++++++++++++++++++++++------- 2 files changed, 360 insertions(+), 69 deletions(-) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index cdddbfa785..c713351880 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,9 @@ +Mon Feb 9 14:48:37 1998 Doug Evans + + * genmloop.sh (@cpu@_engine_run): Delete `current_state'. + (engine_resume): Likewise. Make `engine' volatile. Save copy + of cpu pointer in volatile object. + Thu Feb 5 13:27:04 1998 Doug Evans * cgen-sim.h (EX_FN_NAME): _exc_ -> _ex_. diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh index fb35220575..31716d117d 100644 --- a/sim/common/genmloop.sh +++ b/sim/common/genmloop.sh @@ -1,11 +1,48 @@ # This shell script emits a C file. -*- C -*- # Generate the main loop of the simulator. -# Syntax: genmloop.sh mono|multi cpu mainloop.in +# Syntax: genmloop.sh /bin/sh [options] cpu mainloop.in +# Options: [-mono|-multi] -scache -fast -parallel +# +# -scache: use the scache +# -fast: include support for fast execution in addition to full featured mode +# -parallel: cpu can execute multiple instructions parallely +# # FIXME: "multi" support is wip. -type=$1 -cpu=$2 -file=$3 +# TODO +# - move this C code to mainloop.in +# - keep genmloop.sh +# - build exec.in from .cpu file +# - have each cpu provide handwritten cycle.in +# - integrate with common/sim-engine.[ch] +# - for sparc, have two main loops, outer one handles delay slot when npc != 0 +# - inner loop does not handle delay slots, pc = pc + 4 + +type=mono +#scache= +#fast= +#parallel= + +shell=$1 ; shift + +while true +do + case $1 in + -mono) type=mono ;; + -multi) type=multi ;; + -no-scache) ;; + -scache) scache=yes ;; + -no-fast) ;; + -fast) fast=yes ;; + -no-parallel) ;; + -parallel) parallel=yes ;; + *) break ;; + esac + shift +done + +cpu=$1 +file=$2 cat <jmpbuf = &buf; + if (setjmp (buf)) { - TRACE_INSN_FINI (current_cpu); - PROFILE_EXEC_TIME (CPU_PROFILE_DATA (current_cpu)) + engine->jmpbuf = NULL; + TRACE_INSN_FINI ((sim_cpu *) cpu); + PROFILE_EXEC_TIME (CPU_PROFILE_DATA (cpu)) += sim_elapsed_time_since (start_time); - PROFILE_TOTAL_INSN_COUNT (CPU_PROFILE_DATA (current_cpu)) + PROFILE_TOTAL_INSN_COUNT (CPU_PROFILE_DATA (cpu)) += insn_count; return; } + /* ??? Restart support to be added in time. */ + + /* The computed goto switch can be used, and while the number of blocks + may swamp the relatively few that this function contains, when running + with the scache we put the actual semantic code in their own + functions. */ + +EOF + +if [ x$fast = xyes ] ; then + cat <argbuf.addr != pc) + { + insn_t insn; + + PROFILE_COUNT_SCACHE_MISS (current_cpu); + +/* begin full-extract-scache */ EOF -# Copy of main loop that uses the various compiled in features. -# FIXME: May want more than one copy of this. -${SHELL} $file normal +${SHELL} $file full-extract-scache cat <argbuf.addr != pc) + { + insn_t insn; + +/* begin fast-extract-scache */ +EOF + +${SHELL} $file fast-extract-scache + +cat <