I'm trying to get rid of lots of compiler warnings so that things work
properly with gcc 4.3 and I encountered something that's a bug.

In src/arch/mips/int_regfile.cc

The functions readReg and setReg both check to make sure that "intReg
< NumIntRegs" and do something special if it is.  The confusion I have
comes from the fact that there is an else clause at all.  The else
clause in the setReg case goes ahead and writes a value beyond the end
of the array if the condition is false.

So, either the code is just totally extra and can be deleted, or the
size of the reg array is wrong and it needs to be fixed.  I'm
wondering if it's the latter case, because there's a comment in
readReg that says
"        // Read from shadow GPR .. probably called by RDPGPR"

Looking in decoder.isa for that instruction seems to indicate that the
system can indeed access registers > NumIntRegs.

Is it possible that we're multiplying by the wrong number in rdpgpr
and wrpgpr? Should we be multiplying by NumIntArchRegs, not
NumIntRegs?

So, the question is, what's the right fix?  If we don't arrive at a
solution, I guess I could just remove the code and add an assertion if
the condition is false.

  Nate
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to