x86, cpu: corrects 270c9a75e91f, take over decoder on cpu switch
The changes made by the changeset 270c9a75e91f do not work well with switching of cpus. The problem is that decoder for the old thread context holds state that is not taken over by the new decoder. This patch adds a takeOverFrom() function to Decoder class in each ISA. Except for x86, functions in other ISAs are blank. For x86, the function copies state from the old decoder to the new decoder.
This commit is contained in:
parent
62544f938a
commit
fc57ae6401
8 changed files with 28 additions and 0 deletions
|
@ -83,6 +83,8 @@ class Decoder
|
|||
return instDone;
|
||||
}
|
||||
|
||||
void takeOverFrom(Decoder * old) {}
|
||||
|
||||
protected:
|
||||
/// A cache of decoded instruction objects.
|
||||
static GenericISA::BasicDecodeCache defaultCache;
|
||||
|
|
|
@ -116,6 +116,8 @@ class Decoder
|
|||
fpscrStride = fpscr.stride;
|
||||
}
|
||||
|
||||
void takeOverFrom(Decoder *old) {}
|
||||
|
||||
protected:
|
||||
/// A cache of decoded instruction objects.
|
||||
static GenericISA::BasicDecodeCache defaultCache;
|
||||
|
|
|
@ -83,6 +83,8 @@ class Decoder
|
|||
return instDone;
|
||||
}
|
||||
|
||||
void takeOverFrom(Decoder *old) {}
|
||||
|
||||
protected:
|
||||
/// A cache of decoded instruction objects.
|
||||
static GenericISA::BasicDecodeCache defaultCache;
|
||||
|
|
|
@ -89,6 +89,9 @@ class Decoder
|
|||
{
|
||||
return instDone;
|
||||
}
|
||||
|
||||
void takeOverFrom(Decoder *old) {}
|
||||
|
||||
protected:
|
||||
/// A cache of decoded instruction objects.
|
||||
static GenericISA::BasicDecodeCache defaultCache;
|
||||
|
|
|
@ -97,6 +97,8 @@ class Decoder
|
|||
asi = _asi;
|
||||
}
|
||||
|
||||
void takeOverFrom(Decoder *old) {}
|
||||
|
||||
protected:
|
||||
/// A cache of decoded instruction objects.
|
||||
static GenericISA::BasicDecodeCache defaultCache;
|
||||
|
|
|
@ -250,6 +250,19 @@ class Decoder
|
|||
}
|
||||
}
|
||||
|
||||
void takeOverFrom(Decoder *old)
|
||||
{
|
||||
mode = old->mode;
|
||||
submode = old->submode;
|
||||
emi.mode.mode = mode;
|
||||
emi.mode.submode = submode;
|
||||
altOp = old->altOp;
|
||||
defOp = old->defOp;
|
||||
altAddr = old->altAddr;
|
||||
defAddr = old->defAddr;
|
||||
stack = old->stack;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
state = ResetState;
|
||||
|
|
|
@ -67,6 +67,9 @@ void
|
|||
O3ThreadContext<Impl>::takeOverFrom(ThreadContext *old_context)
|
||||
{
|
||||
::takeOverFrom(*this, *old_context);
|
||||
TheISA::Decoder *newDecoder = getDecoderPtr();
|
||||
TheISA::Decoder *oldDecoder = old_context->getDecoderPtr();
|
||||
newDecoder->takeOverFrom(oldDecoder);
|
||||
|
||||
thread->kernelStats = old_context->getKernelStats();
|
||||
thread->funcExeInst = old_context->readFuncExeInst();
|
||||
|
|
|
@ -108,6 +108,7 @@ void
|
|||
SimpleThread::takeOverFrom(ThreadContext *oldContext)
|
||||
{
|
||||
::takeOverFrom(*tc, *oldContext);
|
||||
decoder.takeOverFrom(oldContext->getDecoderPtr());
|
||||
|
||||
kernelStats = oldContext->getKernelStats();
|
||||
funcExeInst = oldContext->readFuncExeInst();
|
||||
|
|
Loading…
Reference in a new issue