Configs: Add support for the InOrder CPU model
[gem5.git] / src / cpu / thread_context.hh
index 05c409c95ece1870ff759c4f2bb72bfe91f8bc0e..7c3f11c12972afecc0cb71cd91992efccba1a986 100644 (file)
@@ -115,26 +115,30 @@ class ThreadContext
 
     virtual BaseCPU *getCpuPtr() = 0;
 
-    virtual void setCpuId(int id) = 0;
+    virtual int cpuId() = 0;
 
-    virtual int readCpuId() = 0;
+    virtual int threadId() = 0;
 
-#if FULL_SYSTEM
-    virtual System *getSystemPtr() = 0;
+    virtual void setThreadId(int id) = 0;
+
+    virtual int contextId() = 0;
+
+    virtual void setContextId(int id) = 0;
 
     virtual TheISA::ITB *getITBPtr() = 0;
 
     virtual TheISA::DTB *getDTBPtr() = 0;
 
+    virtual System *getSystemPtr() = 0;
+
+#if FULL_SYSTEM
     virtual TheISA::Kernel::Statistics *getKernelStats() = 0;
 
     virtual FunctionalPort *getPhysPort() = 0;
 
-    virtual VirtualPort *getVirtPort(ThreadContext *tc = NULL) = 0;
-
-    virtual void delVirtPort(VirtualPort *vp) = 0;
+    virtual VirtualPort *getVirtPort() = 0;
 
-    virtual void connectMemPorts() = 0;
+    virtual void connectMemPorts(ThreadContext *tc) = 0;
 #else
     virtual TranslatingPort *getMemPort() = 0;
 
@@ -150,13 +154,13 @@ class ThreadContext
     virtual void activate(int delay = 1) = 0;
 
     /// Set the status to Suspended.
-    virtual void suspend() = 0;
+    virtual void suspend(int delay = 0) = 0;
 
     /// Set the status to Unallocated.
     virtual void deallocate(int delay = 0) = 0;
 
     /// Set the status to Halted.
-    virtual void halt() = 0;
+    virtual void halt(int delay = 0) = 0;
 
 #if FULL_SYSTEM
     virtual void dumpFuncProfile() = 0;
@@ -181,8 +185,6 @@ class ThreadContext
     virtual void profileSample() = 0;
 #endif
 
-    virtual int getThreadNum() = 0;
-
     // Also somewhat obnoxious.  Really only used for the TLB fault.
     // However, may be quite useful in SPARC.
     virtual TheISA::MachInst getInst() = 0;
@@ -226,6 +228,14 @@ class ThreadContext
 
     virtual void setNextNPC(uint64_t val) = 0;
 
+    virtual uint64_t readMicroPC() = 0;
+
+    virtual void setMicroPC(uint64_t val) = 0;
+
+    virtual uint64_t readNextMicroPC() = 0;
+
+    virtual void setNextMicroPC(uint64_t val) = 0;
+
     virtual MiscReg readMiscRegNoEffect(int misc_reg) = 0;
 
     virtual MiscReg readMiscReg(int misc_reg) = 0;
@@ -234,6 +244,10 @@ class ThreadContext
 
     virtual void setMiscReg(int misc_reg, const MiscReg &val) = 0;
 
+    virtual uint64_t readRegOtherThread(int misc_reg, unsigned tid) { return 0; }
+
+    virtual void setRegOtherThread(int misc_reg, const MiscReg &val, unsigned tid) { };
+
     // Also not necessarily the best location for these two.  Hopefully will go
     // away once we decide upon where st cond failures goes.
     virtual unsigned readStCondFailures() = 0;
@@ -262,8 +276,8 @@ class ThreadContext
     virtual int exit() { return 1; };
 #endif
 
