gem5
|
Derived ThreadContext class for use with the O3CPU. More...
#include <cpu.hh>
Public Types | |
typedef Impl::O3CPU | O3CPU |
Public Types inherited from ThreadContext | |
enum | Status { Active, Suspended, Halted } |
Public Member Functions | |
TheISA::TLB * | getITBPtr () |
Returns a pointer to the ITB. More... | |
TheISA::TLB * | getDTBPtr () |
Returns a pointer to the DTB. More... | |
CheckerCPU * | getCheckerCpuPtr () |
TheISA::Decoder * | getDecoderPtr () |
virtual BaseCPU * | getCpuPtr () |
Returns a pointer to this CPU. More... | |
virtual int | cpuId () const |
Reads this CPU's ID. More... | |
virtual uint32_t | socketId () const |
Reads this CPU's Socket ID. More... | |
virtual ContextID | contextId () const |
virtual void | setContextId (int id) |
virtual int | threadId () const |
Returns this thread's ID number. More... | |
virtual void | setThreadId (int id) |
virtual System * | getSystemPtr () |
Returns a pointer to the system. More... | |
virtual TheISA::Kernel::Statistics * | getKernelStats () |
Returns a pointer to this thread's kernel statistics. More... | |
virtual Process * | getProcessPtr () |
Returns a pointer to this thread's process. More... | |
virtual void | setProcessPtr (Process *p) |
virtual PortProxy & | getPhysProxy () |
virtual FSTranslatingPortProxy & | getVirtProxy () |
virtual void | initMemProxies (ThreadContext *tc) |
Initialise the physical and virtual port proxies and tie them to the data port of the CPU. More... | |
virtual SETranslatingPortProxy & | getMemProxy () |
virtual Status | status () const |
Returns this thread's status. More... | |
virtual void | setStatus (Status new_status) |
Sets this thread's status. More... | |
virtual void | activate () |
Set the status to Active. More... | |
virtual void | suspend () |
Set the status to Suspended. More... | |
virtual void | halt () |
Set the status to Halted. More... | |
virtual void | dumpFuncProfile () |
Dumps the function profiling information. More... | |
virtual void | takeOverFrom (ThreadContext *old_context) |
Takes over execution of a thread from another CPU. More... | |
virtual void | regStats (const std::string &name) |
Registers statistics associated with this TC. More... | |
virtual Tick | readLastActivate () |
Reads the last tick that this thread was activated on. More... | |
virtual Tick | readLastSuspend () |
Reads the last tick that this thread was suspended on. More... | |
virtual void | profileClear () |
Clears the function profiling information. More... | |
virtual void | profileSample () |
Samples the function profiling information. More... | |
virtual void | copyArchRegs (ThreadContext *tc) |
Copies the architectural registers from another TC into this TC. More... | |
virtual void | clearArchRegs () |
Resets all architectural registers to 0. More... | |
virtual uint64_t | readIntReg (int reg_idx) |
Reads an integer register. More... | |
virtual FloatReg | readFloatReg (int reg_idx) |
virtual FloatRegBits | readFloatRegBits (int reg_idx) |
virtual CCReg | readCCReg (int reg_idx) |
virtual void | setIntReg (int reg_idx, uint64_t val) |
Sets an integer register to a value. More... | |
virtual void | setFloatReg (int reg_idx, FloatReg val) |
virtual void | setFloatRegBits (int reg_idx, FloatRegBits val) |
virtual void | setCCReg (int reg_idx, CCReg val) |
virtual TheISA::PCState | pcState () |
Reads this thread's PC state. More... | |
virtual void | pcState (const TheISA::PCState &val) |
Sets this thread's PC state. More... | |
virtual void | pcStateNoRecord (const TheISA::PCState &val) |
virtual Addr | instAddr () |
Reads this thread's PC. More... | |
virtual Addr | nextInstAddr () |
Reads this thread's next PC. More... | |
virtual MicroPC | microPC () |
Reads this thread's next PC. More... | |
virtual MiscReg | readMiscRegNoEffect (int misc_reg) const |
Reads a miscellaneous register. More... | |
virtual MiscReg | readMiscReg (int misc_reg) |
Reads a misc. More... | |
virtual void | setMiscRegNoEffect (int misc_reg, const MiscReg &val) |
Sets a misc. More... | |
virtual void | setMiscReg (int misc_reg, const MiscReg &val) |
Sets a misc. More... | |
virtual int | flattenIntIndex (int reg) |
virtual int | flattenFloatIndex (int reg) |
virtual int | flattenCCIndex (int reg) |
virtual int | flattenMiscIndex (int reg) |
virtual unsigned | readStCondFailures () |
Returns the number of consecutive store conditional failures. More... | |
virtual void | setStCondFailures (unsigned sc_failures) |
Sets the number of consecutive store conditional failures. More... | |
virtual void | syscall (int64_t callnum, Fault *fault) |
Executes a syscall in SE mode. More... | |
virtual Counter | readFuncExeInst () |
Reads the funcExeInst counter. More... | |
virtual EndQuiesceEvent * | getQuiesceEvent () |
Returns pointer to the quiesce event. More... | |
void | conditionalSquash () |
check if the cpu is currently in state update mode and squash if not. More... | |
virtual uint64_t | readIntRegFlat (int idx) |
Flat register interfaces. More... | |
virtual void | setIntRegFlat (int idx, uint64_t val) |
virtual FloatReg | readFloatRegFlat (int idx) |
virtual void | setFloatRegFlat (int idx, FloatReg val) |
virtual FloatRegBits | readFloatRegBitsFlat (int idx) |
virtual void | setFloatRegBitsFlat (int idx, FloatRegBits val) |
virtual CCReg | readCCRegFlat (int idx) |
virtual void | setCCRegFlat (int idx, CCReg val) |
Public Member Functions inherited from ThreadContext | |
virtual | ~ThreadContext () |
void | quiesce () |
Quiesce thread context. More... | |
void | quiesceTick (Tick resume) |
Quiesce, suspend, and schedule activate at resume. More... | |
void | setNPC (Addr val) |
virtual uint64_t | readRegOtherThread (int misc_reg, ThreadID tid) |
virtual void | setRegOtherThread (int misc_reg, const MiscReg &val, ThreadID tid) |
virtual int | exit () |
Public Attributes | |
O3CPU * | cpu |
Pointer to the CPU. More... | |
O3ThreadState< Impl > * | thread |
Pointer to the thread state that this TC corrseponds to. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from ThreadContext | |
static void | compare (ThreadContext *one, ThreadContext *two) |
function to compare two thread contexts (for debugging) More... | |
Protected Types inherited from ThreadContext | |
typedef TheISA::MachInst | MachInst |
typedef TheISA::IntReg | IntReg |
typedef TheISA::FloatReg | FloatReg |
typedef TheISA::FloatRegBits | FloatRegBits |
typedef TheISA::CCReg | CCReg |
typedef TheISA::MiscReg | MiscReg |
Derived ThreadContext class for use with the O3CPU.
It provides the interface for any external objects to access a single thread's state and some general CPU state. Any time external objects try to update state through this interface, the CPU will create an event to squash all in-flight instructions in order to ensure state is maintained correctly. It must be defined specifically for the O3CPU because not all architectural state is located within the O3ThreadState (such as the commit PC, and registers), and specific actions must be taken when using this interface (such as squashing all in-flight instructions when doing a write to this interface).
typedef Impl::O3CPU O3ThreadContext< class >::O3CPU |
Definition at line 73 of file thread_context.hh.
|
virtual |
Set the status to Active.
Implements ThreadContext.
Definition at line 87 of file thread_context_impl.hh.
References ThreadContext::Active, curTick(), and DPRINTF.
|
virtual |
Resets all architectural registers to 0.
Implements ThreadContext.
Definition at line 185 of file thread_context_impl.hh.
|
inline |
check if the cpu is currently in state update mode and squash if not.
This function will return true if a trap is pending or if a fault or similar is currently writing to the thread context and doesn't want reset all the state (see noSquashFromTC).
Definition at line 279 of file thread_context.hh.
References O3ThreadContext< class >::cpu, O3ThreadState< class >::noSquashFromTC, O3ThreadContext< class >::thread, ThreadState::threadId(), and O3ThreadState< class >::trapPending.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 104 of file thread_context.hh.
References ThreadState::contextId(), and O3ThreadContext< class >::thread.
|
virtual |
Copies the architectural registers from another TC into this TC.
Implements ThreadContext.
Definition at line 172 of file thread_context_impl.hh.
References AlphaISA::copyRegs(), FullSystem, and ThreadContext::readFuncExeInst().
|
inlinevirtual |
Reads this CPU's ID.
Implements ThreadContext.
Definition at line 99 of file thread_context.hh.
References O3ThreadContext< class >::cpu.
|
virtual |
Dumps the function profiling information.
Implements ThreadContext.
Definition at line 64 of file thread_context_impl.hh.
|
virtual |
Implements ThreadContext.
Definition at line 288 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::readCCReg(), and O3ThreadContext< class >::setCCReg().
|
virtual |
Implements ThreadContext.
Definition at line 281 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::readFloatReg(), O3ThreadContext< class >::readFloatRegBits(), O3ThreadContext< class >::setFloatReg(), and O3ThreadContext< class >::setFloatRegBits().
|
virtual |
Implements ThreadContext.
Definition at line 274 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::readIntReg(), and O3ThreadContext< class >::setIntReg().
|
virtual |
Implements ThreadContext.
Definition at line 295 of file thread_context_impl.hh.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 87 of file thread_context.hh.
|
inlinevirtual |
Returns a pointer to this CPU.
Implements ThreadContext.
Definition at line 96 of file thread_context.hh.
References O3ThreadContext< class >::cpu.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 90 of file thread_context.hh.
References O3ThreadContext< class >::cpu, O3ThreadContext< class >::thread, and ThreadState::threadId().
|
inlinevirtual |
Returns a pointer to the DTB.
Implements ThreadContext.
Definition at line 85 of file thread_context.hh.
References O3ThreadContext< class >::cpu.
|
inlinevirtual |
Returns a pointer to the ITB.
Implements ThreadContext.
Definition at line 82 of file thread_context.hh.
References O3ThreadContext< class >::cpu.
|
inlinevirtual |
Returns a pointer to this thread's kernel statistics.
Implements ThreadContext.
Definition at line 116 of file thread_context.hh.
References ThreadState::kernelStats, and O3ThreadContext< class >::thread.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 131 of file thread_context.hh.
References ThreadState::getMemProxy(), and O3ThreadContext< class >::thread.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 124 of file thread_context.hh.
References ThreadState::getPhysProxy(), and O3ThreadContext< class >::thread.
|
inlinevirtual |
Returns a pointer to this thread's process.
Implements ThreadContext.
Definition at line 120 of file thread_context.hh.
References ThreadState::getProcessPtr(), and O3ThreadContext< class >::thread.
|
inlinevirtual |
Returns pointer to the quiesce event.
Implements ThreadContext.
Definition at line 270 of file thread_context.hh.
References ThreadState::quiesceEvent, and O3ThreadContext< class >::thread.
|
inlinevirtual |
Returns a pointer to the system.
Implements ThreadContext.
Definition at line 113 of file thread_context.hh.
References O3ThreadContext< class >::cpu.
|
virtual |
Implements ThreadContext.
Definition at line 57 of file thread_context_impl.hh.
|
virtual |
Set the status to Halted.
Implements ThreadContext.
Definition at line 121 of file thread_context_impl.hh.
References DPRINTF, and ThreadContext::Halted.
|
inlinevirtual |
Initialise the physical and virtual port proxies and tie them to the data port of the CPU.
tc ThreadContext for the virtual-to-physical translation
Implements ThreadContext.
Definition at line 128 of file thread_context.hh.
References ThreadState::initMemProxies(), and O3ThreadContext< class >::thread.
|
inlinevirtual |
Reads this thread's PC.
Implements ThreadContext.
Definition at line 221 of file thread_context.hh.
References O3ThreadContext< class >::cpu, O3ThreadContext< class >::thread, and ThreadState::threadId().
|
inlinevirtual |
Reads this thread's next PC.
Implements ThreadContext.
Definition at line 229 of file thread_context.hh.
References O3ThreadContext< class >::cpu, O3ThreadContext< class >::thread, and ThreadState::threadId().
|
inlinevirtual |
Reads this thread's next PC.
Implements ThreadContext.
Definition at line 225 of file thread_context.hh.
References O3ThreadContext< class >::cpu, O3ThreadContext< class >::thread, and ThreadState::threadId().
|
inlinevirtual |
Reads this thread's PC state.
Implements ThreadContext.
Definition at line 212 of file thread_context.hh.
References O3ThreadContext< class >::cpu, O3ThreadContext< class >::thread, and ThreadState::threadId().
|
virtual |
Sets this thread's PC state.
Implements ThreadContext.
Definition at line 256 of file thread_context_impl.hh.
|
virtual |
Implements ThreadContext.
Definition at line 265 of file thread_context_impl.hh.
|
virtual |
Clears the function profiling information.
Implements ThreadContext.
Definition at line 158 of file thread_context_impl.hh.
|
virtual |
Samples the function profiling information.
Implements ThreadContext.
Definition at line 165 of file thread_context_impl.hh.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 190 of file thread_context.hh.
References O3ThreadContext< class >::flattenCCIndex(), and O3ThreadContext< class >::readCCRegFlat().
|
virtual |
Implements ThreadContext.
Definition at line 213 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::readCCReg().
|
inlinevirtual |
Implements ThreadContext.
Definition at line 182 of file thread_context.hh.
References O3ThreadContext< class >::flattenFloatIndex(), and O3ThreadContext< class >::readFloatRegFlat().
|
inlinevirtual |
Implements ThreadContext.
Definition at line 186 of file thread_context.hh.
References O3ThreadContext< class >::flattenFloatIndex(), and O3ThreadContext< class >::readFloatRegBitsFlat().
|
virtual |
Implements ThreadContext.
Definition at line 206 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::readFloatRegBits().
|
virtual |
Implements ThreadContext.
Definition at line 199 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::readFloatReg().
|
inlinevirtual |
Reads the funcExeInst counter.
Implements ThreadContext.
Definition at line 267 of file thread_context.hh.
References ThreadState::funcExeInst, and O3ThreadContext< class >::thread.
|
inlinevirtual |
Reads an integer register.
Implements ThreadContext.
Definition at line 178 of file thread_context.hh.
References O3ThreadContext< class >::flattenIntIndex(), and O3ThreadContext< class >::readIntRegFlat().
|
virtual |
Flat register interfaces.
Some architectures have different registers visible in different modes. Such architectures "flatten" a register (see flattenIntIndex() and flattenFloatIndex()) to map it into the gem5 register file. This interface provides a flat interface to the underlying register file, which allows for example serialization code to access all registers.
Implements ThreadContext.
Definition at line 192 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::readIntReg().
|
virtual |
Reads the last tick that this thread was activated on.
Implements ThreadContext.
Definition at line 144 of file thread_context_impl.hh.
|
virtual |
Reads the last tick that this thread was suspended on.
Implements ThreadContext.
Definition at line 151 of file thread_context_impl.hh.
|
inlinevirtual |
Reads a misc.
register, including any side-effects the read might have as defined by the architecture.
Implements ThreadContext.
Definition at line 238 of file thread_context.hh.
References O3ThreadContext< class >::cpu, O3ThreadContext< class >::thread, and ThreadState::threadId().
|
inlinevirtual |
Reads a miscellaneous register.
Implements ThreadContext.
Definition at line 233 of file thread_context.hh.
References O3ThreadContext< class >::cpu, O3ThreadContext< class >::thread, and ThreadState::threadId().
|
inlinevirtual |
Returns the number of consecutive store conditional failures.
Implements ThreadContext.
Definition at line 255 of file thread_context.hh.
References ThreadState::storeCondFailures, and O3ThreadContext< class >::thread.
|
virtual |
Registers statistics associated with this TC.
Implements ThreadContext.
Definition at line 134 of file thread_context_impl.hh.
References FullSystem.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 207 of file thread_context.hh.
References O3ThreadContext< class >::flattenCCIndex(), and O3ThreadContext< class >::setCCRegFlat().
|
virtual |
Implements ThreadContext.
Definition at line 247 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::setCCReg().
|
inlinevirtual |
Implements ThreadContext.
Definition at line 106 of file thread_context.hh.
References ThreadState::setContextId(), and O3ThreadContext< class >::thread.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 199 of file thread_context.hh.
References O3ThreadContext< class >::flattenFloatIndex(), and O3ThreadContext< class >::setFloatRegFlat().
|
inlinevirtual |
Implements ThreadContext.
Definition at line 203 of file thread_context.hh.
References O3ThreadContext< class >::flattenFloatIndex(), and O3ThreadContext< class >::setFloatRegBitsFlat().
|
virtual |
Implements ThreadContext.
Definition at line 238 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::setFloatRegBits().
|
virtual |
Implements ThreadContext.
Definition at line 229 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::setFloatReg().
|
inlinevirtual |
Sets an integer register to a value.
Implements ThreadContext.
Definition at line 195 of file thread_context.hh.
References O3ThreadContext< class >::flattenIntIndex(), and O3ThreadContext< class >::setIntRegFlat().
|
virtual |
Implements ThreadContext.
Definition at line 220 of file thread_context_impl.hh.
Referenced by O3ThreadContext< class >::setIntReg().
|
virtual |
Sets a misc.
register, including any side-effects the write might have as defined by the architecture.
Implements ThreadContext.
Definition at line 312 of file thread_context_impl.hh.
|
virtual |
Sets a misc.
register.
Implements ThreadContext.
Definition at line 302 of file thread_context_impl.hh.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 122 of file thread_context.hh.
References ThreadState::setProcessPtr(), and O3ThreadContext< class >::thread.
|
inlinevirtual |
Sets this thread's status.
Implements ThreadContext.
Definition at line 138 of file thread_context.hh.
References ThreadState::setStatus(), and O3ThreadContext< class >::thread.
|
inlinevirtual |
Sets the number of consecutive store conditional failures.
Implements ThreadContext.
Definition at line 259 of file thread_context.hh.
References ThreadState::storeCondFailures, and O3ThreadContext< class >::thread.
|
inlinevirtual |
Implements ThreadContext.
Definition at line 110 of file thread_context.hh.
References ThreadState::setThreadId(), and O3ThreadContext< class >::thread.
|
inlinevirtual |
Reads this CPU's Socket ID.
Implements ThreadContext.
Definition at line 102 of file thread_context.hh.
References O3ThreadContext< class >::cpu.
|
inlinevirtual |
Returns this thread's status.
Implements ThreadContext.
Definition at line 135 of file thread_context.hh.
References ThreadState::status(), and O3ThreadContext< class >::thread.
|
virtual |
Set the status to Suspended.
Implements ThreadContext.
Definition at line 104 of file thread_context_impl.hh.
References curTick(), DPRINTF, and ThreadContext::Suspended.
|
inlinevirtual |
Executes a syscall in SE mode.
Implements ThreadContext.
Definition at line 263 of file thread_context.hh.
References O3ThreadContext< class >::cpu, O3ThreadContext< class >::thread, and ThreadState::threadId().
|
virtual |
Takes over execution of a thread from another CPU.
Implements ThreadContext.
Definition at line 71 of file thread_context_impl.hh.
References ThreadContext::getDecoderPtr(), ThreadContext::getKernelStats(), ThreadContext::readFuncExeInst(), and takeOverFrom().
|
inlinevirtual |
Returns this thread's ID number.
Implements ThreadContext.
Definition at line 109 of file thread_context.hh.
References O3ThreadContext< class >::thread, and ThreadState::threadId().
O3CPU* O3ThreadContext< class >::cpu |
Pointer to the CPU.
Definition at line 76 of file thread_context.hh.
Referenced by O3ThreadContext< class >::conditionalSquash(), O3ThreadContext< class >::cpuId(), FullO3CPU< Impl >::FullO3CPU(), O3ThreadContext< class >::getCpuPtr(), O3ThreadContext< class >::getDecoderPtr(), O3ThreadContext< class >::getDTBPtr(), O3ThreadContext< class >::getITBPtr(), O3ThreadContext< class >::getSystemPtr(), O3ThreadContext< class >::instAddr(), O3ThreadContext< class >::microPC(), O3ThreadContext< class >::nextInstAddr(), O3ThreadContext< class >::pcState(), O3ThreadContext< class >::readMiscReg(), O3ThreadContext< class >::readMiscRegNoEffect(), O3ThreadContext< class >::socketId(), and O3ThreadContext< class >::syscall().
O3ThreadState<Impl>* O3ThreadContext< class >::thread |
Pointer to the thread state that this TC corrseponds to.
Definition at line 79 of file thread_context.hh.
Referenced by O3ThreadContext< class >::conditionalSquash(), O3ThreadContext< class >::contextId(), FullO3CPU< Impl >::FullO3CPU(), O3ThreadContext< class >::getDecoderPtr(), O3ThreadContext< class >::getKernelStats(), O3ThreadContext< class >::getMemProxy(), O3ThreadContext< class >::getPhysProxy(), O3ThreadContext< class >::getProcessPtr(), O3ThreadContext< class >::getQuiesceEvent(), O3ThreadContext< class >::initMemProxies(), O3ThreadContext< class >::instAddr(), O3ThreadContext< class >::microPC(), O3ThreadContext< class >::nextInstAddr(), O3ThreadContext< class >::pcState(), O3ThreadContext< class >::readFuncExeInst(), O3ThreadContext< class >::readMiscReg(), O3ThreadContext< class >::readMiscRegNoEffect(), O3ThreadContext< class >::readStCondFailures(), O3ThreadContext< class >::setContextId(), O3ThreadContext< class >::setProcessPtr(), O3ThreadContext< class >::setStatus(), O3ThreadContext< class >::setStCondFailures(), O3ThreadContext< class >::setThreadId(), O3ThreadContext< class >::status(), O3ThreadContext< class >::syscall(), and O3ThreadContext< class >::threadId().