Thread: Use inherited baseCpu rather than cpu in SimpleThread
This patch is a trivial simplification, removing the cpu pointer from SimpleThread and relying on the baseCpu pointer in ThreadState. The patch does not add or change any functionality, it merely cleans up the code.
This commit is contained in:
parent
0ed3c84c7b
commit
4fdecae443
3 changed files with 13 additions and 15 deletions
|
@ -67,7 +67,7 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
|
||||||
TheISA::TLB *_itb, TheISA::TLB *_dtb,
|
TheISA::TLB *_itb, TheISA::TLB *_dtb,
|
||||||
bool use_kernel_stats)
|
bool use_kernel_stats)
|
||||||
: ThreadState(_cpu, _thread_num),
|
: ThreadState(_cpu, _thread_num),
|
||||||
cpu(_cpu), system(_sys), itb(_itb), dtb(_dtb)
|
system(_sys), itb(_itb), dtb(_dtb)
|
||||||
|
|
||||||
{
|
{
|
||||||
tc = new ProxyThreadContext<SimpleThread>(this);
|
tc = new ProxyThreadContext<SimpleThread>(this);
|
||||||
|
@ -76,7 +76,7 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
|
||||||
|
|
||||||
clearArchRegs();
|
clearArchRegs();
|
||||||
|
|
||||||
if (cpu->params()->profile) {
|
if (baseCpu->params()->profile) {
|
||||||
profile = new FunctionProfile(system->kernelSymtab);
|
profile = new FunctionProfile(system->kernelSymtab);
|
||||||
Callback *cb =
|
Callback *cb =
|
||||||
new MakeCallback<SimpleThread,
|
new MakeCallback<SimpleThread,
|
||||||
|
@ -97,7 +97,7 @@ SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
|
||||||
SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, Process *_process,
|
SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, Process *_process,
|
||||||
TheISA::TLB *_itb, TheISA::TLB *_dtb)
|
TheISA::TLB *_itb, TheISA::TLB *_dtb)
|
||||||
: ThreadState(_cpu, _thread_num, _process),
|
: ThreadState(_cpu, _thread_num, _process),
|
||||||
cpu(_cpu), itb(_itb), dtb(_dtb)
|
itb(_itb), dtb(_dtb)
|
||||||
{
|
{
|
||||||
clearArchRegs();
|
clearArchRegs();
|
||||||
tc = new ProxyThreadContext<SimpleThread>(this);
|
tc = new ProxyThreadContext<SimpleThread>(this);
|
||||||
|
@ -196,7 +196,7 @@ SimpleThread::serialize(ostream &os)
|
||||||
//
|
//
|
||||||
// Now must serialize all the ISA dependent state
|
// Now must serialize all the ISA dependent state
|
||||||
//
|
//
|
||||||
isa.serialize(cpu, os);
|
isa.serialize(baseCpu, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,14 +212,15 @@ SimpleThread::unserialize(Checkpoint *cp, const std::string §ion)
|
||||||
//
|
//
|
||||||
// Now must unserialize all the ISA dependent state
|
// Now must unserialize all the ISA dependent state
|
||||||
//
|
//
|
||||||
isa.unserialize(cpu, cp, section);
|
isa.unserialize(baseCpu, cp, section);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FULL_SYSTEM
|
#if FULL_SYSTEM
|
||||||
void
|
void
|
||||||
SimpleThread::dumpFuncProfile()
|
SimpleThread::dumpFuncProfile()
|
||||||
{
|
{
|
||||||
std::ostream *os = simout.create(csprintf("profile.%s.dat", cpu->name()));
|
std::ostream *os = simout.create(csprintf("profile.%s.dat",
|
||||||
|
baseCpu->name()));
|
||||||
profile->dump(tc, *os);
|
profile->dump(tc, *os);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -240,7 +241,7 @@ SimpleThread::activate(int delay)
|
||||||
_status = ThreadContext::Active;
|
_status = ThreadContext::Active;
|
||||||
|
|
||||||
// status() == Suspended
|
// status() == Suspended
|
||||||
cpu->activateContext(_threadId, delay);
|
baseCpu->activateContext(_threadId, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -261,7 +262,7 @@ SimpleThread::suspend()
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
_status = ThreadContext::Suspended;
|
_status = ThreadContext::Suspended;
|
||||||
cpu->suspendContext(_threadId);
|
baseCpu->suspendContext(_threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,7 +273,7 @@ SimpleThread::halt()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_status = ThreadContext::Halted;
|
_status = ThreadContext::Halted;
|
||||||
cpu->haltContext(_threadId);
|
baseCpu->haltContext(_threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -127,12 +127,9 @@ class SimpleThread : public ThreadState
|
||||||
public:
|
public:
|
||||||
std::string name() const
|
std::string name() const
|
||||||
{
|
{
|
||||||
return csprintf("%s.[tid:%i]", cpu->name(), tc->threadId());
|
return csprintf("%s.[tid:%i]", baseCpu->name(), tc->threadId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// pointer to CPU associated with this SimpleThread
|
|
||||||
BaseCPU *cpu;
|
|
||||||
|
|
||||||
ProxyThreadContext<SimpleThread> *tc;
|
ProxyThreadContext<SimpleThread> *tc;
|
||||||
|
|
||||||
System *system;
|
System *system;
|
||||||
|
@ -207,7 +204,7 @@ class SimpleThread : public ThreadState
|
||||||
* ThreadContext interface functions.
|
* ThreadContext interface functions.
|
||||||
******************************************/
|
******************************************/
|
||||||
|
|
||||||
BaseCPU *getCpuPtr() { return cpu; }
|
BaseCPU *getCpuPtr() { return baseCpu; }
|
||||||
|
|
||||||
TheISA::TLB *getITBPtr() { return itb; }
|
TheISA::TLB *getITBPtr() { return itb; }
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct ThreadState {
|
||||||
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process);
|
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
~ThreadState();
|
virtual ~ThreadState();
|
||||||
|
|
||||||
void serialize(std::ostream &os);
|
void serialize(std::ostream &os);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue