Éder F. Zulian has uploaded this change for review. ( https://gem5-review.googlesource.com/5101

Change subject: util, scripts: helpful scripts, patches and doc.
......................................................................

util, scripts: helpful scripts, patches and doc.

Contributing back with some scripts, patches and documentation.

Change-Id: Ifb4055bac5427789bcd15f9d57f57955274994d7
---
A util/gem5_tnt/README
A util/gem5_tnt/arch/arm/README
A util/gem5_tnt/arch/arm/getarmfsbenchmarks.sh
A util/gem5_tnt/arch/arm/getarmsebenchmarks.sh
A util/gem5_tnt/arch/arm/runarmfsbenchmarks.sh
A util/gem5_tnt/arch/arm/runarmsebenchmarks.sh
A util/gem5_tnt/common/defaults.in
A util/gem5_tnt/common/util.in
A util/gem5_tnt/depinstall.sh
A util/gem5_tnt/getbenchmarks.sh
A util/gem5_tnt/getdoc.sh
A util/gem5_tnt/getfs.sh
A util/gem5_tnt/getrepos.sh
A util/gem5_tnt/patches/gem5/asimbench/README
A util/gem5_tnt/patches/gem5/asimbench/gem5_ARMv7a-ICS-Android.SMP.Asimbench-v3.patch A util/gem5_tnt/patches/gem5/asimbench/gem5_ARMv7a-ICS-Android.SMP.Asimbench-v3_RawIdeDisk.patch
A util/gem5_tnt/patches/parsec/x86_host_cross_aarch64-linux-gnu.patch
17 files changed, 1,526 insertions(+), 0 deletions(-)



diff --git a/util/gem5_tnt/README b/util/gem5_tnt/README
new file mode 100644
index 0000000..6a1855b
--- /dev/null
+++ b/util/gem5_tnt/README
@@ -0,0 +1,50 @@
+gem5 Tips & Tricks
+------------------
+
+This folder contains some tips and tricks about gem5.
+
+ - depinstall.sh: installs some known dependencies.
+ - getrepos.sh: clones gem5 related repositories.
+ - getfs.sh: downloads full system files.
+ - getdoc.sh: downloads documentation and tutorials.
+ - getbenchmarks.sh: downloads some benchmarks.
+
+See also:
+
+ - arch/arm/README: you'll find some useful scripts for running benchmarks
+   cross-compiled for the arm architecture on gem5.
+ - patches/gem5/asimbench/README: you'll find how you can run a version of
+   android on your gem5!
+
+For optimal experience install cowsay and libnotify-bin.
+
+Running the scripts
+~~~~~~~~~~~~~~~~~~~
+
+A suggestion on how to run the scripts follows:
+
+Install known dependencies (note that this one has to be run with sudo or as
+root):
+
+sudo bash depinstall.sh
+
+Get documentation:
+
+bash getdoc.sh
+
+Get repositories:
+
+bash getrepos.sh
+
+Get some full system simulation files:
+
+bash getfs.sh
+
+Get some benchmark suites:
+
+bash getbenchmarks.sh
+
+The default directory for downloads is $HOME/gem5_tnt. That means a new
+directory called gem5_tnt will be created in your home folder and populated
+with relevant documentation, repositories, etc. In case you want to change the
+default paths edit the file common/defaults.in before running the scripts.
diff --git a/util/gem5_tnt/arch/arm/README b/util/gem5_tnt/arch/arm/README
new file mode 100644
index 0000000..fbf6c01
--- /dev/null
+++ b/util/gem5_tnt/arch/arm/README
@@ -0,0 +1,14 @@
+gem5 Tips & Tricks
+------------------
+
+Before running the scripts below make sure everything else is setup! You're
+all done if you followed the steps described in ../../README.
+
+ - getarmsebenchmarks.sh: builds some benchmark programs from the LLVM
+   test-suite for arm.
+ - runarmsebenchmarks.sh: builds gem5 and runs some of the above-mentioned
+   benchmarks (system call emulation).
+ - getarmfsbenchmarks.sh: builds some benchmark programs from the parsec suite
+   for arm.
+ - runarmfsbenchmarks.sh: builds gem5 and runs some of the above-mentioned
+   benchmarks (full-system simulation).
diff --git a/util/gem5_tnt/arch/arm/getarmfsbenchmarks.sh b/util/gem5_tnt/arch/arm/getarmfsbenchmarks.sh
new file mode 100755
index 0000000..b6f862a
--- /dev/null
+++ b/util/gem5_tnt/arch/arm/getarmfsbenchmarks.sh
@@ -0,0 +1,108 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+source ../../common/defaults.in
+source ../../common/util.in
+
+basedir="$PWD/../.."
+
+toolchain=gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu
+toolchaintarball=$toolchain.tar.xz
+wgethis=(
+"$TOOLCHAINSDIR_ARM:https://releases.linaro.org/components/toolchain/binaries/latest-5/aarch64-linux-gnu/$toolchaintarball";
+)
+
+greetings
+wgetintodir wgethis[@]
+
+toolchaindir=$TOOLCHAINSDIR_ARM/$toolchain
+if [[ ! -d $toolchaindir ]]; then
+       tar -xaf $TOOLCHAINSDIR_ARM/$toolchaintarball -C $TOOLCHAINSDIR_ARM
+fi
+
+parsecdir="$BENCHMARKSDIR/parsec-3.0"
+parsectarball="parsec-3.0.tar.gz"
+if [[ ! -d $parsecdir ]]; then
+       tar -xaf $BENCHMARKSDIR/$parsectarball -C $BENCHMARKSDIR
+fi
+
+patchfile="$basedir/patches/parsec/x86_host_cross_aarch64-linux-gnu.patch"
+patch -d $BENCHMARKSDIR/$parsecdir -p1 < $patchfile
+
+tempdir=`mktemp -d`
+wget -O $tempdir/config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' +wget -O $tempdir/config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'
+replacefiles="
+config.guess
+config.sub
+"
+for f in $replacefiles; do
+ find $BENCHMARKSDIR/$parsecdir -name $f -type f -print0 -execdir cp {} $f.backup \; + find $BENCHMARKSDIR/$parsecdir -name $f -type f -print0 -execdir cp $tempdir/$f {} \;
+done
+
+sedfile="$BENCHMARKSDIR/$parsecdir/config/gcc.bldconf"
+cchome="$toolchaindir"
+binutilhome="$toolchaindir/aarch64-linux-gnu"
+crossprefix="aarch64-linux-gnu-"
+cc="$cchome/bin/${crossprefix}gcc"
+cxx="$cchome/bin/${crossprefix}g++"
+cpp="$cchome/bin/${crossprefix}cpp"
+sed -i "s@CC_HOME=\"/usr\"@CC_HOME=\"$cchome\"@g" $sedfile
+sed -i "s@BINUTIL_HOME=\"/usr\"@BINUTIL_HOME=\"$binutilhome\"@g" $sedfile
+sed -i "s@CC=\"\${CC_HOME}/bin/gcc\"@CC=\"$cc\"@g" $sedfile
+sed -i "s@CXX=\"\${CC_HOME}/bin/g++\"@CXX=\"$cxx\"@g" $sedfile
+sed -i "s@CPP=\"\${CC_HOME}/bin/cpp\"@CPP=\"$cpp\"@g" $sedfile
+
+cd $parsecdir
+source env.sh
+export PARSECPLAT="aarch64-linux"
+
+benchmarks="
+blackscholes
+facesim
+ferret
+fluidanimate
+freqmine
+"
+
+for b in $benchmarks; do
+       parsecmgmt -a build -c gcc-hooks -p $b
+done
+
+basepath="$parsecdir/pkgs/apps"
+for b in $benchmarks; do
+       elf=$basepath/$b/inst/aarch64-linux.gcc-hooks/bin/$b
+       file $elf
+done
diff --git a/util/gem5_tnt/arch/arm/getarmsebenchmarks.sh b/util/gem5_tnt/arch/arm/getarmsebenchmarks.sh
new file mode 100755
index 0000000..ba325b4
--- /dev/null
+++ b/util/gem5_tnt/arch/arm/getarmsebenchmarks.sh
@@ -0,0 +1,77 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+source ../../common/defaults.in
+source ../../common/util.in
+
+toolchain=gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu
+toolchaintarball=$toolchain.tar.xz
+
+wgethis=(
+"$TOOLCHAINSDIR_ARM:https://releases.linaro.org/components/toolchain/binaries/latest-5/aarch64-linux-gnu/$toolchaintarball";
+)
+
+gitrepos=(
+"$BENCHMARKSDIR:http://llvm.org/git/test-suite.git";
+)
+
+greetings
+wgetintodir wgethis[@]
+gitcloneintodir gitrepos[@]
+
+toolchaindir=$TOOLCHAINSDIR_ARM/$toolchain
+if [[ ! -d $toolchaindir ]]; then
+       tar -xaf $TOOLCHAINSDIR_ARM/$toolchaintarball -C $TOOLCHAINSDIR_ARM
+fi
+
+cd $BENCHMARKSDIR/test-suite
+git checkout release_50
+cd SingleSource/Benchmarks/Stanford
+
+cat > Makefile << EOM
+sysroot=$toolchaindir/aarch64-linux-gnu/libc
+cc=$toolchaindir/bin/aarch64-linux-gnu-gcc
+sources=\$(wildcard *.c)
+bins=\$(patsubst %.c,%,\$(sources))
+all: \$(bins)
+       @echo Done.
+%: %.c
+       \$(cc) --sysroot=\$(sysroot) --no-sysroot-suffix --static \$< -o \$@
+clean:
+       rm -rf \$(bins)
+EOM
+
+getnumprocs np
+make clean
+make -j$np
diff --git a/util/gem5_tnt/arch/arm/runarmfsbenchmarks.sh b/util/gem5_tnt/arch/arm/runarmfsbenchmarks.sh
new file mode 100755
index 0000000..d1f2fd8
--- /dev/null
+++ b/util/gem5_tnt/arch/arm/runarmfsbenchmarks.sh
@@ -0,0 +1,119 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+source ../../common/defaults.in
+source ../../common/util.in
+
+tarballs=`ls $FSDIRARM/*.tar.*`
+for tb in $tarballs; do
+       dir=`expr $tb : '\(.*\).tar.*'`
+       if [[ ! -d $dir ]]; then
+               mkdir -p $dir
+               tar -xaf $tb -C $dir
+       fi
+done
+
+
+imgdir="$FSDIRARM/aarch-system-20170616/disks"
+baseimg="$imgdir/linaro-minimal-aarch64.img"
+bmsuite="parsec-3.0"
+img="$imgdir/linaro-minimal-aarch64-${bmsuite}-inside.img"
+bmsuiteroot="home"
+if [[ ! -e $img ]]; then
+       cp $baseimg $img
+
+       bm="$BENCHMARKSDIR/$bmsuite"
+       cnt=`du -ms $bm | awk '{print $1}'`
+       bsize="1M"
+       dd if=/dev/zero bs=$bsize count=$cnt >> $img
+       sudo parted $img resizepart 1 100%
+       dev=`sudo fdisk -l $img | tail -1 | awk '{ print $1 }'`
+       startsector=`sudo fdisk -l $img | grep $dev | awk '{ print $2 }'`
+       sectorsize=`sudo fdisk -l $img | grep ^Units | awk '{ print $8 }'`
+       loopdev=`losetup -f`
+       offset=$(($startsector*$sectorsize))
+       sudo losetup -o $offset $loopdev $img
+       tempdir=`mktemp -d`
+       sudo mount $loopdev $tempdir
+       sudo resize2fs $loopdev
+       sudo rsync -au $bm $tempdir/$bmsuiteroot
+       sudo umount $tempdir
+       sudo losetup --detach $loopdev
+fi
+
+
+cd $ROOTDIR/gem5
+
+gem5_elf="build/ARM/gem5.fast"
+
+if [[ ! -e $gem5_elf ]]; then
+       getnumprocs np
+       scons $gem5_elf -j$np
+fi
+
+config_script="configs/example/arm/starter_fs.py"
+
+ncores="1"
+cpu_options="--cpu=hpi --num-cores=$ncores"
+
+disk_options="--disk-image=$img"
+
+currtime=$(date "+%Y.%m.%d-%H.%M.%S")
+output_rootdir="fs_output_${bmsuite}_$currtime"
+
+benchmark_progs="
+blackscholes
+facesim
+ferret
+fluidanimate
+freqmine
+"
+
+bmsuitedir="/$bmsuiteroot/$bmsuite"
+parsec_input="simsmall"
+parsec_nthreads="$ncores"
+
+for b in $benchmark_progs; do
+       bootscript=${b}_${parsec_input}_${parsec_nthreads}.rcS
+       cat > $bootscript <<- EOM
+       #!/bin/bash
+       cd $bmsuitedir
+       source ./env.sh
+       parsecmgmt -a run -p $b -c gcc-hooks -i $parsec_input -n 
$parsec_nthreads
+       m5 exit
+       EOM
+       bootscript_options="--script=$ROOTDIR/gem5/$bootscript"
+       output_dir="$output_rootdir/$b"
+ $gem5_elf -d $output_dir $config_script $cpu_options $disk_options $bootscript_options &
+done
diff --git a/util/gem5_tnt/arch/arm/runarmsebenchmarks.sh b/util/gem5_tnt/arch/arm/runarmsebenchmarks.sh
new file mode 100755
index 0000000..772ffcd
--- /dev/null
+++ b/util/gem5_tnt/arch/arm/runarmsebenchmarks.sh
@@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+source ../../common/defaults.in
+source ../../common/util.in
+
+gem5_elf="build/ARM/gem5.fast"
+cd $ROOTDIR/gem5
+if [[ ! -e $gem5_elf ]]; then
+       getnumprocs np
+       scons $gem5_elf -j$np
+fi
+
+benchmark_progs_path="$BENCHMARKSDIR/test-suite/SingleSource/Benchmarks/Stanford"
+benchmark_progs="
+Bubblesort
+FloatMM
+IntMM
+Oscar
+Perm
+Puzzle
+Queens
+Quicksort
+RealMM
+Towers
+Treesort
+"
+config_script="configs/example/arm/starter_se.py"
+cpu_options="--cpu=hpi"
+currtime=$(date "+%Y.%m.%d-%H.%M.%S")
+output_rootdir="se_output_$currtime"
+for b in $benchmark_progs; do
+       output_dir="$output_rootdir/$b"
+ $gem5_elf -d $output_dir $config_script $cpu_options $benchmark_progs_path/$b &
+done
diff --git a/util/gem5_tnt/common/defaults.in b/util/gem5_tnt/common/defaults.in
new file mode 100644
index 0000000..2cf16e3
--- /dev/null
+++ b/util/gem5_tnt/common/defaults.in
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+readonly ROOTDIR=$HOME/gem5_tnt
+
+readonly MISCREPOS=$ROOTDIR/misc_repos
+
+readonly BENCHMARKSDIR=$ROOTDIR/benchmarks
+
+readonly DOCDIR=$ROOTDIR/Documentation
+readonly TUTORIALSDIR=$DOCDIR/tutorials
+readonly TUTORIALSDIR1=$TUTORIALSDIR/hipeac2012
+readonly TUTORIALSDIR2=$TUTORIALSDIR/video
+
+readonly FSDIR=$ROOTDIR/full_system
+readonly FSDIRARM=$FSDIR/arm
+readonly FSDIRARMBBENCH=$FSDIRARM/bbench
+readonly FSDIRARMLEGACY=$FSDIRARM/legacy
+readonly FSDIRX86=$FSDIR/x86
+readonly FSDIRALPHA=$FSDIR/alpha
+
+readonly TOOLCHAINSDIR=$ROOTDIR/toolchains
+readonly TOOLCHAINSDIR_ARM=$TOOLCHAINSDIR/arm
diff --git a/util/gem5_tnt/common/util.in b/util/gem5_tnt/common/util.in
new file mode 100644
index 0000000..971968c
--- /dev/null
+++ b/util/gem5_tnt/common/util.in
@@ -0,0 +1,158 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+function abort {
+       echo -e -n "\n\033[31mAborting.\n"; exit
+}
+
+function cmdtest {
+ hash $@ 2>/dev/null || { echo >&2 "\"$@\" could not be found. Please install it and try again."; abort; }
+}
+
+function rctest {
+       cmdline="$@"
+       cmd="${cmdline%% *}"
+       cmdtest $cmd
+       "$@"
+       local status=$?
+       if [ $status -ne 0 ]; then
+ echo -e -n "\n\033[31mError executing \"$@\".\n" >&2; echo -en "\e[0m"; abort;
+       fi
+       return $status
+}
+
+function archdetect {
+       arch=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/')
+       hash notify-send 2> /dev/null
+       if [[ $? -eq 0 ]]; then
+               notify-send "Architecture is ${arch}-bit"
+       fi
+       echo -e "Architecture is ${arch}-bit"
+}
+
+function chessit {
+       nr=1
+       nc=80
+       echo ""
+       for (( r = 0; r < $nr; r++ ))
+       do
+               for (( c = 0 ; c < $nc; c++ ))
+               do
+                       local sqrs=`expr $r + $c`
+                       local odd=`expr $sqrs % 2`
+                       if [ $odd -eq 0 ]; then
+                               echo -e -n "\033[47m "
+                       else
+                               echo -e -n "\033[40m "
+                       fi
+               done
+               echo -e -n "\033[40m" && echo ""
+       done
+}
+
+function greetings {
+       chessit
+       echo ""
+       archdetect
+       rctest date
+       if [ "$EUID" -ne 0 ]; then
+               msg="Greetings $USER!"
+               hash cowsay 2> /dev/null
+               if [[ $? -eq 0 ]]; then
+                       cmd="cowsay -f tux $msg"
+                       rctest $cmd
+               else
+                       echo -e "$msg"
+               fi
+       fi
+       echo ""
+       echo -e -n "You're currently on $HOSTNAME" && echo ""
+       echo -e -n "Your home folder is $HOME" && echo ""
+       echo -e -n "The current directory is $PWD" && echo ""
+       echo ""
+}
+
+function checkprivledges {
+       if [ "$EUID" -ne 0 ]; then
+               msg="Superuser priviledges are needed in order to perform\
+               some operations"
+               echo -e -n $msg && echo ""
+               echo "Please run as root"
+               exit
+       fi
+}
+
+function wgetintodir {
+       cmdtest wget
+       declare -a argarray=("${!1}")
+       for e in "${argarray[@]}"; do
+               c="mkdir -p ${e%%:*}"
+               rctest $c
+               wget -N ${e#*:} -P ${e%%:*}
+       done
+}
+
+function hgcloneintodir {
+       cmdtest hg
+       declare -a argarray=("${!1}")
+       for e in "${argarray[@]}"; do
+               c="mkdir -p ${e%%,*}"
+               rctest $c
+               cd ${e%%,*}
+               hg clone ${e#*,}
+               echo -e -n "${e#*,} cloned into ${e%%,*}" && echo ""
+       done
+}
+
+function gitcloneintodir {
+       cmdtest git
+       declare -a argarray=("${!1}")
+       for e in "${argarray[@]}"; do
+               c="mkdir -p ${e%%:*}"
+               rctest $c
+               cd ${e%%:*}
+               git clone --recursive ${e#*:}
+               echo -e -n "${e#*:} cloned into ${e%%:*}" && echo ""
+       done
+}
+
+function getnumprocs {
+       local __retvar=$1;
+       local __nprocs=$(cat /proc/cpuinfo | grep processor | wc -l)
+       if [[ "$__retvar" ]]; then
+               eval $__retvar="'$__nprocs'"
+       else
+               echo "$__nprocs"
+       fi
+}
diff --git a/util/gem5_tnt/depinstall.sh b/util/gem5_tnt/depinstall.sh
new file mode 100755
index 0000000..cb9f972
--- /dev/null
+++ b/util/gem5_tnt/depinstall.sh
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+source ./common/util.in
+
+function instdep {
+       local plist="
+       swig
+       m4
+       mercurial
+       scons
+       python
+       python-dev
+       python-pydot
+       gcc
+       g++
+       libgoogle-perftools-dev
+       protobuf-compiler
+       gcc-arm-linux-gnueabihf
+       gcc-aarch64-linux-gnu
+       device-tree-compiler
+       "
+
+       echo -e -n "This is a list of known dependencies:" && echo ""
+       for p in $plist; do
+               echo $p
+       done
+       echo ""
+
+       checkprivledges
+
+       msg="I'm going to try to install the dependencies using the apt-get\
+       command commonly found in debian like distros. If you're using\
+       another distribution, please install them manually."
+       echo -e -n $msg && echo ""
+       echo ""
+
+       for p in $plist; do
+               local cmd="apt-get install $p"
+               rctest $cmd
+       done
+}
+
+greetings
+instdep
diff --git a/util/gem5_tnt/getbenchmarks.sh b/util/gem5_tnt/getbenchmarks.sh
new file mode 100755
index 0000000..1792f7d
--- /dev/null
+++ b/util/gem5_tnt/getbenchmarks.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+source ./common/defaults.in
+source ./common/util.in
+
+wgethis=(
+"$BENCHMARKSDIR:http://parsec.cs.princeton.edu/download/3.0/parsec-3.0.tar.gz";
+)
+
+# Mercurial repositories
+hgrepos=(
+"$BENCHMARKSDIR,https://bitbucket.org/atgutier/bbench";
+)
+
+greetings
+wgetintodir wgethis[@]
+hgcloneintodir hgrepos[@]
diff --git a/util/gem5_tnt/getdoc.sh b/util/gem5_tnt/getdoc.sh
new file mode 100755
index 0000000..7e758f3
--- /dev/null
+++ b/util/gem5_tnt/getdoc.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+source ./common/defaults.in
+source ./common/util.in
+
+wgethis=(
+"$TUTORIALSDIR:http://gem5.org/wiki/images/5/53/2015_ws_04_ISCA_2015_NoMali.pdf";
+"$TUTORIALSDIR:http://gem5.org/wiki/images/f/f7/2015_ws_02_hansson_gem5_workshop_2015.pdf";
+"$TUTORIALSDIR:http://gem5.org/wiki/images/4/4c/2015_ws_09_2015-06-14_Gem5_ISCA.pptx";
+# Tutorials
+"$TUTORIALSDIR:http://www.gem5.org/dist/tutorials/isca_pres_2011.pdf";
+"$TUTORIALSDIR:http://www.m5sim.org/dist/tutorials/asplos_pres.pdf";
+"$TUTORIALSDIR:http://www.m5sim.org/dist/tutorials/asplos_hand.pdf";
+"$TUTORIALSDIR:http://www.m5sim.org/dist/tutorials/isca_pres.pdf";
+"$TUTORIALSDIR:http://www.m5sim.org/dist/tutorials/isca_hand.pdf";
+"$TUTORIALSDIR:http://www.m5sim.org/dist/tutorials/tutorial.ppt";
+"$TUTORIALSDIR:http://www.m5sim.org/dist/tutorials/tutorial.pdf";
+# HiPEAC - European Network on High Performance and Embedded Architecture and Compilation
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/gem5_hipeac.pdf";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/01.overview.m4v";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/02.introduction.m4v";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/03.basics.m4v";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/04.running_experiment.m4v";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/05.debugging.m4v";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/06.memory.m4v";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/07.cpu_models.m4v";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/08.common_tasks.m4v";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/09.configuration.m4v";
+"$TUTORIALSDIR1:http://gem5.org/dist/tutorials/hipeac2012/10.conclusions.m4v";
+# Videos
+"$TUTORIALSDIR2:http://www.m5sim.org/dist/tutorials/introduction.mov";
+"$TUTORIALSDIR2:http://www.m5sim.org/dist/tutorials/running.mov";
+"$TUTORIALSDIR2:http://www.m5sim.org/dist/tutorials/fullsystem.mov";
+"$TUTORIALSDIR2:http://www.m5sim.org/dist/tutorials/objects.mov";
+"$TUTORIALSDIR2:http://www.m5sim.org/dist/tutorials/extending.mov";
+"$TUTORIALSDIR2:http://www.m5sim.org/dist/tutorials/debugging.mov";
+)
+
+# git repositories
+gitrepos=(
+"$DOCDIR:g...@github.com:powerjg/learning_gem5.git"
+)
+
+greetings
+wgetintodir wgethis[@]
+gitcloneintodir gitrepos[@]
diff --git a/util/gem5_tnt/getfs.sh b/util/gem5_tnt/getfs.sh
new file mode 100755
index 0000000..8bff53a
--- /dev/null
+++ b/util/gem5_tnt/getfs.sh
@@ -0,0 +1,89 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2017, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+source ./common/defaults.in
+source ./common/util.in
+
+wgethis=(
+# ARM full system files
+"$FSDIRARM:http://www.gem5.org/dist/current/arm/aarch-system-2014-10.tar.xz";
+"$FSDIRARM:http://www.gem5.org/dist/current/arm/aarch-system-20170421.tar.xz";
+"$FSDIRARM:http://www.gem5.org/dist/current/arm/aarch-system-20170616.tar.xz";
+# BBench android disk images and vmlinux for arm
+"$FSDIRARMBBENCH:http://www.gem5.org/dist/current/bbench/Gingerbread_disk_image_clean.tgz";
+"$FSDIRARMBBENCH:http://www.gem5.org/dist/current/bbench/ICS_disk_image_clean.tgz";
+"$FSDIRARMBBENCH:http://bbench.eecs.umich.edu/bbench/Gingerbread_disk_image.tgz";
+"$FSDIRARMBBENCH:http://bbench.eecs.umich.edu/bbench/ICS_disk_image.tgz";
+"$FSDIRARMBBENCH:http://bbench.eecs.umich.edu/bbench/vmlinux_and_config_arm.tgz";
+# ARM legacy files
+# ARMv8 Full-System Files -- Pre-compiled kernel and disk image for the 64 bit
+# ARMv8 ISA.
+"$FSDIRARMLEGACY:http://www.gem5.org/dist/current/arm/arm64-system-02-2014.tgz";
+# VExpress_EMM kernel w/PCI support and config - Pre-compiled Linux 3.3
+# VExpress_EMM kernel that includes support for PCIe devices, a patch to add +# gem5 PCIe support to the revision of the vexpress kernel tree and a config +# file. This kernel is needed if you want to simulated more than 256MB of RAM
+# or networking. Pass kernel=/path/to/vmlinux-3.3-arm-vexpress-emm-pcie
+# machine-type=VExpress_EMM on the command line. You'll still need the file
+# systems below. This kernel supports a maximum of 2047MB (one MB less than
+# 2GB) of memory.
+"$FSDIRARMLEGACY:http://www.gem5.org/dist/current/arm/vmlinux-emm-pcie-3.3.tar.bz2";
+# New Full System Files -- Pre-compiled Linux kernel, and file systems, and
+# kernel config files. This includes both a cut-down linux and a full ubuntu
+# linux.
+"$FSDIRARMLEGACY:http://www.gem5.org/dist/current/arm/arm-system-2011-08.tar.bz2";
+# Old Full System Files -- Older pre-compiled Linux kernel, and file system.
+"$FSDIRARMLEGACY:http://www.m5sim.org/dist/current/arm/arm-system.tar.bz2";
+# X86 full system files
+# The kernel used for regressions, an SMP version of it, and a disk image
+"$FSDIRX86:http://www.m5sim.org/dist/current/x86/x86-system.tar.bz2";
+# Config files for both of the above kernels, 2.6.25.1 and 2.6.28.4
+"$FSDIRX86:http://www.m5sim.org/dist/current/x86/config-x86.tar.bz2";
+# ALPHA full system files
+# Pre-compiled Linux kernels, PALcode/Console code, and a filesystem
+"$FSDIRALPHA:http://www.m5sim.org/dist/current/m5_system_2.0b3.tar.bz2";
+# Everything you need to create your own disk image and compile everything in
+# it from scratch
+"$FSDIRALPHA:http://www.m5sim.org/dist/current/linux-dist.tgz";
+)
+
+# Mercurial repositories
+hgrepos=(
+# Asimbench android disk images and vmlinux for arm
+"$FSDIRARM,https://bitbucket.org/yongbing_huang/asimbench";
+)
+
+greetings
+wgetintodir wgethis[@]
+hgcloneintodir hgrepos[@]
diff --git a/util/gem5_tnt/getrepos.sh b/util/gem5_tnt/getrepos.sh
new file mode 100755
index 0000000..2822aca
--- /dev/null
+++ b/util/gem5_tnt/getrepos.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2016, University of Kaiserslautern
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+#    this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Éder F. Zulian
+
+source ./common/defaults.in
+source ./common/util.in
+
+# Mercurial repositories
+hgrepos=(
+"$MISCREPOS,http://repo.gem5.org/m5threads";
+)
+
+# git repositories
+gitrepos=(
+"$ROOTDIR:https://gem5.googlesource.com/public/gem5";
+"$MISCREPOS:git://linux-arm.org/linux-linaro-tracking-gem5.git"
+"$MISCREPOS:git://linux-arm.org/linux-aarch64-gem5.git"
+"$MISCREPOS:https://github.com/gem5/linux-arm-gem5.git";
+"$MISCREPOS:https://github.com/arm-university/arm-gem5-rsk.git";
+)
+
+greetings
+hgcloneintodir hgrepos[@]
+gitcloneintodir gitrepos[@]
diff --git a/util/gem5_tnt/patches/gem5/asimbench/README b/util/gem5_tnt/patches/gem5/asimbench/README
new file mode 100644
index 0000000..090c3b9
--- /dev/null
+++ b/util/gem5_tnt/patches/gem5/asimbench/README
@@ -0,0 +1,60 @@
+gem5 Tips & Tricks
+------------------
+
+Here you'll find an example on how to get a version of android up and running
+on gem5.
+
+Make sure everything is setup! You can follow the steps described in
+../../../README to download the required files and, if you don't want to write +full paths, don't forget to append the paths and properly export the M5_PATH +environment variable so that gem5 knows where to search for the files. One last +hint: put disk images in a folder called disks and binaries such as vmlinux in
+a folder called binaries.
+
+Apply one of the patches to your gem5 source code.
+
+patch -p1 < gem5_ARMv7a-ICS-Android.SMP.Asimbench-v3.patch
+
+Export the gem5 binary and some gem5 configurations as environment variables.
+
+export GEM5_ELF="build/ARM/gem5.fast"
+export CPU_OPTIONS="--cpu-type=TimingSimpleCPU --num-cpu=4"
+export MACHINE_TYPE="--machine-type=RealView_PBX"
+export OS_OPTIONS="--os-type=android-ics"
+export KERNEL="--kernel=vmlinux.smp.ics.arm.asimbench.2.6.35"
+export FS_SCRIPT="configs/example/fs.py"
+export MEM_OPTIONS="--mem-size=256MB --mem-type=DDR3_1600_8x8 --mem-channels=2 --caches --l2cache"
+export OTHER_OPTIONS="--frame-capture"
+
+Choose the benchmark script, the disk image that contains the benchmark
+program and the output directory that will be generated by gem5.
+
+export BENCHMARK_OPTIONS="--script=bbench.rcS"
+export DISK="--disk=ARMv7a-ICS-Android.SMP.Asimbench-v3.img"
+export OUT_DIR="--outdir=android_asimbench_output"
+
+Or you can use a clean android disk image without any benchmark program.
+
+export BENCHMARK_OPTIONS=""
+export DISK="--disk=ARMv7a-ICS-Android.SMP.nolock.clean.img"
+export OUT_DIR="--outdir=android_clean_output"
+
+Run gem5.
+
+$GEM5_ELF $OUT_DIR $FS_SCRIPT $CPU_OPTIONS $MEM_OPTIONS $BENCHMARK_OPTIONS $MACHINE_TYPE $KERNEL $DISK $OS_OPTIONS $OTHER_OPTIONS
+
+Connect with m5term.
+
+cd util/term
+make
+./m5term localhost 3456
+
+Connect with vncviewer.
+
+vncviewer localhost:5901
+
+References:
+~~~~~~~~~~
+
+https://bitbucket.org/yongbing_huang/asimbench
+http://www.gem5.org/BBench-gem5
diff --git a/util/gem5_tnt/patches/gem5/asimbench/gem5_ARMv7a-ICS-Android.SMP.Asimbench-v3.patch b/util/gem5_tnt/patches/gem5/asimbench/gem5_ARMv7a-ICS-Android.SMP.Asimbench-v3.patch
new file mode 100644
index 0000000..54791d2
--- /dev/null
+++ b/util/gem5_tnt/patches/gem5/asimbench/gem5_ARMv7a-ICS-Android.SMP.Asimbench-v3.patch
@@ -0,0 +1,34 @@
+diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py
+index c08353a..f3a96c3 100644
+--- a/configs/common/FSConfig.py
++++ b/configs/common/FSConfig.py
+@@ -216,7 +216,7 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,
+
+     default_kernels = {
+         "RealViewEB": "vmlinux.arm.smp.fb.2.6.38.8",
+-        "RealViewPBX": "vmlinux.arm.smp.fb.2.6.38.8",
++        #"RealViewPBX": "vmlinux.arm.smp.fb.2.6.38.8",
+         "VExpress_EMM": "vmlinux.aarch32.ll_20131205.0-gem5",
+         "VExpress_EMM64": "vmlinux.aarch64.20140821",
+     }
+@@ -266,14 +266,18 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,
+     self.realview.attachPciDevices()
+
+     self.cf0 = CowIdeDisk(driveID='master')
++    self.cf2 = CowIdeDisk(driveID='master')
+     self.cf0.childImage(mdesc.disk())
++    self.cf2.childImage(disk("sdcard-1g-mxplayer.img"))
+     # Old platforms have a built-in IDE or CF controller. Default to
+     # the IDE controller if both exist. New platforms expect the
+     # storage controller to be added from the config script.
+     if hasattr(self.realview, "ide"):
+-        self.realview.ide.disks = [self.cf0]
++        # self.realview.ide.disks = [self.cf0]
++        self.realview.ide.disks = [self.cf0, self.cf2]
+     elif hasattr(self.realview, "cf_ctrl"):
+-        self.realview.cf_ctrl.disks = [self.cf0]
++        # self.realview.cf_ctrl.disks = [self.cf0]
++        self.realview.cf_ctrl.disks = [self.cf0, self.cf2]
+     else:
+         self.pci_ide = IdeController(disks=[self.cf0])
+         pci_devices.append(self.pci_ide)
diff --git a/util/gem5_tnt/patches/gem5/asimbench/gem5_ARMv7a-ICS-Android.SMP.Asimbench-v3_RawIdeDisk.patch b/util/gem5_tnt/patches/gem5/asimbench/gem5_ARMv7a-ICS-Android.SMP.Asimbench-v3_RawIdeDisk.patch
new file mode 100644
index 0000000..f67ca5c
--- /dev/null
+++ b/util/gem5_tnt/patches/gem5/asimbench/gem5_ARMv7a-ICS-Android.SMP.Asimbench-v3_RawIdeDisk.patch
@@ -0,0 +1,52 @@
+diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py
+index c08353a..1e666a2 100644
+--- a/configs/common/FSConfig.py
++++ b/configs/common/FSConfig.py
+@@ -57,6 +57,13 @@ os_types = { 'alpha' : [ 'linux' ],
+                          'android-nougat', ],
+            }
+
++
++class RawIdeDisk(IdeDisk):
++    image = RawDiskImage(read_only=False)
++    def childImage(self, ci):
++        self.image.image_file=ci
++
++
+ class CowIdeDisk(IdeDisk):
+     image = CowDiskImage(child=RawDiskImage(read_only=True),
+                          read_only=False)
+@@ -216,7 +223,7 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,
+
+     default_kernels = {
+         "RealViewEB": "vmlinux.arm.smp.fb.2.6.38.8",
+-        "RealViewPBX": "vmlinux.arm.smp.fb.2.6.38.8",
++        #"RealViewPBX": "vmlinux.arm.smp.fb.2.6.38.8",
+         "VExpress_EMM": "vmlinux.aarch32.ll_20131205.0-gem5",
+         "VExpress_EMM64": "vmlinux.aarch64.20140821",
+     }
+@@ -265,15 +272,21 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,
+     # Attach any PCI devices this platform supports
+     self.realview.attachPciDevices()
+
+-    self.cf0 = CowIdeDisk(driveID='master')
++    # self.cf0 = CowIdeDisk(driveID='master')
++    # self.cf2 = CowIdeDisk(driveID='master')
++    self.cf0 = RawIdeDisk(driveID='master')
++    self.cf2 = RawIdeDisk(driveID='master')
+     self.cf0.childImage(mdesc.disk())
++    self.cf2.childImage(disk("sdcard-1g-mxplayer.img"))
+     # Old platforms have a built-in IDE or CF controller. Default to
+     # the IDE controller if both exist. New platforms expect the
+     # storage controller to be added from the config script.
+     if hasattr(self.realview, "ide"):
+-        self.realview.ide.disks = [self.cf0]
++        # self.realview.ide.disks = [self.cf0]
++        self.realview.ide.disks = [self.cf0, self.cf2]
+     elif hasattr(self.realview, "cf_ctrl"):
+-        self.realview.cf_ctrl.disks = [self.cf0]
++        # self.realview.cf_ctrl.disks = [self.cf0]
++        self.realview.cf_ctrl.disks = [self.cf0, self.cf2]
+     else:
+         self.pci_ide = IdeController(disks=[self.cf0])
+         pci_devices.append(self.pci_ide)
diff --git a/util/gem5_tnt/patches/parsec/x86_host_cross_aarch64-linux-gnu.patch b/util/gem5_tnt/patches/parsec/x86_host_cross_aarch64-linux-gnu.patch
new file mode 100644
index 0000000..3de0986
--- /dev/null
+++ b/util/gem5_tnt/patches/parsec/x86_host_cross_aarch64-linux-gnu.patch
@@ -0,0 +1,388 @@
+diff --git a/pkgs/apps/blackscholes/parsec/gcc-pthreads.bldconf b/pkgs/apps/blackscholes/parsec/gcc-pthreads.bldconf
+index 184bb76..f6d8f7d 100644
+--- a/pkgs/apps/blackscholes/parsec/gcc-pthreads.bldconf
++++ b/pkgs/apps/blackscholes/parsec/gcc-pthreads.bldconf
+@@ -27,4 +27,4 @@ build_env="version=pthreads"
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+diff --git a/pkgs/apps/bodytrack/parsec/gcc-pthreads.bldconf b/pkgs/apps/bodytrack/parsec/gcc-pthreads.bldconf
+index 1066920..1c22bab 100644
+--- a/pkgs/apps/bodytrack/parsec/gcc-pthreads.bldconf
++++ b/pkgs/apps/bodytrack/parsec/gcc-pthreads.bldconf
+@@ -27,5 +27,4 @@ build_env="CXXFLAGS=\"${CXXFLAGS} -fexceptions\""
+ build_inplace="FALSE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf="--enable-threads --disable-openmp --disable-tbb"
+-
++build_conf="--enable-threads --disable-openmp --disable-tbb --build=x86_64-linux-gnu --host=aarch64-linux-gnu" +diff --git a/pkgs/apps/bodytrack/src/TrackingBenchmark/Makefile.in b/pkgs/apps/bodytrack/src/TrackingBenchmark/Makefile.in
+index 97e2ea1..808eb26 100644
+--- a/pkgs/apps/bodytrack/src/TrackingBenchmark/Makefile.in
++++ b/pkgs/apps/bodytrack/src/TrackingBenchmark/Makefile.in
+@@ -105,7 +105,7 @@ LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+       $(AM_CXXFLAGS) $(CXXFLAGS)
+ CXXLD = $(CXX)
+ CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+-      $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++      $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -all-static -o $@
+ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+diff --git a/pkgs/apps/facesim/parsec/gcc-pthreads.bldconf b/pkgs/apps/facesim/parsec/gcc-pthreads.bldconf
+index 123c25c..2d69b0c 100644
+--- a/pkgs/apps/facesim/parsec/gcc-pthreads.bldconf
++++ b/pkgs/apps/facesim/parsec/gcc-pthreads.bldconf
+@@ -27,5 +27,5 @@ build_env="version=pthreads PHYSBAM=${PARSECDIR}/pkgs/apps/facesim/obj/${PARSECP
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/apps/ferret/parsec/gcc-pthreads.bldconf b/pkgs/apps/ferret/parsec/gcc-pthreads.bldconf
+index d0d9248..e0380d0 100644
+--- a/pkgs/apps/ferret/parsec/gcc-pthreads.bldconf
++++ b/pkgs/apps/ferret/parsec/gcc-pthreads.bldconf
+@@ -30,4 +30,4 @@ build_env="version=\"pthreads\" ${ferret_flags}"
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+diff --git a/pkgs/apps/fluidanimate/parsec/gcc-pthreads.bldconf b/pkgs/apps/fluidanimate/parsec/gcc-pthreads.bldconf
+index d7c340b..1e3bd00 100644
+--- a/pkgs/apps/fluidanimate/parsec/gcc-pthreads.bldconf
++++ b/pkgs/apps/fluidanimate/parsec/gcc-pthreads.bldconf
+@@ -27,4 +27,4 @@ build_env="version=pthreads"
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+diff --git a/pkgs/apps/raytrace/parsec/gcc-pthreads.bldconf b/pkgs/apps/raytrace/parsec/gcc-pthreads.bldconf
+index 5588181..5c46141 100644
+--- a/pkgs/apps/raytrace/parsec/gcc-pthreads.bldconf
++++ b/pkgs/apps/raytrace/parsec/gcc-pthreads.bldconf
+@@ -30,4 +30,4 @@ build_env="version=pthreads CXXFLAGS=\"-I${PARSECDIR}/pkgs/libs/mesa/inst/${PARS
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+\ No newline at end of file
+diff --git a/pkgs/apps/swaptions/parsec/gcc-pthreads.bldconf b/pkgs/apps/swaptions/parsec/gcc-pthreads.bldconf
+index d7c340b..1e3bd00 100644
+--- a/pkgs/apps/swaptions/parsec/gcc-pthreads.bldconf
++++ b/pkgs/apps/swaptions/parsec/gcc-pthreads.bldconf
+@@ -27,4 +27,4 @@ build_env="version=pthreads"
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+diff --git a/pkgs/apps/swaptions/parsec/gcc.bldconf b/pkgs/apps/swaptions/parsec/gcc.bldconf
+index b76144d..c7d9c4a 100644
+--- a/pkgs/apps/swaptions/parsec/gcc.bldconf
++++ b/pkgs/apps/swaptions/parsec/gcc.bldconf
+@@ -3,5 +3,5 @@
+ # gcc.bldconf - configuration file for PARSEC
+
+ # Default parallelization is pthreads
+-source ${PARSECDIR}/pkgs/apps/swaptions/parsec/gcc-tbb.bldconf
++source ${PARSECDIR}/pkgs/apps/swaptions/parsec/gcc-pthreads.bldconf
+
+diff --git a/pkgs/apps/vips/parsec/gcc-pthreads.bldconf b/pkgs/apps/vips/parsec/gcc-pthreads.bldconf
+index 3ba7bcf..229f90a 100644
+--- a/pkgs/apps/vips/parsec/gcc-pthreads.bldconf
++++ b/pkgs/apps/vips/parsec/gcc-pthreads.bldconf
+@@ -28,4 +28,4 @@ build_inplace="FALSE"
+
+ # Arguments to pass to the configure script, if it exists
+ vips_basic_conf="--disable-shared --disable-cxx --without-fftw3 --without-magick --without-liboil --without-lcms --without-OpenEXR --without-matio --without-pangoft2 --without-tiff --without-jpeg --without-zip --without-png --without-libexif --without-python --without-x --without-perl --without-v4l --without-cimg"
+-build_conf="${vips_basic_conf} --enable-threads"
++build_conf="${vips_basic_conf} --enable-threads --build=x86_64-linux-gnu --host=aarch64-linux-gnu" +diff --git a/pkgs/apps/vips/src/tools/iofuncs/Makefile.in b/pkgs/apps/vips/src/tools/iofuncs/Makefile.in
+index 87d8b33..109ecb0 100644
+--- a/pkgs/apps/vips/src/tools/iofuncs/Makefile.in
++++ b/pkgs/apps/vips/src/tools/iofuncs/Makefile.in
+@@ -83,7 +83,7 @@ LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ CCLD = $(CC)
+ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+-      $(LDFLAGS) -o $@
++      $(LDFLAGS) -all-static -o $@
+ SOURCES = $(edvips_SOURCES) $(header_SOURCES) $(vips_SOURCES) \
+       $(vipsthumbnail_SOURCES)
+ DIST_SOURCES = $(edvips_SOURCES) $(header_SOURCES) $(vips_SOURCES) \
+diff --git a/pkgs/apps/x264/parsec/gcc-pthreads.bldconf b/pkgs/apps/x264/parsec/gcc-pthreads.bldconf
+index 7bf67b0..4b3d030 100644
+--- a/pkgs/apps/x264/parsec/gcc-pthreads.bldconf
++++ b/pkgs/apps/x264/parsec/gcc-pthreads.bldconf
+@@ -35,5 +35,5 @@ build_env="PATH=\"${PARSECDIR}/pkgs/tools/yasm/inst/${PARSECPLAT}/bin:${PATH}\""
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf="--enable-pthread --extra-asflags=\"${ASFLAGS}\" --extra-cflags=\"${CFLAGS}\" --extra-ldflags=\"${LDFLAGS} ${LIBS}\"" ++build_conf="--enable-pthread --extra-asflags=\"${ASFLAGS}\" --extra-cflags=\"${CFLAGS}\" --extra-ldflags=\"${LDFLAGS} ${LIBS}\" --build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/kernels/canneal/parsec/gcc-pthreads.bldconf b/pkgs/kernels/canneal/parsec/gcc-pthreads.bldconf
+index d7c340b..1e3bd00 100644
+--- a/pkgs/kernels/canneal/parsec/gcc-pthreads.bldconf
++++ b/pkgs/kernels/canneal/parsec/gcc-pthreads.bldconf
+@@ -27,4 +27,4 @@ build_env="version=pthreads"
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+diff --git a/pkgs/kernels/canneal/src/atomic/atomic.h b/pkgs/kernels/canneal/src/atomic/atomic.h
+index 73daad9..c440de5 100644
+--- a/pkgs/kernels/canneal/src/atomic/atomic.h
++++ b/pkgs/kernels/canneal/src/atomic/atomic.h
+@@ -34,6 +34,8 @@
+ #  include "ia64/atomic.h"
+ #elif defined(__alpha__) || defined(__alpha) || defined(alpha) || defined(__ALPHA__)
+ #  include "alpha/atomic.h"
++#elif defined(__aarch64__) || defined(__aarch64) || defined(aarch64) || defined(__AARCH64__)
++#  include "aarch64/atomic.h"
+ #else
+ #  error Architecture not supported by atomic.h
+ #endif
+diff --git a/pkgs/kernels/dedup/parsec/gcc-pthreads.bldconf b/pkgs/kernels/dedup/parsec/gcc-pthreads.bldconf
+index 28c3c33..4aa956d 100644
+--- a/pkgs/kernels/dedup/parsec/gcc-pthreads.bldconf
++++ b/pkgs/kernels/dedup/parsec/gcc-pthreads.bldconf
+@@ -27,4 +27,4 @@ build_env="version=pthreads CFLAGS=\"-I${PARSECDIR}/pkgs/libs/ssl/inst/${PARSECP
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+diff --git a/pkgs/kernels/streamcluster/parsec/gcc-pthreads.bldconf b/pkgs/kernels/streamcluster/parsec/gcc-pthreads.bldconf
+index d7c340b..1e3bd00 100644
+--- a/pkgs/kernels/streamcluster/parsec/gcc-pthreads.bldconf
++++ b/pkgs/kernels/streamcluster/parsec/gcc-pthreads.bldconf
+@@ -27,4 +27,4 @@ build_env="version=pthreads"
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+diff --git a/pkgs/libs/glib/parsec/gcc.bldconf b/pkgs/libs/glib/parsec/gcc.bldconf
+index 34a7a11..2ce68c1 100644
+--- a/pkgs/libs/glib/parsec/gcc.bldconf
++++ b/pkgs/libs/glib/parsec/gcc.bldconf
+@@ -26,5 +26,5 @@ build_env="CFLAGS=\"-I${PARSECDIR}/pkgs/libs/zlib/inst/${PARSECPLAT}/include ${C
+ build_inplace="FALSE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf="--disable-shared --enable-threads --with-threads=posix"
++build_conf="--disable-shared --enable-threads --with-threads=posix --build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/libs/gsl/parsec/gcc.bldconf b/pkgs/libs/gsl/parsec/gcc.bldconf
+index 5f38c67..814080d 100644
+--- a/pkgs/libs/gsl/parsec/gcc.bldconf
++++ b/pkgs/libs/gsl/parsec/gcc.bldconf
+@@ -27,4 +27,4 @@ build_env="LIBS=\"${LIBS} -lm\""
+ build_inplace="FALSE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf="--disable-shared"
++build_conf="--disable-shared --build=x86_64-linux-gnu --host=aarch64-linux-gnu" +diff --git a/pkgs/libs/hooks/parsec/gcc.bldconf b/pkgs/libs/hooks/parsec/gcc.bldconf
+index b1259ae..de7b8cc 100644
+--- a/pkgs/libs/hooks/parsec/gcc.bldconf
++++ b/pkgs/libs/hooks/parsec/gcc.bldconf
+@@ -26,5 +26,5 @@ build_env=""
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/libs/hooks/src/hooks.c b/pkgs/libs/hooks/src/hooks.c
+index 9658425..6227e4a 100644
+--- a/pkgs/libs/hooks/src/hooks.c
++++ b/pkgs/libs/hooks/src/hooks.c
+@@ -42,6 +42,7 @@
+ #include "include/hooks.h"
+ #include "config.h"
+
++#include <stdint.h>
+ #include <stdio.h>
+ #include <assert.h>
+
+@@ -84,6 +85,30 @@ static int num_roi_ends = 0;
+ static int num_bench_ends = 0;
+ #endif
+
++//These functions allow to create checkpoints in the hooks during simulations with gem5
++static void m5_checkpoint(uint64_t x, uint64_t y) {
++        register uint64_t x0 asm("x0") = x;
++        register uint64_t x1 asm("x1") = y;
++        asm volatile (".inst 0xff430110;":: "r" (x0), "r" (x1));
++};
++static __attribute__((optimize("O0"))) void m5_exit(uint64_t x)
++{
++        register uint64_t x0 asm("x0") = x;
++        asm volatile (".inst 0xff210110;":: "r" (x0));
++};
++static __attribute__((optimize("O0"))) void m5_reset_stats(uint64_t x, uint64_t y)
++{
++        register uint64_t x0 asm("x0") = x;
++        register uint64_t x1 asm("x1") = y;
++        asm volatile (".inst 0xff400110;":: "r" (x0), "r" (x1));
++};
++static __attribute__((optimize("O0"))) void m5_dump_stats(uint64_t x, uint64_t y)
++{
++        register uint64_t x0 asm("x0") = x;
++        register uint64_t x1 asm("x1") = y;
++        asm volatile (".inst 0xff410110;":: "r" (x0), "r" (x1));
++};
++
+ /** \brief Variable for unique identifier of workload.
+  *
+ * This variable stores the unique identifier of the current benchmark program.
+@@ -195,6 +220,10 @@ void __parsec_roi_begin() {
+   #if ENABLE_PTLSIM_TRIGGER
+   ptlcall_switch_to_sim();
+   #endif //ENABLE_PTLSIM_TRIGGER
++
++  printf("[GEM5]  Beginning of ROI\n");
++  m5_checkpoint(0,0);
++  m5_reset_stats(0,0);
+ }
+
+
+@@ -221,6 +250,10 @@ void __parsec_roi_end() {
+   time_end = (double)t.tv_sec+(double)t.tv_usec*1e-6;
+   #endif //ENABLE_TIMING
+
++  m5_dump_stats(0,0);
++  printf("[GEM5] Stats dumped.\n");
++  printf("[GEM5] Total time spent in ROI: %.3fs\n", time_end-time_begin);
++
+   printf(HOOKS_PREFIX" Leaving ROI\n");
+   fflush(NULL);
+ }
+diff --git a/pkgs/libs/libjpeg/parsec/gcc.bldconf b/pkgs/libs/libjpeg/parsec/gcc.bldconf
+index af0ce90..12cef56 100644
+--- a/pkgs/libs/libjpeg/parsec/gcc.bldconf
++++ b/pkgs/libs/libjpeg/parsec/gcc.bldconf
+@@ -27,4 +27,4 @@ build_env=""
+ build_inplace="FALSE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf="--disable-shared"
++build_conf="--disable-shared --build=x86_64-linux-gnu --host=aarch64-linux-gnu" +diff --git a/pkgs/libs/libxml2/parsec/gcc.bldconf b/pkgs/libs/libxml2/parsec/gcc.bldconf
+index aea5ee6..8e609c9 100644
+--- a/pkgs/libs/libxml2/parsec/gcc.bldconf
++++ b/pkgs/libs/libxml2/parsec/gcc.bldconf
+@@ -26,4 +26,4 @@ build_env="CFLAGS=\"-I${PARSECDIR}/pkgs/libs/zlib/inst/${PARSECPLAT}/include ${C
+ build_inplace="FALSE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf="--disable-shared --with-threads"
++build_conf="--disable-shared --with-threads --build=x86_64-linux-gnu --host=aarch64-linux-gnu" +diff --git a/pkgs/libs/mesa/parsec/gcc.bldconf b/pkgs/libs/mesa/parsec/gcc.bldconf
+index ead8a7b..d97084b 100644
+--- a/pkgs/libs/mesa/parsec/gcc.bldconf
++++ b/pkgs/libs/mesa/parsec/gcc.bldconf
+@@ -26,5 +26,5 @@ build_env=""
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf="--with-driver=xlib --enable-glut --enable-static --disable-shared" ++build_conf="--with-driver=xlib --enable-glut --enable-static --disable-shared --build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/libs/parmacs/parsec/gcc.bldconf b/pkgs/libs/parmacs/parsec/gcc.bldconf
+index 9ad5b15..32dfa49 100644
+--- a/pkgs/libs/parmacs/parsec/gcc.bldconf
++++ b/pkgs/libs/parmacs/parsec/gcc.bldconf
+@@ -26,5 +26,5 @@ build_env=""
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/libs/ssl/parsec/gcc.bldconf b/pkgs/libs/ssl/parsec/gcc.bldconf
+index a82cb1c..abdd6b5 100644
+--- a/pkgs/libs/ssl/parsec/gcc.bldconf
++++ b/pkgs/libs/ssl/parsec/gcc.bldconf
+@@ -26,5 +26,5 @@ build_env="PATH=\"${CC_HOME}/bin:${PATH}\""
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf="threads no-zlib no-shared"
++build_conf="threads no-zlib no-shared --build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/libs/tbblib/parsec/gcc.bldconf b/pkgs/libs/tbblib/parsec/gcc.bldconf
+index 1a41795..739254b 100644
+--- a/pkgs/libs/tbblib/parsec/gcc.bldconf
++++ b/pkgs/libs/tbblib/parsec/gcc.bldconf
+@@ -26,5 +26,5 @@ build_env="compiler=gcc PATH=\"${CC_HOME}/bin:${PATH}\" CXXFLAGS=\"${CXXFLAGS} -
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/libs/uptcpip/parsec/gcc.bldconf b/pkgs/libs/uptcpip/parsec/gcc.bldconf
+index 4234310..8e53b72 100644
+--- a/pkgs/libs/uptcpip/parsec/gcc.bldconf
++++ b/pkgs/libs/uptcpip/parsec/gcc.bldconf
+@@ -26,5 +26,5 @@ build_env=""
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/libs/zlib/parsec/gcc.bldconf b/pkgs/libs/zlib/parsec/gcc.bldconf
+index 67fbe4e..dacc66f 100644
+--- a/pkgs/libs/zlib/parsec/gcc.bldconf
++++ b/pkgs/libs/zlib/parsec/gcc.bldconf
+@@ -26,5 +26,5 @@ build_env=""
+ build_inplace="TRUE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/tools/cmake/parsec/gcc.bldconf b/pkgs/tools/cmake/parsec/gcc.bldconf
+index 1998449..056cdab 100644
+--- a/pkgs/tools/cmake/parsec/gcc.bldconf
++++ b/pkgs/tools/cmake/parsec/gcc.bldconf
+@@ -26,4 +26,4 @@ build_env="CXXFLAGS=\"${CXXFLAGS} -fexceptions\""
+ build_inplace="FALSE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+diff --git a/pkgs/tools/libtool/parsec/gcc.bldconf b/pkgs/tools/libtool/parsec/gcc.bldconf
+index 5aab2b5..c4714b5 100644
+--- a/pkgs/tools/libtool/parsec/gcc.bldconf
++++ b/pkgs/tools/libtool/parsec/gcc.bldconf
+@@ -27,5 +27,5 @@ build_env="LIBS=\"\""
+ build_inplace="FALSE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"
+
+diff --git a/pkgs/tools/yasm/parsec/gcc.bldconf b/pkgs/tools/yasm/parsec/gcc.bldconf
+index d2a1b9a..f1a3672 100644
+--- a/pkgs/tools/yasm/parsec/gcc.bldconf
++++ b/pkgs/tools/yasm/parsec/gcc.bldconf
+@@ -27,4 +27,4 @@ build_env="LIBS=\"${LDFLAGS} ${LIBS}\""
+ build_inplace="FALSE"
+
+ # Arguments to pass to the configure script, if it exists
+-build_conf=""
++build_conf="--build=x86_64-linux-gnu --host=aarch64-linux-gnu"

--
To view, visit https://gem5-review.googlesource.com/5101
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb4055bac5427789bcd15f9d57f57955274994d7
Gerrit-Change-Number: 5101
Gerrit-PatchSet: 1
Gerrit-Owner: Éder F. Zulian <zul...@eit.uni-kl.de>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to