Hi Andreas, Thanks for fixing the bug. Your fix is not what I expected though... based on our last email exchange, I had myself convinced that we should change NumFloatRegs back to the old value (-8 from where it is now), and then just hack in the extra 8 needed to leave space for the stack aliases when calculating Ctrl_Reg_Base.
I see how this fix also solves the problem, but it leaves us in the strange situation of having 8 more regs in the float reg file than really exist, which (I would guess) are only ever accessed when they are copied back and forth in this function. What do you think? Steve On Wed, Feb 5, 2014 at 5:05 AM, Andreas Sandberg <[email protected]>wrote: > changeset 32784c63de81 in /z/repo/gem5 > details: http://repo.gem5.org/gem5?cmd=changeset;node=32784c63de81 > description: > x86: Fix x87 state transfer bug > > Changeset 7274310be1bb (isa: clean up register constants) increased > the value of NumFloatRegs, which triggered a bug in > X86ISA::copyRegs(). This bug is caused by the x87 stack being > copied > twice since register indexes past NUM_FLOATREGS are mapped into the > x87 stack relative to the top of the stack, which is undefined when > the copy takes place. > > This changeset updates the copyRegs() function to use access > registers > using the non-flattening interface, which guarantees that > undesirable > register folding does not happen. > > diffstat: > > src/arch/x86/utility.cc | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diffs (20 lines): > > diff -r 09507a45c701 -r 32784c63de81 src/arch/x86/utility.cc > --- a/src/arch/x86/utility.cc Sun Feb 02 16:37:35 2014 +0100 > +++ b/src/arch/x86/utility.cc Wed Feb 05 14:08:13 2014 +0100 > @@ -240,13 +240,13 @@ > { > //copy int regs > for (int i = 0; i < NumIntRegs; ++i) > - dest->setIntReg(i, src->readIntReg(i)); > + dest->setIntRegFlat(i, src->readIntRegFlat(i)); > //copy float regs > for (int i = 0; i < NumFloatRegs; ++i) > - dest->setFloatRegBits(i, src->readFloatRegBits(i)); > + dest->setFloatRegBitsFlat(i, src->readFloatRegBitsFlat(i)); > //copy condition-code regs > for (int i = 0; i < NumCCRegs; ++i) > - dest->setCCReg(i, src->readCCReg(i)); > + dest->setCCRegFlat(i, src->readCCRegFlat(i)); > copyMiscRegs(src, dest); > dest->pcState(src->pcState()); > } > _______________________________________________ > gem5-dev mailing list > [email protected] > http://m5sim.org/mailman/listinfo/gem5-dev > _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
