gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Attributes | List of all members
SimpleThread Class Reference

The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interface. More...

#include <simple_thread.hh>

Inheritance diagram for SimpleThread:
ThreadState Serializable

Public Types

typedef ThreadContext::Status Status
 
- Public Types inherited from ThreadState
typedef ThreadContext::Status Status
 

Public Member Functions

std::string name () const
 
 SimpleThread (BaseCPU *_cpu, int _thread_num, System *_system, TheISA::TLB *_itb, TheISA::TLB *_dtb, TheISA::ISA *_isa, bool use_kernel_stats=true)
 
 SimpleThread (BaseCPU *_cpu, int _thread_num, System *_system, Process *_process, TheISA::TLB *_itb, TheISA::TLB *_dtb, TheISA::ISA *_isa)
 
virtual ~SimpleThread ()
 
virtual void takeOverFrom (ThreadContext *oldContext)
 
void regStats (const std::string &name)
 
void copyState (ThreadContext *oldContext)
 
void serialize (CheckpointOut &cp) const override
 Serialize an object. More...
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object. More...
 
void startup ()
 
ThreadContextgetTC ()
 Returns the pointer to this SimpleThread's ThreadContext. More...
 
void demapPage (Addr vaddr, uint64_t asn)
 
void demapInstPage (Addr vaddr, uint64_t asn)
 
void demapDataPage (Addr vaddr, uint64_t asn)
 
void dumpFuncProfile ()
 
Fault hwrei ()
 
bool simPalCheck (int palFunc)
 Check for special simulator handling of specific PAL calls. More...
 
BaseCPUgetCpuPtr ()
 
TheISA::TLB * getITBPtr ()
 
TheISA::TLB * getDTBPtr ()
 
CheckerCPUgetCheckerCpuPtr ()
 
TheISA::Decoder * getDecoderPtr ()
 
SystemgetSystemPtr ()
 
Status status () const
 
void setStatus (Status newStatus)
 
void activate ()
 Set the status to Active. More...
 
void suspend ()
 Set the status to Suspended. More...
 
void halt ()
 Set the status to Halted. More...
 
void copyArchRegs (ThreadContext *tc)
 
void clearArchRegs ()
 
uint64_t readIntReg (int reg_idx)
 
FloatReg readFloatReg (int reg_idx)
 
FloatRegBits readFloatRegBits (int reg_idx)
 
CCReg readCCReg (int reg_idx)
 
void setIntReg (int reg_idx, uint64_t val)
 
void setFloatReg (int reg_idx, FloatReg val)
 
void setFloatRegBits (int reg_idx, FloatRegBits val)
 
void setCCReg (int reg_idx, CCReg val)
 
TheISA::PCState pcState ()
 
void pcState (const TheISA::PCState &val)
 
void pcStateNoRecord (const TheISA::PCState &val)
 
Addr instAddr ()
 
Addr nextInstAddr ()
 
void setNPC (Addr val)
 
MicroPC microPC ()
 
bool readPredicate ()
 
void setPredicate (bool val)
 
MiscReg readMiscRegNoEffect (int misc_reg, ThreadID tid=0) const
 
MiscReg readMiscReg (int misc_reg, ThreadID tid=0)
 
void setMiscRegNoEffect (int misc_reg, const MiscReg &val, ThreadID tid=0)
 
void setMiscReg (int misc_reg, const MiscReg &val, ThreadID tid=0)
 
int flattenIntIndex (int reg)
 
int flattenFloatIndex (int reg)
 
int flattenCCIndex (int reg)
 
int flattenMiscIndex (int reg)
 
unsigned readStCondFailures ()
 
void setStCondFailures (unsigned sc_failures)
 
void syscall (int64_t callnum, Fault *fault)
 
uint64_t readIntRegFlat (int idx)
 
void setIntRegFlat (int idx, uint64_t val)
 
FloatReg readFloatRegFlat (int idx)
 
void setFloatRegFlat (int idx, FloatReg val)
 
FloatRegBits readFloatRegBitsFlat (int idx)
 
void setFloatRegBitsFlat (int idx, FloatRegBits val)
 
CCReg readCCRegFlat (int idx)
 
void setCCRegFlat (int idx, CCReg val)
 
- Public Member Functions inherited from ThreadState
 ThreadState (BaseCPU *cpu, ThreadID _tid, Process *_process)
 
virtual ~ThreadState ()
 
void serialize (CheckpointOut &cp) const override
 Serialize an object. More...
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object. More...
 
int cpuId () const
 
uint32_t socketId () const
 
ContextID contextId () const
 
void setContextId (ContextID id)
 
void setThreadId (ThreadID id)
 
ThreadID threadId () const
 
Tick readLastActivate () const
 
Tick readLastSuspend () const
 
void initMemProxies (ThreadContext *tc)
 Initialise the physical and virtual port proxies and tie them to the data port of the CPU. More...
 
void dumpFuncProfile ()
 
EndQuiesceEventgetQuiesceEvent ()
 
void profileClear ()
 
void profileSample ()
 
TheISA::Kernel::Statistics * getKernelStats ()
 
PortProxygetPhysProxy ()
 
FSTranslatingPortProxygetVirtProxy ()
 
ProcessgetProcessPtr ()
 
void setProcessPtr (Process *p)
 
SETranslatingPortProxygetMemProxy ()
 
Counter readFuncExeInst ()
 Reads the number of instructions functionally executed and committed. More...
 
void setFuncExeInst (Counter new_val)
 Sets the total number of instructions functionally executed and committed. More...
 
Status status () const
 Returns the status of this thread. More...
 
void setStatus (Status new_status)
 Sets the status of this thread. More...
 
- Public Member Functions inherited from Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section. More...
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object. More...
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 

Public Attributes

ProxyThreadContext
< SimpleThread > * 
tc
 
Systemsystem
 
TheISA::TLB * itb
 
TheISA::TLB * dtb
 
TheISA::Decoder decoder
 
FloatReg f [TheISA::NumFloatRegs]
 
FloatRegBits i [TheISA::NumFloatRegs]
 
- Public Attributes inherited from ThreadState
Counter numInst
 Number of instructions committed. More...
 
Stats::Scalar numInsts
 Stat for number instructions committed. More...
 
Counter numOp
 Number of ops (including micro ops) committed. More...
 
Stats::Scalar numOps
 Stat for number ops (including micro ops) committed. More...
 
Stats::Scalar numMemRefs
 Stat for number of memory references. More...
 
Counter numLoad
 Number of simulated loads, used for tracking events based on the number of loads committed. More...
 
Counter startNumLoad
 The number of simulated loads committed prior to this run. More...
 
Tick lastActivate
 Last time activate was called on this thread. More...
 
Tick lastSuspend
 Last time suspend was called on this thread. More...
 
FunctionProfileprofile
 
ProfileNodeprofileNode
 
Addr profilePC
 
EndQuiesceEventquiesceEvent
 
TheISA::Kernel::Statistics * kernelStats
 
Counter funcExeInst
 
unsigned storeCondFailures
 

Protected Types

typedef TheISA::MachInst MachInst
 
typedef TheISA::MiscReg MiscReg
 
typedef TheISA::FloatReg FloatReg
 
typedef TheISA::FloatRegBits FloatRegBits
 
typedef TheISA::CCReg CCReg
 

Protected Attributes

union {
   FloatReg   f [TheISA::NumFloatRegs]
 
   FloatRegBits   i [TheISA::NumFloatRegs]
 
floatRegs
 
TheISA::IntReg intRegs [TheISA::NumIntRegs]
 
TheISA::ISA *const isa
 
TheISA::PCState _pcState
 
bool predicate
 Did this instruction execute or is it predicated false. More...
 
- Protected Attributes inherited from ThreadState
ThreadContext::Status _status
 
BaseCPUbaseCpu
 
ContextID _contextId
 
ThreadID _threadId
 
Processprocess
 
PortProxyphysProxy
 A port proxy outgoing only for functional accesses to physical addresses. More...
 
FSTranslatingPortProxyvirtProxy
 A translating port proxy, outgoing only, for functional accesse to virtual addresses. More...
 
SETranslatingPortProxyproxy
 

Additional Inherited Members

- Static Public Member Functions inherited from Serializable
static const std::string & currentSection ()
 Get the fully-qualified name of the active section. More...
 
static void serializeAll (const std::string &cpt_dir)
 
static void unserializeGlobals (CheckpointIn &cp)
 
- Static Public Attributes inherited from Serializable
static int ckptCount = 0
 
static int ckptMaxCount = 0
 
static int ckptPrevCount = -1
 

Detailed Description

The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interface.

It implements the ThreadContext interface so that a ProxyThreadContext class can be made using SimpleThread as the template parameter (see thread_context.hh). It adds to the ThreadState object by adding all the objects needed for simple functional execution, including a simple architectural register file, and pointers to the ITB and DTB in full system mode. For CPU models that do not need more advanced ways to hold state (i.e. a separate physical register file, or separate fetch and commit PC's), this SimpleThread class provides all the necessary state for full architecture-level functional simulation. See the AtomicSimpleCPU or TimingSimpleCPU for examples.

Definition at line 97 of file simple_thread.hh.

Member Typedef Documentation

typedef TheISA::CCReg SimpleThread::CCReg
protected

Definition at line 104 of file simple_thread.hh.

typedef TheISA::FloatReg SimpleThread::FloatReg
protected

Definition at line 102 of file simple_thread.hh.

typedef TheISA::FloatRegBits SimpleThread::FloatRegBits
protected

Definition at line 103 of file simple_thread.hh.

typedef TheISA::MachInst SimpleThread::MachInst
protected

Definition at line 100 of file simple_thread.hh.

typedef TheISA::MiscReg SimpleThread::MiscReg
protected

Definition at line 101 of file simple_thread.hh.

Definition at line 106 of file simple_thread.hh.

Constructor & Destructor Documentation

SimpleThread::SimpleThread ( BaseCPU _cpu,
int  _thread_num,
System _system,
TheISA::TLB *  _itb,
TheISA::TLB *  _dtb,
TheISA::ISA *  _isa,
bool  use_kernel_stats = true 
)
SimpleThread::SimpleThread ( BaseCPU _cpu,
int  _thread_num,
System _system,
Process _process,
TheISA::TLB *  _itb,
TheISA::TLB *  _dtb,
TheISA::ISA *  _isa 
)

Definition at line 64 of file simple_thread.cc.

References clearArchRegs(), ThreadState::quiesceEvent, and tc.

SimpleThread::~SimpleThread ( )
virtual

Definition at line 106 of file simple_thread.cc.

References tc.

Member Function Documentation

void SimpleThread::activate ( )
void SimpleThread::clearArchRegs ( )
inline

Definition at line 225 of file simple_thread.hh.

References _pcState, floatRegs, intRegs, and isa.

Referenced by CheckerThreadContext< TC >::clearArchRegs(), and SimpleThread().

void SimpleThread::copyArchRegs ( ThreadContext tc)

Definition at line 207 of file simple_thread.cc.

References AlphaISA::copyRegs(), and tc.

Referenced by CheckerThreadContext< TC >::copyArchRegs(), and copyState().

void SimpleThread::copyState ( ThreadContext oldContext)
void SimpleThread::demapDataPage ( Addr  vaddr,
uint64_t  asn 
)
inline

Definition at line 183 of file simple_thread.hh.

References dtb.

void SimpleThread::demapInstPage ( Addr  vaddr,
uint64_t  asn 
)
inline

Definition at line 178 of file simple_thread.hh.

References itb.

void SimpleThread::demapPage ( Addr  vaddr,
uint64_t  asn 
)
inline

Definition at line 172 of file simple_thread.hh.

References dtb, and itb.

Referenced by SimpleExecContext::demapPage().

void SimpleThread::dumpFuncProfile ( )
int SimpleThread::flattenCCIndex ( int  reg)
inline

Definition at line 417 of file simple_thread.hh.

References isa.

int SimpleThread::flattenFloatIndex ( int  reg)
inline

Definition at line 411 of file simple_thread.hh.

References isa.

int SimpleThread::flattenIntIndex ( int  reg)
inline

Definition at line 405 of file simple_thread.hh.

References isa.

int SimpleThread::flattenMiscIndex ( int  reg)
inline

Definition at line 423 of file simple_thread.hh.

References isa.

CheckerCPU* SimpleThread::getCheckerCpuPtr ( )
inline

Definition at line 204 of file simple_thread.hh.

BaseCPU* SimpleThread::getCpuPtr ( )
inline

Definition at line 198 of file simple_thread.hh.

References ThreadState::baseCpu.

TheISA::Decoder* SimpleThread::getDecoderPtr ( )
inline

Definition at line 206 of file simple_thread.hh.

References decoder.

TheISA::TLB* SimpleThread::getDTBPtr ( )
inline

Definition at line 202 of file simple_thread.hh.

References dtb.

Referenced by Minor::ExecContext::demapDataPage(), and Minor::ExecContext::demapPage().

TheISA::TLB* SimpleThread::getITBPtr ( )
inline

Definition at line 200 of file simple_thread.hh.

References itb.

Referenced by Minor::ExecContext::demapInstPage(), and Minor::ExecContext::demapPage().

System* SimpleThread::getSystemPtr ( )
inline

Definition at line 208 of file simple_thread.hh.

References system.

ThreadContext* SimpleThread::getTC ( )
inline
void SimpleThread::halt ( )

Set the status to Halted.

Definition at line 189 of file simple_thread.cc.

References ThreadState::_status, ThreadState::_threadId, ThreadState::baseCpu, ThreadContext::Halted, and status().

Fault SimpleThread::hwrei ( )
Addr SimpleThread::instAddr ( )
inline
MicroPC SimpleThread::microPC ( )
inline
std::string SimpleThread::name ( ) const
inline
Addr SimpleThread::nextInstAddr ( )
inline

Definition at line 353 of file simple_thread.hh.

References _pcState.

Referenced by CheckerCPU::nextInstAddr().

TheISA::PCState SimpleThread::pcState ( )
inline
void SimpleThread::pcState ( const TheISA::PCState &  val)
inline

Definition at line 335 of file simple_thread.hh.

References _pcState, and X86ISA::val.

void SimpleThread::pcStateNoRecord ( const TheISA::PCState &  val)
inline

Definition at line 341 of file simple_thread.hh.

References _pcState, and X86ISA::val.

CCReg SimpleThread::readCCReg ( int  reg_idx)
inline
CCReg SimpleThread::readCCRegFlat ( int  idx)
inline

Definition at line 453 of file simple_thread.hh.

References panic.

Referenced by readCCReg().

FloatReg SimpleThread::readFloatReg ( int  reg_idx)
inline
FloatRegBits SimpleThread::readFloatRegBits ( int  reg_idx)
inline
FloatRegBits SimpleThread::readFloatRegBitsFlat ( int  idx)
inline

Definition at line 444 of file simple_thread.hh.

References floatRegs.

Referenced by readFloatRegBits().

FloatReg SimpleThread::readFloatRegFlat ( int  idx)
inline

Definition at line 441 of file simple_thread.hh.

References floatRegs.

Referenced by readFloatReg().

uint64_t SimpleThread::readIntReg ( int  reg_idx)
inline
uint64_t SimpleThread::readIntRegFlat ( int  idx)
inline

Definition at line 438 of file simple_thread.hh.

References intRegs.

Referenced by readIntReg().

MiscReg SimpleThread::readMiscReg ( int  misc_reg,
ThreadID  tid = 0 
)
inline
MiscReg SimpleThread::readMiscRegNoEffect ( int  misc_reg,
ThreadID  tid = 0 
) const
inline

Definition at line 381 of file simple_thread.hh.

References isa.

Referenced by Minor::ExecContext::readMiscRegNoEffect(), and CheckerCPU::readMiscRegNoEffect().

bool SimpleThread::readPredicate ( )
inline
unsigned SimpleThread::readStCondFailures ( )
inline
void SimpleThread::regStats ( const std::string &  name)

Definition at line 200 of file simple_thread.cc.

References FullSystem, and ThreadState::kernelStats.

Referenced by CheckerThreadContext< TC >::regStats().

void SimpleThread::serialize ( CheckpointOut cp) const
overridevirtual

Serialize an object.

Output an object's state into the current checkpoint section.

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 136 of file simple_thread.cc.

References ThreadState::serialize(), and tc.

Referenced by BaseKvmCPU::serializeThread().

void SimpleThread::setCCReg ( int  reg_idx,
CCReg  val 
)
inline
void SimpleThread::setCCRegFlat ( int  idx,
CCReg  val 
)
inline

Definition at line 456 of file simple_thread.hh.

References panic.

Referenced by setCCReg().

void SimpleThread::setFloatReg ( int  reg_idx,
FloatReg  val 
)
inline
void SimpleThread::setFloatRegBits ( int  reg_idx,
FloatRegBits  val 
)
inline
void SimpleThread::setFloatRegBitsFlat ( int  idx,
FloatRegBits  val 
)
inline

Definition at line 445 of file simple_thread.hh.

References floatRegs, and X86ISA::val.

Referenced by setFloatRegBits().

void SimpleThread::setFloatRegFlat ( int  idx,
FloatReg  val 
)
inline

Definition at line 442 of file simple_thread.hh.

References floatRegs, and X86ISA::val.

Referenced by setFloatReg().

void SimpleThread::setIntReg ( int  reg_idx,
uint64_t  val 
)
inline
void SimpleThread::setIntRegFlat ( int  idx,
uint64_t  val 
)
inline

Definition at line 439 of file simple_thread.hh.

References intRegs, and X86ISA::val.

Referenced by setIntReg().

void SimpleThread::setMiscReg ( int  misc_reg,
const MiscReg val,
ThreadID  tid = 0 
)
inline
void SimpleThread::setMiscRegNoEffect ( int  misc_reg,
const MiscReg val,
ThreadID  tid = 0 
)
inline
void SimpleThread::setNPC ( Addr  val)
inline

Definition at line 359 of file simple_thread.hh.

References _pcState.

Referenced by CheckerThreadContext< TC >::setNPC().

void SimpleThread::setPredicate ( bool  val)
inline
void SimpleThread::setStatus ( Status  newStatus)
inline
void SimpleThread::setStCondFailures ( unsigned  sc_failures)
inline

Definition at line 430 of file simple_thread.hh.

References ThreadState::storeCondFailures.

Referenced by SimpleExecContext::setStCondFailures().

bool SimpleThread::simPalCheck ( int  palFunc)

Check for special simulator handling of specific PAL calls.

If return value is false, actual PAL call will be suppressed.

Definition at line 490 of file ev5.cc.

References PAL::bpt, PAL::bugchk, exitSimLoop(), PAL::halt, MipsISA::halt, System::numSystemsRunning, and ArmISA::system.

Referenced by Minor::ExecContext::simPalCheck(), SimpleExecContext::simPalCheck(), and CheckerCPU::simPalCheck().

void SimpleThread::startup ( )

Definition at line 151 of file simple_thread.cc.

References isa, and tc.

Referenced by BaseKvmCPU::startup().

Status SimpleThread::status ( ) const
inline

Definition at line 210 of file simple_thread.hh.

References ThreadState::_status.

Referenced by activate(), halt(), suspend(), and BaseKvmCPU::wakeup().

void SimpleThread::suspend ( )
void SimpleThread::syscall ( int64_t  callnum,
Fault fault 
)
inline
void SimpleThread::takeOverFrom ( ThreadContext oldContext)
virtual
void SimpleThread::unserialize ( CheckpointIn cp)
overridevirtual

Unserialize an object.

Read an object's state from the current checkpoint section.

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 144 of file simple_thread.cc.

References tc, and ThreadState::unserialize().

Referenced by BaseKvmCPU::unserializeThread().

Member Data Documentation

TheISA::PCState SimpleThread::_pcState
protected
TheISA::Decoder SimpleThread::decoder
TheISA::TLB* SimpleThread::dtb
FloatReg SimpleThread::f[TheISA::NumFloatRegs]

Definition at line 110 of file simple_thread.hh.

union { ... } SimpleThread::floatRegs
FloatRegBits SimpleThread::i[TheISA::NumFloatRegs]

Definition at line 111 of file simple_thread.hh.

TheISA::IntReg SimpleThread::intRegs[TheISA::NumIntRegs]
protected

Definition at line 113 of file simple_thread.hh.

Referenced by clearArchRegs(), readIntRegFlat(), and setIntRegFlat().

TheISA::ISA* const SimpleThread::isa
protected
TheISA::TLB* SimpleThread::itb
bool SimpleThread::predicate
protected

Did this instruction execute or is it predicated false.

Definition at line 122 of file simple_thread.hh.

Referenced by readPredicate(), and setPredicate().

System* SimpleThread::system

Definition at line 132 of file simple_thread.hh.

Referenced by getSystemPtr(), and SimpleThread().

ProxyThreadContext<SimpleThread>* SimpleThread::tc

The documentation for this class was generated from the following files:

Generated on Fri Jun 9 2017 13:04:19 for gem5 by doxygen 1.8.6