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.
return instDone;
}
+ void takeOverFrom(Decoder * old) {}
+
protected:
/// A cache of decoded instruction objects.
static GenericISA::BasicDecodeCache defaultCache;
fpscrStride = fpscr.stride;
}
+ void takeOverFrom(Decoder *old) {}
+
protected:
/// A cache of decoded instruction objects.
static GenericISA::BasicDecodeCache defaultCache;
return instDone;
}
+ void takeOverFrom(Decoder *old) {}
+
protected:
/// A cache of decoded instruction objects.
static GenericISA::BasicDecodeCache defaultCache;
{
return instDone;
}
+
+ void takeOverFrom(Decoder *old) {}
+
protected:
/// A cache of decoded instruction objects.
static GenericISA::BasicDecodeCache defaultCache;
asi = _asi;
}
+ void takeOverFrom(Decoder *old) {}
+
protected:
/// A cache of decoded instruction objects.
static GenericISA::BasicDecodeCache defaultCache;
}
}
+ 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;
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();
SimpleThread::takeOverFrom(ThreadContext *oldContext)
{
::takeOverFrom(*tc, *oldContext);
+ decoder.takeOverFrom(oldContext->getDecoderPtr());
kernelStats = oldContext->getKernelStats();
funcExeInst = oldContext->readFuncExeInst();