From 456a4570c148759bc229d0295899d4b67b374786 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Wed, 1 Aug 2007 17:39:16 -0400 Subject: Configuration: Update the drive systems kernel as well as the testsys kernel with cmd line option. --HG-- extra : convert_revision : 5dfb0db65452c0b7aa3e2dc2a0209e3f8e23811f --- configs/example/fs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/example/fs.py b/configs/example/fs.py index 76c12bd9e..e772a3ab1 100644 --- a/configs/example/fs.py +++ b/configs/example/fs.py @@ -134,6 +134,9 @@ if len(bm) == 2: drive_sys = makeSparcSystem(drive_mem_mode, bm[1]) drive_sys.cpu = DriveCPUClass(cpu_id=0) drive_sys.cpu.connectMemPorts(drive_sys.membus) + if options.kernel is not None: + drive_sys.kernel = binary(options.kernel) + root = makeDualRoot(test_sys, drive_sys, options.etherdump) elif len(bm) == 1: root = Root(system=test_sys) -- cgit v1.2.3 From 970261f9ceeded02162760365ce08c8d1fd4b506 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 2 Aug 2007 14:32:20 -0400 Subject: debugSymbolTable is a global variable and only needs to be created once, not once per system --HG-- extra : convert_revision : 43cbfd1a58d7d728898cbfae0d7f7d9960eba178 --- src/sim/system.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sim/system.cc b/src/sim/system.cc index 3c4746e93..eb0655aa5 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -72,7 +72,8 @@ System::System(Params *p) #if FULL_SYSTEM kernelSymtab = new SymbolTable; - debugSymbolTable = new SymbolTable; + if (!debugSymbolTable) + debugSymbolTable = new SymbolTable; /** -- cgit v1.2.3 From acb91c2dfa19dadc4549b2e0fced42b2a8bce34f Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 2 Aug 2007 14:34:58 -0400 Subject: Linux Support: make sure that when we get the stack page for thread info we're doing a 64bit not --HG-- extra : convert_revision : c581921dd601fc72fd2d45b961c7440755b0331c --- src/arch/alpha/linux/threadinfo.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arch/alpha/linux/threadinfo.hh b/src/arch/alpha/linux/threadinfo.hh index caeb69f15..b9ffe02ae 100644 --- a/src/arch/alpha/linux/threadinfo.hh +++ b/src/arch/alpha/linux/threadinfo.hh @@ -57,7 +57,7 @@ class ThreadInfo * thread_info struct. So we can get the address by masking off * the lower 14 bits. */ - current = tc->readIntReg(TheISA::StackPointerReg) & ~0x3fff; + current = tc->readIntReg(TheISA::StackPointerReg) & ~ULL(0x3fff); return VPtr(tc, current); } -- cgit v1.2.3 From c4e026daf4f22481d20c6f63d76ad23d5b65af45 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 2 Aug 2007 14:40:56 -0400 Subject: Output: Make OutputDirectory::create() be able to create binary files. --HG-- extra : convert_revision : eae114ee5f27bb8b319df705d9b39bded185b8e8 --- src/base/output.cc | 5 +++-- src/base/output.hh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/base/output.cc b/src/base/output.cc index afcac03a5..9d02a4a71 100644 --- a/src/base/output.cc +++ b/src/base/output.cc @@ -87,7 +87,7 @@ OutputDirectory::resolve(const string &name) } ostream * -OutputDirectory::create(const string &name) +OutputDirectory::create(const string &name, bool binary) { if (name == "cerr" || name == "stderr") return &cerr; @@ -95,7 +95,8 @@ OutputDirectory::create(const string &name) if (name == "cout" || name == "stdout") return &cout; - ofstream *file = new ofstream(resolve(name).c_str(), ios::trunc); + ofstream *file = new ofstream(resolve(name).c_str(), + ios::trunc | binary ? ios::binary : (ios::openmode)0); if (!file->is_open()) panic("Cannot open file %s", name); diff --git a/src/base/output.hh b/src/base/output.hh index 0aae4ae81..5de0c4005 100644 --- a/src/base/output.hh +++ b/src/base/output.hh @@ -51,7 +51,7 @@ class OutputDirectory const std::string &directory(); std::string resolve(const std::string &name); - std::ostream *create(const std::string &name); + std::ostream *create(const std::string &name, bool binary = false); std::ostream *find(const std::string &name); static bool isFile(const std::ostream *os); -- cgit v1.2.3 From da5f62af7bdc4a0a6c8da1eee61b0ecb1a7212b4 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 2 Aug 2007 14:43:27 -0400 Subject: Serialization: Provide array serialization methods that work on std::vector --HG-- extra : convert_revision : aecdf1a7e50edbb12921991cc81df1b431ce8b38 --- src/sim/serialize.cc | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++-- src/sim/serialize.hh | 9 +++++++ 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc index a01e053b9..a7f81d5fb 100644 --- a/src/sim/serialize.cc +++ b/src/sim/serialize.cc @@ -40,6 +40,7 @@ #include #include +#include "base/annotate.hh" #include "base/inifile.hh" #include "base/misc.hh" #include "base/output.hh" @@ -178,6 +179,22 @@ paramOut(ostream &os, const std::string &name, const T ¶m) os << "\n"; } +template +void +arrayParamOut(ostream &os, const std::string &name, + const std::vector ¶m) +{ + int size = param.size(); + os << name << "="; + if (size > 0) + showParam(os, param[0]); + for (int i = 1; i < size; ++i) { + os << " "; + showParam(os, param[i]); + } + os << "\n"; +} + template void @@ -251,6 +268,49 @@ arrayParamIn(Checkpoint *cp, const std::string §ion, } } +template +void +arrayParamIn(Checkpoint *cp, const std::string §ion, + const std::string &name, std::vector ¶m) +{ + std::string str; + if (!cp->find(section, name, str)) { + fatal("Can't unserialize '%s:%s'\n", section, name); + } + + // code below stolen from VectorParam::parse(). + // it would be nice to unify these somehow... + + vector tokens; + + tokenize(tokens, str, ' '); + + // Need this if we were doing a vector + // value.resize(tokens.size()); + + param.resize(tokens.size()); + + for (int i = 0; i < tokens.size(); i++) { + // need to parse into local variable to handle vector, + // for which operator[] returns a special reference class + // that's not the same as 'bool&', (since it's a packed + // vector) + T scalar_value; + if (!parseParam(tokens[i], scalar_value)) { + string err("could not parse \""); + + err += str; + err += "\""; + + fatal(err); + } + + // assign parsed value to vector + param[i] = scalar_value; + } +} + + void objParamIn(Checkpoint *cp, const std::string §ion, @@ -273,7 +333,13 @@ arrayParamOut(ostream &os, const std::string &name, \ type const *param, int size); \ template void \ arrayParamIn(Checkpoint *cp, const std::string §ion, \ - const std::string &name, type *param, int size); + const std::string &name, type *param, int size); \ +template void \ +arrayParamOut(ostream &os, const std::string &name, \ + const std::vector ¶m); \ +template void \ +arrayParamIn(Checkpoint *cp, const std::string §ion, \ + const std::string &name, std::vector ¶m); INSTANTIATE_PARAM_TEMPLATES(signed char) INSTANTIATE_PARAM_TEMPLATES(unsigned char) @@ -343,6 +409,7 @@ Serializable::serializeAll(const std::string &cpt_dir) outstream << "// checkpoint generated: " << ctime(&t); globals.serialize(outstream); + Annotate::annotations.serialize(outstream); SimObject::serializeAll(outstream); } @@ -358,7 +425,7 @@ Serializable::unserializeAll(const std::string &cpt_dir) dir); Checkpoint *cp = new Checkpoint(dir, section); unserializeGlobals(cp); - + Annotate::annotations.unserialize(cp); SimObject::unserializeAll(cp); } diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh index 43cd4ecf4..e72eedb30 100644 --- a/src/sim/serialize.hh +++ b/src/sim/serialize.hh @@ -39,6 +39,7 @@ #include +#include #include #include @@ -60,10 +61,18 @@ template void arrayParamOut(std::ostream &os, const std::string &name, const T *param, int size); +template +void arrayParamOut(std::ostream &os, const std::string &name, + const std::vector ¶m); + template void arrayParamIn(Checkpoint *cp, const std::string §ion, const std::string &name, T *param, int size); +template +void arrayParamIn(Checkpoint *cp, const std::string §ion, + const std::string &name, std::vector ¶m); + void objParamIn(Checkpoint *cp, const std::string §ion, const std::string &name, SimObject * ¶m); -- cgit v1.2.3 From 5682f4f7f98f3ea98ea0b0290f859f55ed0ff45f Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 2 Aug 2007 11:59:02 -0700 Subject: main: expose the build information as a simple command line parameter --HG-- extra : convert_revision : 69189c4a2e9fa9290fe51a2a43a2b08e712c395d --- src/python/m5/main.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/python/m5/main.py b/src/python/m5/main.py index 1695ed75f..96f017cb0 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -26,9 +26,15 @@ # # Authors: Nathan Binkert -import code, optparse, os, socket, sys -from datetime import datetime +import code +import datetime +import optparse +import os +import socket +import sys + from attrdict import attrdict +import defines import traceflags __all__ = [ 'options', 'arguments', 'main' ] @@ -116,6 +122,8 @@ def bool_option(name, default, help): # Help options add_option('-A', "--authors", action="store_true", default=False, help="Show author information") +add_option('-B', "--build-info", action="store_true", default=False, + help="Show build information") add_option('-C', "--copyright", action="store_true", default=False, help="Show full copyright information") add_option('-R', "--readme", action="store_true", default=False, @@ -195,6 +203,22 @@ def main(): parse_args() done = False + + if options.build_info: + done = True + print 'Build information:' + print + print 'compiled %s' % internal.core.cvar.compileDate; + print 'started %s' % datetime.datetime.now().ctime() + print 'executing on %s' % socket.gethostname() + print 'build options:' + keys = defines.m5_build_env.keys() + keys.sort() + for key in keys: + val = defines.m5_build_env[key] + print ' %s = %s' % (key, val) + print + if options.copyright: done = True print info.LICENSE @@ -242,7 +266,7 @@ def main(): print brief_copyright print print "M5 compiled %s" % internal.core.cvar.compileDate; - print "M5 started %s" % datetime.now().ctime() + print "M5 started %s" % datetime.datetime.now().ctime() print "M5 executing on %s" % socket.gethostname() print "command line:", for argv in sys.argv: -- cgit v1.2.3 From dfa147a70ac87cdc5804993a0b39dfb8bb4cfa1b Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 2 Aug 2007 12:03:35 -0700 Subject: python: need to import objects to make some calls work --HG-- extra : convert_revision : b5eec971d76626b2f42448052ab2cb2acb652d1b --- src/python/m5/simulate.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py index 1ef78d6cb..ba9fb7899 100644 --- a/src/python/m5/simulate.py +++ b/src/python/m5/simulate.py @@ -36,6 +36,7 @@ import internal from main import options import SimObject import ticks +import objects # The final hook to generate .ini files. Called from the user script # once the config is built. -- cgit v1.2.3 From b3674749168dd4823795644b1bb820ce2876a615 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 2 Aug 2007 14:12:53 -0700 Subject: python: fix m5.build_env variable. As it is now, some objects will get the incorrect value depending where they were defined. --HG-- extra : convert_revision : a11a14842f9524739cbf54a48be6ec051f371200 --- src/python/m5/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/python/m5/__init__.py b/src/python/m5/__init__.py index 36f2eba61..96cb2ca13 100644 --- a/src/python/m5/__init__.py +++ b/src/python/m5/__init__.py @@ -81,11 +81,6 @@ try: except ImportError: running_m5 = False -if running_m5: - from event import * - from simulate import * - from main import options - if running_m5: import defines build_env.update(defines.m5_build_env) @@ -93,6 +88,11 @@ else: import __scons build_env.update(__scons.m5_build_env) +if running_m5: + from event import * + from simulate import * + from main import options + import SimObject import params import objects -- cgit v1.2.3