summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/eventq.hh6
-rw-r--r--sim/process.cc4
-rw-r--r--sim/serialize.cc12
-rw-r--r--sim/serialize.hh2
-rw-r--r--sim/system.hh8
-rw-r--r--sim/universe.cc2
6 files changed, 24 insertions, 10 deletions
diff --git a/sim/eventq.hh b/sim/eventq.hh
index d62e7df10..a0bb851c0 100644
--- a/sim/eventq.hh
+++ b/sim/eventq.hh
@@ -305,7 +305,11 @@ class EventQueue : public Serializable
if (nextTick() > when)
break;
- assert(head->when() >= when && "event scheduled in the past");
+ /**
+ * @todo this assert is a good bug catcher. I need to
+ * make it true again.
+ */
+ //assert(head->when() >= when && "event scheduled in the past");
serviceOne();
}
}
diff --git a/sim/process.cc b/sim/process.cc
index c18b31da7..3541fd040 100644
--- a/sim/process.cc
+++ b/sim/process.cc
@@ -162,9 +162,7 @@ Process::startup()
// first exec context for this process... initialize & enable
ExecContext *xc = execContexts[0];
- // mark this context as active.
- // activate with zero delay so that we start ticking right
- // away on cycle 0
+ // mark this context as active so it will start ticking.
xc->activate(0);
}
diff --git a/sim/serialize.cc b/sim/serialize.cc
index 846d191e0..52008c394 100644
--- a/sim/serialize.cc
+++ b/sim/serialize.cc
@@ -46,10 +46,14 @@
#include "sim/param.hh"
#include "sim/serialize.hh"
#include "sim/sim_events.hh"
+#include "sim/sim_exit.hh"
#include "sim/sim_object.hh"
using namespace std;
+int Serializable::maxCount;
+int Serializable::count;
+
void
Serializable::nameOut(ostream &os)
{
@@ -224,6 +228,9 @@ Globals::unserialize(Checkpoint *cp)
void
Serializable::serializeAll()
{
+ if (maxCount && count++ > maxCount)
+ exitNow("Maximum number of checkpoints dropped", 0);
+
string dir = Checkpoint::dir();
if (mkdir(dir.c_str(), 0775) == -1 && errno != EEXIST)
fatal("couldn't mkdir %s\n", dir);
@@ -321,7 +328,8 @@ Param<Counter> serialize_period(&serialParams,
"period to repeat serializations",
0);
-
+Param<int> serialize_count(&serialParams, "count",
+ "maximum number of checkpoints to drop");
SerializeParamContext::SerializeParamContext(const string &section)
: ParamContext(section), event(NULL)
@@ -342,6 +350,8 @@ SerializeParamContext::checkParams()
if (serialize_cycle > 0)
Checkpoint::setup(serialize_cycle, serialize_period);
+
+ Serializable::maxCount = serialize_count;
}
void
diff --git a/sim/serialize.hh b/sim/serialize.hh
index 5df168665..de208265e 100644
--- a/sim/serialize.hh
+++ b/sim/serialize.hh
@@ -119,6 +119,8 @@ class Serializable
static Serializable *create(Checkpoint *cp,
const std::string &section);
+ static int count;
+ static int maxCount;
static void serializeAll();
static void unserializeGlobals(Checkpoint *cp);
};
diff --git a/sim/system.hh b/sim/system.hh
index 07881ff01..4f003f282 100644
--- a/sim/system.hh
+++ b/sim/system.hh
@@ -37,14 +37,15 @@
#include "kern/system_events.hh"
#include "sim/sim_object.hh"
+class BaseCPU;
+class ExecContext;
+class GDBListener;
class MemoryController;
+class ObjectFile;
class PhysicalMemory;
class Platform;
class RemoteGDB;
-class GDBListener;
class SymbolTable;
-class ObjectFile;
-class ExecContext;
namespace Kernel { class Binning; }
class System : public SimObject
@@ -101,6 +102,7 @@ class System : public SimObject
struct Params
{
std::string name;
+ Tick boot_cpu_frequency;
MemoryController *memctrl;
PhysicalMemory *physmem;
uint64_t init_param;
diff --git a/sim/universe.cc b/sim/universe.cc
index 5ae41eefd..ecf54c2e7 100644
--- a/sim/universe.cc
+++ b/sim/universe.cc
@@ -108,8 +108,6 @@ CREATE_SIM_OBJECT(Root)
outputStream = simout.find(output_file);
Root *root = new Root(getInstanceName());
- ticksPerSecond = frequency;
-
using namespace Clock;
Frequency = frequency;
Float::s = static_cast<double>(Frequency);