-    virtual void changeRegFileContext(TheISA::RegContextParam param,
-            TheISA::RegContextVal val) = 0;
+    /** function to compare two thread contexts (for debugging) */
+    static void compare(ThreadContext *one, ThreadContext *two);
 };
 
 /**
@@ -290,27 +304,31 @@ class ProxyThreadContext : public ThreadContext
 
     BaseCPU *getCpuPtr() { return actualTC->getCpuPtr(); }
 
-    void setCpuId(int id) { actualTC->setCpuId(id); }
+    int cpuId() { return actualTC->cpuId(); }
 
-    int readCpuId() { return actualTC->readCpuId(); }
+    int threadId() { return actualTC->threadId(); }
 
-#if FULL_SYSTEM
-    System *getSystemPtr() { return actualTC->getSystemPtr(); }
+    void setThreadId(int id) { return actualTC->setThreadId(id); }
+
+    int contextId() { return actualTC->contextId(); }
+
+    void setContextId(int id) { actualTC->setContextId(id); }
 
     TheISA::ITB *getITBPtr() { return actualTC->getITBPtr(); }
 
     TheISA::DTB *getDTBPtr() { return actualTC->getDTBPtr(); }
 
+    System *getSystemPtr() { return actualTC->getSystemPtr(); }
+
+#if FULL_SYSTEM
     TheISA::Kernel::Statistics *getKernelStats()
     { return actualTC->getKernelStats(); }
 
     FunctionalPort *getPhysPort() { return actualTC->getPhysPort(); }
 
-    VirtualPort *getVirtPort(ThreadContext *tc = NULL) { return actualTC->getVirtPort(tc); }
+    VirtualPort *getVirtPort() { return actualTC->getVirtPort(); }
 
-    void delVirtPort(VirtualPort *vp) { return actualTC->delVirtPort(vp); }
-
-    void connectMemPorts() { actualTC->connectMemPorts(); }
+    void connectMemPorts(ThreadContext *tc) { actualTC->connectMemPorts(tc); }
 #else
     TranslatingPort *getMemPort() { return actualTC->getMemPort(); }
 
@@ -326,13 +344,13 @@ class ProxyThreadContext : public ThreadContext
     void activate(int delay = 1) { actualTC->activate(delay); }
 
     /// Set the status to Suspended.
-    void suspend() { actualTC->suspend(); }
+    void suspend(int delay = 0) { actualTC->suspend(); }
 
     /// Set the status to Unallocated.
     void deallocate(int delay = 0) { actualTC->deallocate(); }
 
     /// Set the status to Halted.
-    void halt() { actualTC->halt(); }
+    void halt(int delay = 0) { actualTC->halt(); }
 
 #if FULL_SYSTEM
     void dumpFuncProfile() { actualTC->dumpFuncProfile(); }
@@ -356,9 +374,6 @@ class ProxyThreadContext : public ThreadContext
     void profileClear() { return actualTC->profileClear(); }
     void profileSample() { return actualTC->profileSample(); }
 #endif
-
-    int getThreadNum() { return actualTC->getThreadNum(); }
-
     // @todo: Do I need this?
     MachInst getInst() { return actualTC->getInst(); }
 
@@ -412,6 +427,14 @@ class ProxyThreadContext : public ThreadContext
 
     void setNextNPC(uint64_t val) { actualTC->setNextNPC(val); }
 
+    uint64_t readMicroPC() { return actualTC->readMicroPC(); }
+
+    void setMicroPC(uint64_t val) { actualTC->setMicroPC(val); }
+
+    uint64_t readNextMicroPC() { return actualTC->readMicroPC(); }
+
+    void setNextMicroPC(uint64_t val) { actualTC->setNextMicroPC(val); }
+
     MiscReg readMiscRegNoEffect(int misc_reg)
     { return actualTC->readMiscRegNoEffect(misc_reg); }
 
@@ -448,12 +471,6 @@ class ProxyThreadContext : public ThreadContext
 
     Counter readFuncExeInst() { return actualTC->readFuncExeInst(); }
 #endif
-
-    void changeRegFileContext(TheISA::RegContextParam param,
-            TheISA::RegContextVal val)
-    {
-        actualTC->changeRegFileContext(param, val);
-    }
 };
 
 #endif