Fixed the number of integer registers. There are MaxGL+1 sets of globals, not just MaxGL.
--HG-- extra : convert_revision : 6fd090f112611db1e72a1f129dff03687d52930a
This commit is contained in:
parent
5407a6bc32
commit
47b2aa6346
2 changed files with 7 additions and 5 deletions
|
@ -48,7 +48,7 @@ namespace SparcISA
|
||||||
std::string getIntRegName(RegIndex);
|
std::string getIntRegName(RegIndex);
|
||||||
|
|
||||||
const int NumIntArchRegs = 32;
|
const int NumIntArchRegs = 32;
|
||||||
const int NumIntRegs = MaxGL * 8 + NWindows * 16 + NumMicroIntRegs;
|
const int NumIntRegs = (MaxGL + 1) * 8 + NWindows * 16 + NumMicroIntRegs;
|
||||||
|
|
||||||
class IntRegFile
|
class IntRegFile
|
||||||
{
|
{
|
||||||
|
|
|
@ -157,6 +157,8 @@ int SparcISA::flattenIntIndex(ThreadContext * tc, int reg)
|
||||||
int cwp = tc->readMiscReg(MISCREG_CWP);
|
int cwp = tc->readMiscReg(MISCREG_CWP);
|
||||||
//DPRINTF(Sparc, "Global Level = %d, Current Window Pointer = %d\n", gl, cwp);
|
//DPRINTF(Sparc, "Global Level = %d, Current Window Pointer = %d\n", gl, cwp);
|
||||||
int newReg;
|
int newReg;
|
||||||
|
//The total number of global registers
|
||||||
|
int numGlobals = (MaxGL + 1) * 8;
|
||||||
if(reg < 8)
|
if(reg < 8)
|
||||||
{
|
{
|
||||||
//Global register
|
//Global register
|
||||||
|
@ -167,14 +169,14 @@ int SparcISA::flattenIntIndex(ThreadContext * tc, int reg)
|
||||||
{
|
{
|
||||||
//Regular windowed register
|
//Regular windowed register
|
||||||
//Put it in the window pointed to by cwp
|
//Put it in the window pointed to by cwp
|
||||||
newReg = MaxGL * 8 +
|
newReg = numGlobals +
|
||||||
((reg - 8 - cwp * 16 + NWindows * 16) % (NWindows * 16));
|
((reg - 8 - cwp * 16 + NWindows * 16) % (NWindows * 16));
|
||||||
}
|
}
|
||||||
else if(reg < NumIntArchRegs + NumMicroIntRegs)
|
else if(reg < NumIntArchRegs + NumMicroIntRegs)
|
||||||
{
|
{
|
||||||
//Microcode register
|
//Microcode register
|
||||||
//Displace from the end of the regular registers
|
//Displace from the end of the regular registers
|
||||||
newReg = reg - NumIntArchRegs + MaxGL * 8 + NWindows * 16;
|
newReg = reg - NumIntArchRegs + numGlobals + NWindows * 16;
|
||||||
}
|
}
|
||||||
else if(reg < 2 * NumIntArchRegs + NumMicroIntRegs)
|
else if(reg < 2 * NumIntArchRegs + NumMicroIntRegs)
|
||||||
{
|
{
|
||||||
|
@ -189,7 +191,7 @@ int SparcISA::flattenIntIndex(ThreadContext * tc, int reg)
|
||||||
{
|
{
|
||||||
//Windowed register from the previous window
|
//Windowed register from the previous window
|
||||||
//Put it in the window before the one pointed to by cwp
|
//Put it in the window before the one pointed to by cwp
|
||||||
newReg = MaxGL * 8 +
|
newReg = numGlobals +
|
||||||
((reg - 8 - (cwp - 1) * 16 + NWindows * 16) % (NWindows * 16));
|
((reg - 8 - (cwp - 1) * 16 + NWindows * 16) % (NWindows * 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,7 +208,7 @@ int SparcISA::flattenIntIndex(ThreadContext * tc, int reg)
|
||||||
{
|
{
|
||||||
//Windowed register from the next window
|
//Windowed register from the next window
|
||||||
//Put it in the window after the one pointed to by cwp
|
//Put it in the window after the one pointed to by cwp
|
||||||
newReg = MaxGL * 8 +
|
newReg = numGlobals +
|
||||||
((reg - 8 - (cwp + 1) * 16 + NWindows * 16) % (NWindows * 16));
|
((reg - 8 - (cwp + 1) * 16 + NWindows * 16) % (NWindows * 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue