45 #ifndef __CPU_O3_THREAD_CONTEXT_IMPL_HH__
46 #define __CPU_O3_THREAD_CONTEXT_IMPL_HH__
48 #include "arch/kernel_stats.hh"
49 #include "arch/registers.hh"
50 #include "config/the_isa.hh"
53 #include "debug/O3CPU.hh"
59 return thread->getVirtProxy();
66 thread->dumpFuncProfile();
74 TheISA::Decoder *newDecoder = getDecoderPtr();
76 newDecoder->takeOverFrom(oldDecoder);
81 thread->noSquashFromTC =
false;
82 thread->trapPending =
false;
89 DPRINTF(
O3CPU,
"Calling activate on Thread Context %d\n",
95 thread->lastActivate =
curTick();
99 cpu->activateContext(thread->threadId());
102 template <
class Impl>
106 DPRINTF(
O3CPU,
"Calling suspend on Thread Context %d\n",
112 thread->lastActivate =
curTick();
113 thread->lastSuspend =
curTick();
116 cpu->suspendContext(thread->threadId());
119 template <
class Impl>
123 DPRINTF(
O3CPU,
"Calling halt on Thread Context %d\n", threadId());
129 cpu->haltContext(thread->threadId());
132 template <
class Impl>
137 thread->kernelStats =
new TheISA::Kernel::Statistics(cpu->system);
138 thread->kernelStats->regStats(name +
".kern");
142 template <
class Impl>
146 return thread->lastActivate;
149 template <
class Impl>
153 return thread->lastSuspend;
156 template <
class Impl>
160 thread->profileClear();
163 template <
class Impl>
167 thread->profileSample();
170 template <
class Impl>
175 thread->noSquashFromTC =
true;
177 thread->noSquashFromTC =
false;
183 template <
class Impl>
187 cpu->isa[thread->threadId()]->clear();
190 template <
class Impl>
194 return cpu->readArchIntReg(reg_idx, thread->threadId());
197 template <
class Impl>
201 return cpu->readArchFloatReg(reg_idx, thread->threadId());
204 template <
class Impl>
208 return cpu->readArchFloatRegInt(reg_idx, thread->threadId());
211 template <
class Impl>
215 return cpu->readArchCCReg(reg_idx, thread->threadId());
218 template <
class Impl>
222 cpu->setArchIntReg(reg_idx, val, thread->threadId());
227 template <
class Impl>
231 cpu->setArchFloatReg(reg_idx, val, thread->threadId());
236 template <
class Impl>
240 cpu->setArchFloatRegInt(reg_idx, val, thread->threadId());
245 template <
class Impl>
249 cpu->setArchCCReg(reg_idx, val, thread->threadId());
254 template <
class Impl>
258 cpu->pcState(val, thread->threadId());
263 template <
class Impl>
267 cpu->pcState(val, thread->threadId());
272 template <
class Impl>
276 return cpu->isa[thread->threadId()]->flattenIntIndex(reg);
279 template <
class Impl>
283 return cpu->isa[thread->threadId()]->flattenFloatIndex(reg);
286 template <
class Impl>
290 return cpu->isa[thread->threadId()]->flattenCCIndex(reg);
293 template <
class Impl>
297 return cpu->isa[thread->threadId()]->flattenMiscIndex(reg);
300 template <
class Impl>
304 cpu->setMiscRegNoEffect(misc_reg, val, thread->threadId());
309 #endif//__CPU_O3_THREAD_CONTEXT_IMPL_HH__
310 template <
class Impl>
314 cpu->setMiscReg(misc_reg, val, thread->threadId());
A TranslatingPortProxy in FS mode translates a virtual address to a physical address and then calls t...
virtual void copyArchRegs(ThreadContext *tc)
Copies the architectural registers from another TC into this TC.
virtual TheISA::Decoder * getDecoderPtr()=0
const std::string & name()
virtual void activate()
Set the status to Active.
virtual void clearArchRegs()
Resets all architectural registers to 0.
virtual Counter readFuncExeInst()=0
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
virtual void setMiscReg(int misc_reg, const MiscReg &val)
Sets a misc.
virtual void dumpFuncProfile()
Dumps the function profiling information.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
virtual FloatReg readFloatRegFlat(int idx)
virtual void halt()
Set the status to Halted.
Tick curTick()
The current simulated tick.
virtual FloatRegBits readFloatRegBitsFlat(int idx)
virtual Tick readLastSuspend()
Reads the last tick that this thread was suspended on.
virtual int flattenCCIndex(int reg)
void takeOverFrom(ThreadContext &ntc, ThreadContext &otc)
Copy state between thread contexts in preparation for CPU handover.
uint64_t Tick
Tick count type.
TheISA::FloatRegBits FloatRegBits
virtual void profileClear()
Clears the function profiling information.
virtual void setFloatRegBitsFlat(int idx, FloatRegBits val)
virtual void regStats(const std::string &name)
Registers statistics associated with this TC.
virtual void profileSample()
Samples the function profiling information.
virtual void suspend()
Set the status to Suspended.
virtual FSTranslatingPortProxy & getVirtProxy()
TheISA::FloatReg FloatReg
virtual int flattenMiscIndex(int reg)
virtual void setMiscRegNoEffect(int misc_reg, const MiscReg &val)
Sets a misc.
virtual CCReg readCCRegFlat(int idx)
virtual int flattenFloatIndex(int reg)
virtual TheISA::PCState pcState()
Reads this thread's PC state.
GenericISA::SimplePCState< MachInst > PCState
virtual Tick readLastActivate()
Reads the last tick that this thread was activated on.
virtual uint64_t readIntRegFlat(int idx)
Flat register interfaces.
void copyRegs(ThreadContext *src, ThreadContext *dest)
virtual void pcStateNoRecord(const TheISA::PCState &val)
virtual void takeOverFrom(ThreadContext *old_context)
Takes over execution of a thread from another CPU.
virtual int flattenIntIndex(int reg)
virtual void setFloatRegFlat(int idx, FloatReg val)
virtual void setCCRegFlat(int idx, CCReg val)
virtual void setIntRegFlat(int idx, uint64_t val)
virtual TheISA::Kernel::Statistics * getKernelStats()=0