#include "arch/types.hh"
#include "config/the_isa.hh"
+#include "cpu/base.hh"
#include "cpu/profile.hh"
#include "cpu/thread_context.hh"
-#include "cpu/base.hh"
-
-#if !FULL_SYSTEM
#include "mem/mem_object.hh"
#include "sim/process.hh"
-#endif
-#if FULL_SYSTEM
class EndQuiesceEvent;
class FunctionProfile;
class ProfileNode;
namespace TheISA {
namespace Kernel {
class Statistics;
- };
-};
-#endif
+ }
+}
class Checkpoint;
-class Port;
-class TranslatingPort;
/**
* Struct for holding general thread state that is needed across CPU
* memory, quiesce events, and certain stats. This can be expanded
* to hold more thread-specific stats within it.
*/
-struct ThreadState {
+struct ThreadState : public Serializable {
typedef ThreadContext::Status Status;
-#if FULL_SYSTEM
- ThreadState(BaseCPU *cpu, ThreadID _tid);
-#else
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process);
-#endif
- ~ThreadState();
+ virtual ~ThreadState();
- void serialize(std::ostream &os);
+ void serialize(CheckpointOut &cp) const override;
- void unserialize(Checkpoint *cp, const std::string §ion);
+ void unserialize(CheckpointIn &cp) override;
- int cpuId() { return baseCpu->cpuId(); }
+ int cpuId() const { return baseCpu->cpuId(); }
- int contextId() { return _contextId; }
+ uint32_t socketId() const { return baseCpu->socketId(); }
- void setContextId(int id) { _contextId = id; }
+ ContextID contextId() const { return _contextId; }
- void setThreadId(ThreadID id) { _threadId = id; }
-
- ThreadID threadId() { return _threadId; }
+ void setContextId(ContextID id) { _contextId = id; }
- Tick readLastActivate() { return lastActivate; }
+ void setThreadId(ThreadID id) { _threadId = id; }
- Tick readLastSuspend() { return lastSuspend; }
+ ThreadID threadId() const { return _threadId; }
-#if FULL_SYSTEM
- void connectMemPorts(ThreadContext *tc);
+ Tick readLastActivate() const { return lastActivate; }
- void connectPhysPort();
+ Tick readLastSuspend() const { return lastSuspend; }
- void connectVirtPort(ThreadContext *tc);
+ /**
+ * Initialise the physical and virtual port proxies and tie them to
+ * the data port of the CPU.
+ *
+ * @param tc ThreadContext for the virtual-to-physical translation
+ */
+ void initMemProxies(ThreadContext *tc);
void dumpFuncProfile();
TheISA::Kernel::Statistics *getKernelStats() { return kernelStats; }
- FunctionalPort *getPhysPort() { return physPort; }
+ PortProxy &getPhysProxy();
- void setPhysPort(FunctionalPort *port) { physPort = port; }
+ FSTranslatingPortProxy &getVirtProxy();
- VirtualPort *getVirtPort() { return virtPort; }
-#else
Process *getProcessPtr() { return process; }
- TranslatingPort *getMemPort();
-
- void setMemPort(TranslatingPort *_port) { port = _port; }
-#endif
+ void setProcessPtr(Process *p)
+ {
+ process = p;
+ /**
+ * When the process pointer changes while operating in SE Mode,
+ * the se translating port proxy needs to be reinitialized since it
+ * holds a pointer to the process class.
+ */
+ if (proxy) {
+ delete proxy;
+ proxy = NULL;
+ initMemProxies(NULL);
+ }
+ }
+
+ SETranslatingPortProxy &getMemProxy();
/** Reads the number of instructions functionally executed and
* committed.
void setStatus(Status new_status) { _status = new_status; }
public:
- /** Connects port to the functional port of the memory object
- * below the CPU. */
- void connectToMemFunc(Port *port);
/** Number of instructions committed. */
Counter numInst;
/** Stat for number instructions committed. */
Stats::Scalar numInsts;
+ /** Number of ops (including micro ops) committed. */
+ Counter numOp;
+ /** Stat for number ops (including micro ops) committed. */
+ Stats::Scalar numOps;
/** Stat for number of memory references. */
Stats::Scalar numMemRefs;
BaseCPU *baseCpu;
// system wide HW context id
- int _contextId;
+ ContextID _contextId;
// Index of hardware thread context on the CPU that this represents.
ThreadID _threadId;
/** Last time suspend was called on this thread. */
Tick lastSuspend;
-#if FULL_SYSTEM
public:
FunctionProfile *profile;
ProfileNode *profileNode;
EndQuiesceEvent *quiesceEvent;
TheISA::Kernel::Statistics *kernelStats;
+
protected:
- /** A functional port outgoing only for functional accesses to physical
- * addresses.*/
- FunctionalPort *physPort;
+ Process *process;
- /** A functional port, outgoing only, for functional accesse to virtual
- * addresses. */
- VirtualPort *virtPort;
-#else
- TranslatingPort *port;
+ /** A port proxy outgoing only for functional accesses to physical
+ * addresses.*/
+ PortProxy *physProxy;
- Process *process;
-#endif
+ /** A translating port proxy, outgoing only, for functional
+ * accesse to virtual addresses. */
+ FSTranslatingPortProxy *virtProxy;
+ SETranslatingPortProxy *proxy;
public:
/*