sim, arch, base: Refactor the base remote GDB class.
[gem5.git] / src / sim / root.cc
index d51fcbda60cc729586b9a2abd04e61c4c34f4c82..41dad77b4e93306921f5e261cbc2b9f2307a4f4c 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
  *          Gabe Black
  */
 
-#include "base/misc.hh"
+#include "base/logging.hh"
+#include "base/trace.hh"
+#include "config/the_isa.hh"
+#include "debug/TimeSync.hh"
+#include "sim/eventq_impl.hh"
+#include "sim/full_system.hh"
 #include "sim/root.hh"
 
 Root *Root::_root = NULL;
@@ -99,8 +104,9 @@ Root::timeSyncSpinThreshold(Time newThreshold)
     timeSyncEnable(en);
 }
 
-Root::Root(RootParams *p) : SimObject(p), _enabled(false),
-    _periodTick(p->time_sync_period), syncEvent(this)
+Root::Root(RootParams *p)
+    : SimObject(p), _enabled(false), _periodTick(p->time_sync_period),
+      syncEvent([this]{ timeSync(); }, name())
 {
     _period.setTick(p->time_sync_period);
     _spinThreshold.setTick(p->time_sync_spin_threshold);
@@ -108,20 +114,28 @@ Root::Root(RootParams *p) : SimObject(p), _enabled(false),
     assert(_root == NULL);
     _root = this;
     lastTime.setTimer();
+
+    simQuantum = p->sim_quantum;
 }
 
 void
-Root::initState()
+Root::startup()
 {
     timeSyncEnable(params()->time_sync_enable);
 }
 
 void
-Root::loadState(Checkpoint *cp)
+Root::serialize(CheckpointOut &cp) const
 {
-    timeSyncEnable(params()->time_sync_enable);
+    SERIALIZE_SCALAR(FullSystem);
+    std::string isa = THE_ISA_STR;
+    SERIALIZE_SCALAR(isa);
 }
 
+
+bool FullSystem;
+unsigned int FullSystemInt;
+
 Root *
 RootParams::create()
 {
@@ -131,5 +145,8 @@ RootParams::create()
 
     created = true;
 
+    FullSystem = full_system;
+    FullSystemInt = full_system ? 1 : 0;
+
     return new Root(this);
 }