syscall_emul: don't check host fd when allocating target fd
[gem5.git] / src / sim / root.cc
index d44c72f4dbc07cef4a447024ec39d25819d0c2d5..7647ca5b7f88ead788c1ed65ce9a3336e2087e91 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002-2005 The Regents of The University of Michigan
- * Copyright (c) 2011 Advanced Micro Devices
+ * Copyright (c) 2011 Advanced Micro Devices, Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  */
 
 #include "base/misc.hh"
-#include "sim/core.hh"
+#include "base/trace.hh"
+#include "config/the_isa.hh"
+#include "debug/TimeSync.hh"
+#include "sim/full_system.hh"
 #include "sim/root.hh"
 
 Root *Root::_root = NULL;
@@ -87,8 +90,7 @@ Root::timeSyncPeriod(Time newPeriod)
 {
     bool en = timeSyncEnabled();
     _period = newPeriod;
-    _periodTick = _period.nsec() * SimClock::Int::ns +
-                  _period.sec() * SimClock::Int::s;
+    _periodTick = _period.getTick();
     timeSyncEnable(en);
 }
 
@@ -104,18 +106,45 @@ Root::timeSyncSpinThreshold(Time newThreshold)
 Root::Root(RootParams *p) : SimObject(p), _enabled(false),
     _periodTick(p->time_sync_period), syncEvent(this)
 {
-    uint64_t nsecs = p->time_sync_period / SimClock::Int::ns;
-    _period.set(nsecs / Time::NSEC_PER_SEC, nsecs % Time::NSEC_PER_SEC);
-    nsecs = p->time_sync_spin_threshold / SimClock::Int::ns;
-    _spinThreshold.set(nsecs / Time::NSEC_PER_SEC,
-            nsecs % Time::NSEC_PER_SEC);
+    _period.setTick(p->time_sync_period);
+    _spinThreshold.setTick(p->time_sync_spin_threshold);
 
     assert(_root == NULL);
     _root = this;
     lastTime.setTimer();
-    timeSyncEnable(p->time_sync_enable);
+
+    simQuantum = p->sim_quantum;
+}
+
+void
+Root::initState()
+{
+    timeSyncEnable(params()->time_sync_enable);
+}
+
+void
+Root::loadState(CheckpointIn &cp)
+{
+    SimObject::loadState(cp);
+    timeSyncEnable(params()->time_sync_enable);
 }
 
+void
+Root::serialize(CheckpointOut &cp) const
+{
+    SERIALIZE_SCALAR(FullSystem);
+    std::string isa = THE_ISA_STR;
+    SERIALIZE_SCALAR(isa);
+}
+
+void
+Root::unserialize(CheckpointIn &cp)
+{}
+
+
+bool FullSystem;
+unsigned int FullSystemInt;
+
 Root *
 RootParams::create()
 {
@@ -125,5 +154,8 @@ RootParams::create()
 
     created = true;
 
+    FullSystem = full_system;
+    FullSystemInt = full_system ? 1 : 0;
+
     return new Root(this);
 }