x86: Changes to decoder, corrects 9376

The changes made by the changeset 9376 were not quite correct. The patch made
changes to the code which resulted in decoder not getting initialized correctly
when the state was restored from a checkpoint.

This patch adds a startup function to each ISA object. For x86, this function
sets the required state in the decoder. For other ISAs, the function is empty
right now.
This commit is contained in:
Nilay Vaish 2013-01-12 22:09:48 -06:00
parent fe3fbe624e
commit 25ec278a0b
12 changed files with 36 additions and 0 deletions

View file

@ -106,6 +106,8 @@ namespace AlphaISA
const Params *params() const; const Params *params() const;
ISA(Params *p); ISA(Params *p);
void startup(ThreadContext *tc) {}
}; };
} }

View file

@ -193,6 +193,8 @@ namespace ArmISA
updateRegMap(tmp_cpsr); updateRegMap(tmp_cpsr);
} }
void startup(ThreadContext *tc) {}
typedef ArmISAParams Params; typedef ArmISAParams Params;
const Params *params() const; const Params *params() const;

View file

@ -157,6 +157,8 @@ namespace MipsISA
static std::string miscRegNames[NumMiscRegs]; static std::string miscRegNames[NumMiscRegs];
public: public:
void startup(ThreadContext *tc) {}
const Params *params() const; const Params *params() const;
ISA(Params *p); ISA(Params *p);

View file

@ -98,6 +98,8 @@ class ISA : public SimObject
return reg; return reg;
} }
void startup(ThreadContext *tc) {}
const Params *params() const; const Params *params() const;
ISA(Params *p); ISA(Params *p);

View file

@ -171,6 +171,8 @@ class ISA : public SimObject
void unserialize(Checkpoint *cp, const std::string & section); void unserialize(Checkpoint *cp, const std::string & section);
void startup(ThreadContext *tc) {}
protected: protected:
bool isHyperPriv() { return hpstate.hpriv; } bool isHyperPriv() { return hpstate.hpriv; }

View file

@ -387,6 +387,12 @@ ISA::unserialize(Checkpoint * cp, const std::string & section)
NULL); NULL);
} }
void
ISA::startup(ThreadContext *tc)
{
tc->getDecoderPtr()->setM5Reg(regVal[MISCREG_M5_REG]);
}
} }
X86ISA::ISA * X86ISA::ISA *

View file

@ -87,6 +87,7 @@ namespace X86ISA
void serialize(std::ostream &os); void serialize(std::ostream &os);
void unserialize(Checkpoint *cp, const std::string &section); void unserialize(Checkpoint *cp, const std::string &section);
void startup(ThreadContext *tc);
}; };
} }

View file

@ -678,6 +678,9 @@ template <class Impl>
void void
FullO3CPU<Impl>::startup() FullO3CPU<Impl>::startup()
{ {
for (int tid = 0; tid < numThreads; ++tid)
isa[tid]->startup(threadContexts[tid]);
fetch.startupStage(); fetch.startupStage();
decode.startupStage(); decode.startupStage();
iew.startupStage(); iew.startupStage();

View file

@ -515,6 +515,13 @@ BaseSimpleCPU::advancePC(Fault fault)
} }
} }
void
BaseSimpleCPU::startup()
{
BaseCPU::startup();
thread->startup();
}
/*Fault /*Fault
BaseSimpleCPU::CacheOp(uint8_t Op, Addr EffAddr) BaseSimpleCPU::CacheOp(uint8_t Op, Addr EffAddr)
{ {

View file

@ -172,6 +172,8 @@ class BaseSimpleCPU : public BaseCPU
virtual void regStats(); virtual void regStats();
virtual void resetStats(); virtual void resetStats();
virtual void startup();
// number of simulated instructions // number of simulated instructions
Counter numInst; Counter numInst;
Counter startNumInst; Counter startNumInst;

View file

@ -142,6 +142,12 @@ SimpleThread::unserialize(Checkpoint *cp, const std::string &section)
::unserialize(*tc, cp, section); ::unserialize(*tc, cp, section);
} }
void
SimpleThread::startup()
{
isa->startup(tc);
}
void void
SimpleThread::dumpFuncProfile() SimpleThread::dumpFuncProfile()
{ {

View file

@ -150,6 +150,7 @@ class SimpleThread : public ThreadState
void serialize(std::ostream &os); void serialize(std::ostream &os);
void unserialize(Checkpoint *cp, const std::string &section); void unserialize(Checkpoint *cp, const std::string &section);
void startup();
/*************************************************************** /***************************************************************
* SimpleThread functions to provide CPU with access to various * SimpleThread functions to provide CPU with access to various