Merge zizzer:/z/m5/Bitkeeper/newmem
[gem5.git] / src / cpu / thread_state.hh
index d72697cb79c8ed39e6a3ecaa0ee18a6d0786567c..b03a2e2bb83ee2e1d4cc0b2734f63fc7724696bc 100644 (file)
@@ -24,6 +24,8 @@
  * 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.
+ *
+ * Authors: Kevin Lim
  */
 
 #ifndef __CPU_THREAD_STATE_HH__
@@ -47,6 +49,8 @@ namespace Kernel {
 };
 #endif
 
+class Checkpoint;
+
 /**
  *  Struct for holding general thread state that is needed across CPU
  *  models.  This includes things such as pointers to the process,
@@ -59,10 +63,14 @@ struct ThreadState {
 #if FULL_SYSTEM
     ThreadState(int _cpuId, int _tid);
 #else
-    ThreadState(int _cpuId, int _tid, MemObject *mem,
-                Process *_process, short _asid);
+    ThreadState(int _cpuId, int _tid, Process *_process,
+                short _asid, MemObject *mem);
 #endif
 
+    void serialize(std::ostream &os);
+
+    void unserialize(Checkpoint *cp, const std::string &section);
+
     void setCpuId(int id) { cpuId = id; }
 
     int readCpuId() { return cpuId; }
@@ -86,8 +94,12 @@ struct ThreadState {
 
     Kernel::Statistics *getKernelStats() { return kernelStats; }
 
+    FunctionalPort *getPhysPort() { return physPort; }
+
     void setPhysPort(FunctionalPort *port) { physPort = port; }
 
+    VirtualPort *getVirtPort(ThreadContext *tc = NULL) { return virtPort; }
+
     void setVirtPort(VirtualPort *port) { virtPort = port; }
 #else
     Process *getProcessPtr() { return process; }
@@ -147,6 +159,7 @@ struct ThreadState {
     // Index of hardware thread context on the CPU that this represents.
     int tid;
 
+  public:
     /** Last time activate was called on this thread. */
     Tick lastActivate;
 
@@ -185,6 +198,7 @@ struct ThreadState {
      */
     TheISA::MachInst inst;
 
+  public:
     /**
      * Temporary storage to pass the source address from copy_load to
      * copy_store.
@@ -197,7 +211,6 @@ struct ThreadState {
      */
     Addr copySrcPhysAddr;
 
-  public:
     /*
      * number of executed instructions, for matching with syscall trace
      * points in EIO files.