SPARC: Clean up some historical style issues.
This commit is contained in:
parent
0b7967d606
commit
cdc585e0e8
51 changed files with 2213 additions and 2189 deletions
|
@ -33,160 +33,161 @@
|
|||
|
||||
namespace SparcISA
|
||||
{
|
||||
bool AsiIsBlock(ASI asi)
|
||||
|
||||
bool
|
||||
asiIsBlock(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_BLK_AIUP) ||
|
||||
(asi == ASI_BLK_AIUS) ||
|
||||
(asi == ASI_BLK_AIUP_L) ||
|
||||
(asi == ASI_BLK_AIUS_L) ||
|
||||
(asi == ASI_BLK_P) ||
|
||||
(asi == ASI_BLK_S) ||
|
||||
(asi == ASI_BLK_PL) ||
|
||||
(asi == ASI_BLK_SL);
|
||||
return asi == ASI_BLK_AIUP ||
|
||||
asi == ASI_BLK_AIUS ||
|
||||
asi == ASI_BLK_AIUP_L ||
|
||||
asi == ASI_BLK_AIUS_L ||
|
||||
asi == ASI_BLK_P ||
|
||||
asi == ASI_BLK_S ||
|
||||
asi == ASI_BLK_PL ||
|
||||
asi == ASI_BLK_SL;
|
||||
}
|
||||
|
||||
bool AsiIsPrimary(ASI asi)
|
||||
bool
|
||||
asiIsPrimary(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_AIUP) ||
|
||||
(asi == ASI_BLK_AIUP) ||
|
||||
(asi == ASI_AIUP_L) ||
|
||||
(asi == ASI_BLK_AIUP_L) ||
|
||||
(asi == ASI_LDTX_AIUP) ||
|
||||
(asi == ASI_LDTX_AIUP_L) ||
|
||||
(asi == ASI_P) ||
|
||||
(asi == ASI_PNF) ||
|
||||
(asi == ASI_PL) ||
|
||||
(asi == ASI_PNFL) ||
|
||||
(asi == ASI_PST8_P) ||
|
||||
(asi == ASI_PST16_P) ||
|
||||
(asi == ASI_PST32_P) ||
|
||||
(asi == ASI_PST8_PL) ||
|
||||
(asi == ASI_PST16_PL) ||
|
||||
(asi == ASI_PST32_PL) ||
|
||||
(asi == ASI_FL8_P) ||
|
||||
(asi == ASI_FL16_P) ||
|
||||
(asi == ASI_FL8_PL) ||
|
||||
(asi == ASI_FL16_PL) ||
|
||||
(asi == ASI_LDTX_P) ||
|
||||
(asi == ASI_LDTX_PL) ||
|
||||
(asi == ASI_BLK_P) ||
|
||||
(asi == ASI_BLK_PL);
|
||||
return asi == ASI_AIUP ||
|
||||
asi == ASI_BLK_AIUP ||
|
||||
asi == ASI_AIUP_L ||
|
||||
asi == ASI_BLK_AIUP_L ||
|
||||
asi == ASI_LDTX_AIUP ||
|
||||
asi == ASI_LDTX_AIUP_L ||
|
||||
asi == ASI_P ||
|
||||
asi == ASI_PNF ||
|
||||
asi == ASI_PL ||
|
||||
asi == ASI_PNFL ||
|
||||
asi == ASI_PST8_P ||
|
||||
asi == ASI_PST16_P ||
|
||||
asi == ASI_PST32_P ||
|
||||
asi == ASI_PST8_PL ||
|
||||
asi == ASI_PST16_PL ||
|
||||
asi == ASI_PST32_PL ||
|
||||
asi == ASI_FL8_P ||
|
||||
asi == ASI_FL16_P ||
|
||||
asi == ASI_FL8_PL ||
|
||||
asi == ASI_FL16_PL ||
|
||||
asi == ASI_LDTX_P ||
|
||||
asi == ASI_LDTX_PL ||
|
||||
asi == ASI_BLK_P ||
|
||||
asi == ASI_BLK_PL;
|
||||
}
|
||||
|
||||
bool AsiIsSecondary(ASI asi)
|
||||
bool
|
||||
asiIsSecondary(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_AIUS) ||
|
||||
(asi == ASI_BLK_AIUS) ||
|
||||
(asi == ASI_AIUS_L) ||
|
||||
(asi == ASI_BLK_AIUS_L) ||
|
||||
(asi == ASI_LDTX_AIUS) ||
|
||||
(asi == ASI_LDTX_AIUS_L) ||
|
||||
(asi == ASI_S) ||
|
||||
(asi == ASI_SNF) ||
|
||||
(asi == ASI_SL) ||
|
||||
(asi == ASI_SNFL) ||
|
||||
(asi == ASI_PST8_S) ||
|
||||
(asi == ASI_PST16_S) ||
|
||||
(asi == ASI_PST32_S) ||
|
||||
(asi == ASI_PST8_SL) ||
|
||||
(asi == ASI_PST16_SL) ||
|
||||
(asi == ASI_PST32_SL) ||
|
||||
(asi == ASI_FL8_S) ||
|
||||
(asi == ASI_FL16_S) ||
|
||||
(asi == ASI_FL8_SL) ||
|
||||
(asi == ASI_FL16_SL) ||
|
||||
(asi == ASI_LDTX_S) ||
|
||||
(asi == ASI_LDTX_SL) ||
|
||||
(asi == ASI_BLK_S) ||
|
||||
(asi == ASI_BLK_SL);
|
||||
return asi == ASI_AIUS ||
|
||||
asi == ASI_BLK_AIUS ||
|
||||
asi == ASI_AIUS_L ||
|
||||
asi == ASI_BLK_AIUS_L ||
|
||||
asi == ASI_LDTX_AIUS ||
|
||||
asi == ASI_LDTX_AIUS_L ||
|
||||
asi == ASI_S ||
|
||||
asi == ASI_SNF ||
|
||||
asi == ASI_SL ||
|
||||
asi == ASI_SNFL ||
|
||||
asi == ASI_PST8_S ||
|
||||
asi == ASI_PST16_S ||
|
||||
asi == ASI_PST32_S ||
|
||||
asi == ASI_PST8_SL ||
|
||||
asi == ASI_PST16_SL ||
|
||||
asi == ASI_PST32_SL ||
|
||||
asi == ASI_FL8_S ||
|
||||
asi == ASI_FL16_S ||
|
||||
asi == ASI_FL8_SL ||
|
||||
asi == ASI_FL16_SL ||
|
||||
asi == ASI_LDTX_S ||
|
||||
asi == ASI_LDTX_SL ||
|
||||
asi == ASI_BLK_S ||
|
||||
asi == ASI_BLK_SL;
|
||||
}
|
||||
|
||||
bool AsiIsNucleus(ASI asi)
|
||||
bool
|
||||
asiIsNucleus(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_N) ||
|
||||
(asi == ASI_NL) ||
|
||||
(asi == ASI_LDTX_N) ||
|
||||
(asi == ASI_LDTX_NL);
|
||||
return asi == ASI_N ||
|
||||
asi == ASI_NL ||
|
||||
asi == ASI_LDTX_N ||
|
||||
asi == ASI_LDTX_NL;
|
||||
}
|
||||
|
||||
bool AsiIsAsIfUser(ASI asi)
|
||||
bool
|
||||
asiIsAsIfUser(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_AIUP) ||
|
||||
(asi == ASI_AIUS) ||
|
||||
(asi == ASI_BLK_AIUP) ||
|
||||
(asi == ASI_BLK_AIUS) ||
|
||||
(asi == ASI_AIUP_L) ||
|
||||
(asi == ASI_AIUS_L) ||
|
||||
(asi == ASI_BLK_AIUP_L) ||
|
||||
(asi == ASI_BLK_AIUS_L) ||
|
||||
(asi == ASI_LDTX_AIUP) ||
|
||||
(asi == ASI_LDTX_AIUS) ||
|
||||
(asi == ASI_LDTX_AIUP_L) ||
|
||||
(asi == ASI_LDTX_AIUS_L);
|
||||
return asi == ASI_AIUP ||
|
||||
asi == ASI_AIUS ||
|
||||
asi == ASI_BLK_AIUP ||
|
||||
asi == ASI_BLK_AIUS ||
|
||||
asi == ASI_AIUP_L ||
|
||||
asi == ASI_AIUS_L ||
|
||||
asi == ASI_BLK_AIUP_L ||
|
||||
asi == ASI_BLK_AIUS_L ||
|
||||
asi == ASI_LDTX_AIUP ||
|
||||
asi == ASI_LDTX_AIUS ||
|
||||
asi == ASI_LDTX_AIUP_L ||
|
||||
asi == ASI_LDTX_AIUS_L;
|
||||
}
|
||||
|
||||
bool AsiIsIO(ASI asi)
|
||||
bool
|
||||
asiIsIO(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_REAL_IO) ||
|
||||
(asi == ASI_REAL_IO_L);
|
||||
return asi == ASI_REAL_IO ||
|
||||
asi == ASI_REAL_IO_L;
|
||||
}
|
||||
|
||||
bool AsiIsReal(ASI asi)
|
||||
bool
|
||||
asiIsReal(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_REAL) ||
|
||||
(asi == ASI_REAL_IO) ||
|
||||
(asi == ASI_REAL_L) ||
|
||||
(asi == ASI_REAL_IO_L) ||
|
||||
(asi == ASI_LDTX_REAL) ||
|
||||
(asi == ASI_LDTX_REAL_L);
|
||||
return asi == ASI_REAL ||
|
||||
asi == ASI_REAL_IO ||
|
||||
asi == ASI_REAL_L ||
|
||||
asi == ASI_REAL_IO_L ||
|
||||
asi == ASI_LDTX_REAL ||
|
||||
asi == ASI_LDTX_REAL_L;
|
||||
}
|
||||
|
||||
bool AsiIsLittle(ASI asi)
|
||||
bool
|
||||
asiIsLittle(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_NL) ||
|
||||
(asi == ASI_AIUP_L) ||
|
||||
(asi == ASI_AIUS_L) ||
|
||||
(asi == ASI_REAL_L) ||
|
||||
(asi == ASI_REAL_IO_L) ||
|
||||
(asi == ASI_BLK_AIUP_L) ||
|
||||
(asi == ASI_BLK_AIUS_L) ||
|
||||
(asi == ASI_LDTX_AIUP_L) ||
|
||||
(asi == ASI_LDTX_AIUS_L) ||
|
||||
(asi == ASI_LDTX_REAL_L) ||
|
||||
(asi == ASI_LDTX_NL) ||
|
||||
(asi == ASI_PL) ||
|
||||
(asi == ASI_SL) ||
|
||||
(asi == ASI_PNFL) ||
|
||||
(asi == ASI_SNFL) ||
|
||||
(asi == ASI_PST8_PL) ||
|
||||
(asi == ASI_PST8_SL) ||
|
||||
(asi == ASI_PST16_PL) ||
|
||||
(asi == ASI_PST16_SL) ||
|
||||
(asi == ASI_PST32_PL) ||
|
||||
(asi == ASI_PST32_SL) ||
|
||||
(asi == ASI_FL8_PL) ||
|
||||
(asi == ASI_FL8_SL) ||
|
||||
(asi == ASI_FL16_PL) ||
|
||||
(asi == ASI_FL16_SL) ||
|
||||
(asi == ASI_LDTX_PL) ||
|
||||
(asi == ASI_LDTX_SL) ||
|
||||
(asi == ASI_BLK_PL) ||
|
||||
(asi == ASI_BLK_SL) ||
|
||||
(asi == ASI_LTX_L);
|
||||
return asi == ASI_NL ||
|
||||
asi == ASI_AIUP_L ||
|
||||
asi == ASI_AIUS_L ||
|
||||
asi == ASI_REAL_L ||
|
||||
asi == ASI_REAL_IO_L ||
|
||||
asi == ASI_BLK_AIUP_L ||
|
||||
asi == ASI_BLK_AIUS_L ||
|
||||
asi == ASI_LDTX_AIUP_L ||
|
||||
asi == ASI_LDTX_AIUS_L ||
|
||||
asi == ASI_LDTX_REAL_L ||
|
||||
asi == ASI_LDTX_NL ||
|
||||
asi == ASI_PL ||
|
||||
asi == ASI_SL ||
|
||||
asi == ASI_PNFL ||
|
||||
asi == ASI_SNFL ||
|
||||
asi == ASI_PST8_PL ||
|
||||
asi == ASI_PST8_SL ||
|
||||
asi == ASI_PST16_PL ||
|
||||
asi == ASI_PST16_SL ||
|
||||
asi == ASI_PST32_PL ||
|
||||
asi == ASI_PST32_SL ||
|
||||
asi == ASI_FL8_PL ||
|
||||
asi == ASI_FL8_SL ||
|
||||
asi == ASI_FL16_PL ||
|
||||
asi == ASI_FL16_SL ||
|
||||
asi == ASI_LDTX_PL ||
|
||||
asi == ASI_LDTX_SL ||
|
||||
asi == ASI_BLK_PL ||
|
||||
asi == ASI_BLK_SL ||
|
||||
asi == ASI_LTX_L;
|
||||
}
|
||||
|
||||
bool AsiIsTwin(ASI asi)
|
||||
bool
|
||||
asiIsTwin(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi >= ASI_LDTX_AIUP &&
|
||||
return (asi >= ASI_LDTX_AIUP &&
|
||||
asi <= ASI_LDTX_N &&
|
||||
asi != ASI_QUEUE) ||
|
||||
(asi >= ASI_LDTX_AIUP_L &&
|
||||
|
@ -198,72 +199,75 @@ namespace SparcISA
|
|||
asi == ASI_LDTX_SL;
|
||||
}
|
||||
|
||||
bool AsiIsPartialStore(ASI asi)
|
||||
bool
|
||||
asiIsPartialStore(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_PST8_P) ||
|
||||
(asi == ASI_PST8_S) ||
|
||||
(asi == ASI_PST16_P) ||
|
||||
(asi == ASI_PST16_S) ||
|
||||
(asi == ASI_PST32_P) ||
|
||||
(asi == ASI_PST32_S) ||
|
||||
(asi == ASI_PST8_PL) ||
|
||||
(asi == ASI_PST8_SL) ||
|
||||
(asi == ASI_PST16_PL) ||
|
||||
(asi == ASI_PST16_SL) ||
|
||||
(asi == ASI_PST32_PL) ||
|
||||
(asi == ASI_PST32_SL);
|
||||
return asi == ASI_PST8_P ||
|
||||
asi == ASI_PST8_S ||
|
||||
asi == ASI_PST16_P ||
|
||||
asi == ASI_PST16_S ||
|
||||
asi == ASI_PST32_P ||
|
||||
asi == ASI_PST32_S ||
|
||||
asi == ASI_PST8_PL ||
|
||||
asi == ASI_PST8_SL ||
|
||||
asi == ASI_PST16_PL ||
|
||||
asi == ASI_PST16_SL ||
|
||||
asi == ASI_PST32_PL ||
|
||||
asi == ASI_PST32_SL;
|
||||
}
|
||||
|
||||
bool AsiIsFloatingLoad(ASI asi)
|
||||
bool
|
||||
asiIsFloatingLoad(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_FL8_P) ||
|
||||
(asi == ASI_FL8_S) ||
|
||||
(asi == ASI_FL16_P) ||
|
||||
(asi == ASI_FL16_S) ||
|
||||
(asi == ASI_FL8_PL) ||
|
||||
(asi == ASI_FL8_SL) ||
|
||||
(asi == ASI_FL16_PL) ||
|
||||
(asi == ASI_FL16_SL);
|
||||
return asi == ASI_FL8_P ||
|
||||
asi == ASI_FL8_S ||
|
||||
asi == ASI_FL16_P ||
|
||||
asi == ASI_FL16_S ||
|
||||
asi == ASI_FL8_PL ||
|
||||
asi == ASI_FL8_SL ||
|
||||
asi == ASI_FL16_PL ||
|
||||
asi == ASI_FL16_SL;
|
||||
}
|
||||
|
||||
bool AsiIsNoFault(ASI asi)
|
||||
bool
|
||||
asiIsNoFault(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_PNF) ||
|
||||
(asi == ASI_SNF) ||
|
||||
(asi == ASI_PNFL) ||
|
||||
(asi == ASI_SNFL);
|
||||
return asi == ASI_PNF ||
|
||||
asi == ASI_SNF ||
|
||||
asi == ASI_PNFL ||
|
||||
asi == ASI_SNFL;
|
||||
}
|
||||
|
||||
bool AsiIsScratchPad(ASI asi)
|
||||
bool
|
||||
asiIsScratchPad(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_SCRATCHPAD) ||
|
||||
(asi == ASI_HYP_SCRATCHPAD);
|
||||
return asi == ASI_SCRATCHPAD ||
|
||||
asi == ASI_HYP_SCRATCHPAD;
|
||||
}
|
||||
|
||||
bool AsiIsCmt(ASI asi)
|
||||
bool
|
||||
asiIsCmt(ASI asi)
|
||||
{
|
||||
return
|
||||
(asi == ASI_CMT_PER_STRAND) ||
|
||||
(asi == ASI_CMT_SHARED);
|
||||
return asi == ASI_CMT_PER_STRAND ||
|
||||
asi == ASI_CMT_SHARED;
|
||||
}
|
||||
|
||||
bool AsiIsQueue(ASI asi)
|
||||
bool
|
||||
asiIsQueue(ASI asi)
|
||||
{
|
||||
return asi == ASI_QUEUE;
|
||||
}
|
||||
|
||||
bool AsiIsInterrupt(ASI asi)
|
||||
bool
|
||||
asiIsInterrupt(ASI asi)
|
||||
{
|
||||
return asi == ASI_SWVR_INTR_RECEIVE ||
|
||||
asi == ASI_SWVR_UDB_INTR_W ||
|
||||
asi == ASI_SWVR_UDB_INTR_R ;
|
||||
}
|
||||
|
||||
bool AsiIsMmu(ASI asi)
|
||||
bool
|
||||
asiIsMmu(ASI asi)
|
||||
{
|
||||
return asi == ASI_MMU ||
|
||||
asi == ASI_LSU_CONTROL_REG ||
|
||||
|
@ -277,30 +281,35 @@ namespace SparcISA
|
|||
asi <= ASI_TLB_INVALIDATE_ALL);
|
||||
}
|
||||
|
||||
bool AsiIsUnPriv(ASI asi)
|
||||
bool
|
||||
asiIsUnPriv(ASI asi)
|
||||
{
|
||||
return asi >= 0x80;
|
||||
}
|
||||
|
||||
bool AsiIsPriv(ASI asi)
|
||||
bool
|
||||
asiIsPriv(ASI asi)
|
||||
{
|
||||
return asi <= 0x2f;
|
||||
}
|
||||
|
||||
|
||||
bool AsiIsHPriv(ASI asi)
|
||||
bool
|
||||
asiIsHPriv(ASI asi)
|
||||
{
|
||||
return asi >= 0x30 && asi <= 0x7f;
|
||||
}
|
||||
|
||||
bool AsiIsReg(ASI asi)
|
||||
bool
|
||||
asiIsReg(ASI asi)
|
||||
{
|
||||
return AsiIsMmu(asi) || AsiIsScratchPad(asi) ||
|
||||
AsiIsSparcError(asi) || AsiIsInterrupt(asi)
|
||||
|| AsiIsCmt(asi);
|
||||
return asiIsMmu(asi) || asiIsScratchPad(asi) ||
|
||||
asiIsSparcError(asi) || asiIsInterrupt(asi)
|
||||
|| asiIsCmt(asi);
|
||||
}
|
||||
|
||||
bool AsiIsSparcError(ASI asi)
|
||||
bool
|
||||
asiIsSparcError(ASI asi)
|
||||
{
|
||||
return asi == ASI_SPARC_ERROR_EN_REG ||
|
||||
asi == ASI_SPARC_ERROR_STATUS_REG;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
namespace SparcISA
|
||||
{
|
||||
|
||||
enum ASI {
|
||||
ASI_IMPLICIT = 0x00,
|
||||
/* Priveleged ASIs */
|
||||
|
@ -248,29 +249,29 @@ namespace SparcISA
|
|||
};
|
||||
|
||||
// Functions that classify an asi
|
||||
bool AsiIsBlock(ASI);
|
||||
bool AsiIsPrimary(ASI);
|
||||
bool AsiIsSecondary(ASI);
|
||||
bool AsiIsNucleus(ASI);
|
||||
bool AsiIsAsIfUser(ASI);
|
||||
bool AsiIsIO(ASI);
|
||||
bool AsiIsReal(ASI);
|
||||
bool AsiIsLittle(ASI);
|
||||
bool AsiIsTwin(ASI);
|
||||
bool AsiIsPartialStore(ASI);
|
||||
bool AsiIsFloatingLoad(ASI);
|
||||
bool AsiIsNoFault(ASI);
|
||||
bool AsiIsScratchPad(ASI);
|
||||
bool AsiIsCmt(ASI);
|
||||
bool AsiIsQueue(ASI);
|
||||
bool AsiIsDtlb(ASI);
|
||||
bool AsiIsMmu(ASI);
|
||||
bool AsiIsUnPriv(ASI);
|
||||
bool AsiIsPriv(ASI);
|
||||
bool AsiIsHPriv(ASI);
|
||||
bool AsiIsReg(ASI);
|
||||
bool AsiIsInterrupt(ASI);
|
||||
bool AsiIsSparcError(ASI);
|
||||
bool asiIsBlock(ASI);
|
||||
bool asiIsPrimary(ASI);
|
||||
bool asiIsSecondary(ASI);
|
||||
bool asiIsNucleus(ASI);
|
||||
bool asiIsAsIfUser(ASI);
|
||||
bool asiIsIO(ASI);
|
||||
bool asiIsReal(ASI);
|
||||
bool asiIsLittle(ASI);
|
||||
bool asiIsTwin(ASI);
|
||||
bool asiIsPartialStore(ASI);
|
||||
bool asiIsFloatingLoad(ASI);
|
||||
bool asiIsNoFault(ASI);
|
||||
bool asiIsScratchPad(ASI);
|
||||
bool asiIsCmt(ASI);
|
||||
bool asiIsQueue(ASI);
|
||||
bool asiIsDtlb(ASI);
|
||||
bool asiIsMmu(ASI);
|
||||
bool asiIsUnPriv(ASI);
|
||||
bool asiIsPriv(ASI);
|
||||
bool asiIsHPriv(ASI);
|
||||
bool asiIsReg(ASI);
|
||||
bool asiIsInterrupt(ASI);
|
||||
bool asiIsSparcError(ASI);
|
||||
};
|
||||
|
||||
#endif // __ARCH_SPARC_ASI_HH__
|
||||
|
|
|
@ -272,7 +272,8 @@ template<> SparcFaultBase::FaultVals
|
|||
* effects which go with entering RED state because of a trap.
|
||||
*/
|
||||
|
||||
void enterREDState(ThreadContext *tc)
|
||||
void
|
||||
enterREDState(ThreadContext *tc)
|
||||
{
|
||||
//@todo Disable the mmu?
|
||||
//@todo Disable watchpoints?
|
||||
|
@ -294,17 +295,16 @@ void enterREDState(ThreadContext *tc)
|
|||
* the handler.
|
||||
*/
|
||||
|
||||
void doREDFault(ThreadContext *tc, TrapType tt)
|
||||
void
|
||||
doREDFault(ThreadContext *tc, TrapType tt)
|
||||
{
|
||||
MiscReg TL = tc->readMiscRegNoEffect(MISCREG_TL);
|
||||
MiscReg TSTATE = tc->readMiscRegNoEffect(MISCREG_TSTATE);
|
||||
MiscReg PSTATE = tc->readMiscRegNoEffect(MISCREG_PSTATE);
|
||||
MiscReg HPSTATE = tc->readMiscRegNoEffect(MISCREG_HPSTATE);
|
||||
//MiscReg CCR = tc->readMiscRegNoEffect(MISCREG_CCR);
|
||||
MiscReg CCR = tc->readIntReg(NumIntArchRegs + 2);
|
||||
MiscReg ASI = tc->readMiscRegNoEffect(MISCREG_ASI);
|
||||
MiscReg CWP = tc->readMiscRegNoEffect(MISCREG_CWP);
|
||||
//MiscReg CANSAVE = tc->readMiscRegNoEffect(MISCREG_CANSAVE);
|
||||
MiscReg CANSAVE = tc->readMiscRegNoEffect(NumIntArchRegs + 3);
|
||||
MiscReg GL = tc->readMiscRegNoEffect(MISCREG_GL);
|
||||
PCState pc = tc->pcState();
|
||||
|
@ -365,8 +365,7 @@ void doREDFault(ThreadContext *tc, TrapType tt)
|
|||
else
|
||||
changedCWP = false;
|
||||
|
||||
if(changedCWP)
|
||||
{
|
||||
if (changedCWP) {
|
||||
CWP = (CWP + NWindows) % NWindows;
|
||||
tc->setMiscReg(MISCREG_CWP, CWP);
|
||||
}
|
||||
|
@ -377,17 +376,16 @@ void doREDFault(ThreadContext *tc, TrapType tt)
|
|||
* the handler.
|
||||
*/
|
||||
|
||||
void doNormalFault(ThreadContext *tc, TrapType tt, bool gotoHpriv)
|
||||
void
|
||||
doNormalFault(ThreadContext *tc, TrapType tt, bool gotoHpriv)
|
||||
{
|
||||
MiscReg TL = tc->readMiscRegNoEffect(MISCREG_TL);
|
||||
MiscReg TSTATE = tc->readMiscRegNoEffect(MISCREG_TSTATE);
|
||||
MiscReg PSTATE = tc->readMiscRegNoEffect(MISCREG_PSTATE);
|
||||
MiscReg HPSTATE = tc->readMiscRegNoEffect(MISCREG_HPSTATE);
|
||||
//MiscReg CCR = tc->readMiscRegNoEffect(MISCREG_CCR);
|
||||
MiscReg CCR = tc->readIntReg(NumIntArchRegs + 2);
|
||||
MiscReg ASI = tc->readMiscRegNoEffect(MISCREG_ASI);
|
||||
MiscReg CWP = tc->readMiscRegNoEffect(MISCREG_CWP);
|
||||
//MiscReg CANSAVE = tc->readMiscRegNoEffect(MISCREG_CANSAVE);
|
||||
MiscReg CANSAVE = tc->readIntReg(NumIntArchRegs + 3);
|
||||
MiscReg GL = tc->readMiscRegNoEffect(MISCREG_GL);
|
||||
PCState pc = tc->pcState();
|
||||
|
@ -438,8 +436,7 @@ void doNormalFault(ThreadContext *tc, TrapType tt, bool gotoHpriv)
|
|||
// PSTATE.tle is unchanged
|
||||
// PSTATE.tct = 0
|
||||
|
||||
if (gotoHpriv)
|
||||
{
|
||||
if (gotoHpriv) {
|
||||
PSTATE &= ~(1 << 9); // PSTATE.cle = 0
|
||||
// The manual says PSTATE.priv should be 0, but Legion leaves it alone
|
||||
HPSTATE &= ~(1 << 5); // HPSTATE.red = 0
|
||||
|
@ -464,14 +461,14 @@ void doNormalFault(ThreadContext *tc, TrapType tt, bool gotoHpriv)
|
|||
else
|
||||
changedCWP = false;
|
||||
|
||||
if (changedCWP)
|
||||
{
|
||||
if (changedCWP) {
|
||||
CWP = (CWP + NWindows) % NWindows;
|
||||
tc->setMiscReg(MISCREG_CWP, CWP);
|
||||
}
|
||||
}
|
||||
|
||||
void getREDVector(MiscReg TT, Addr &PC, Addr &NPC)
|
||||
void
|
||||
getREDVector(MiscReg TT, Addr &PC, Addr &NPC)
|
||||
{
|
||||
//XXX The following constant might belong in a header file.
|
||||
const Addr RSTVAddr = 0xFFF0000000ULL;
|
||||
|
@ -479,14 +476,16 @@ void getREDVector(MiscReg TT, Addr &PC, Addr &NPC)
|
|||
NPC = PC + sizeof(MachInst);
|
||||
}
|
||||
|
||||
void getHyperVector(ThreadContext * tc, Addr & PC, Addr & NPC, MiscReg TT)
|
||||
void
|
||||
getHyperVector(ThreadContext * tc, Addr &PC, Addr &NPC, MiscReg TT)
|
||||
{
|
||||
Addr HTBA = tc->readMiscRegNoEffect(MISCREG_HTBA);
|
||||
PC = (HTBA & ~mask(14)) | ((TT << 5) & mask(14));
|
||||
NPC = PC + sizeof(MachInst);
|
||||
}
|
||||
|
||||
void getPrivVector(ThreadContext * tc, Addr & PC, Addr & NPC, MiscReg TT, MiscReg TL)
|
||||
void
|
||||
getPrivVector(ThreadContext *tc, Addr &PC, Addr &NPC, MiscReg TT, MiscReg TL)
|
||||
{
|
||||
Addr TBA = tc->readMiscRegNoEffect(MISCREG_TBA);
|
||||
PC = (TBA & ~mask(15)) |
|
||||
|
@ -497,9 +496,9 @@ void getPrivVector(ThreadContext * tc, Addr & PC, Addr & NPC, MiscReg TT, MiscRe
|
|||
|
||||
#if FULL_SYSTEM
|
||||
|
||||
void SparcFaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
|
||||
void
|
||||
SparcFaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
|
||||
{
|
||||
//panic("Invoking a second fault!\n");
|
||||
FaultBase::invoke(tc);
|
||||
countStat()++;
|
||||
|
||||
|
@ -555,7 +554,8 @@ void SparcFaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
|
|||
tc->pcState(pc);
|
||||
}
|
||||
|
||||
void PowerOnReset::invoke(ThreadContext * tc, StaticInstPtr inst)
|
||||
void
|
||||
PowerOnReset::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
{
|
||||
// For SPARC, when a system is first started, there is a power
|
||||
// on reset Trap which sets the processor into the following state.
|
||||
|
@ -621,8 +621,8 @@ void PowerOnReset::invoke(ThreadContext * tc, StaticInstPtr inst)
|
|||
|
||||
#else // !FULL_SYSTEM
|
||||
|
||||
void FastInstructionAccessMMUMiss::invoke(ThreadContext *tc,
|
||||
StaticInstPtr inst)
|
||||
void
|
||||
FastInstructionAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
{
|
||||
Process *p = tc->getProcessPtr();
|
||||
TlbEntry entry;
|
||||
|
@ -636,7 +636,8 @@ void FastInstructionAccessMMUMiss::invoke(ThreadContext *tc,
|
|||
}
|
||||
}
|
||||
|
||||
void FastDataAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
void
|
||||
FastDataAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
{
|
||||
Process *p = tc->getProcessPtr();
|
||||
TlbEntry entry;
|
||||
|
@ -654,7 +655,8 @@ void FastDataAccessMMUMiss::invoke(ThreadContext *tc, StaticInstPtr inst)
|
|||
}
|
||||
}
|
||||
|
||||
void SpillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
void
|
||||
SpillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
{
|
||||
doNormalFault(tc, trapType(), false);
|
||||
|
||||
|
@ -668,7 +670,8 @@ void SpillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
|
|||
tc->pcState(lp->readSpillStart());
|
||||
}
|
||||
|
||||
void FillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
void
|
||||
FillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
{
|
||||
doNormalFault(tc, trapType(), false);
|
||||
|
||||
|
@ -682,7 +685,8 @@ void FillNNormal::invoke(ThreadContext *tc, StaticInstPtr inst)
|
|||
tc->pcState(lp->readFillStart());
|
||||
}
|
||||
|
||||
void TrapInstruction::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
void
|
||||
TrapInstruction::invoke(ThreadContext *tc, StaticInstPtr inst)
|
||||
{
|
||||
// In SE, this mechanism is how the process requests a service from the
|
||||
// operating system. We'll get the process object from the thread context
|
||||
|
|
|
@ -86,7 +86,9 @@ class SparcFault : public SparcFaultBase
|
|||
TrapType trapType() { return vals.trapType; }
|
||||
FaultPriority priority() { return vals.priority; }
|
||||
FaultStat & countStat() { return vals.count; }
|
||||
PrivilegeLevel getNextLevel(PrivilegeLevel current)
|
||||
|
||||
PrivilegeLevel
|
||||
getNextLevel(PrivilegeLevel current)
|
||||
{
|
||||
return vals.nextPrivilegeLevel[current];
|
||||
}
|
||||
|
@ -143,7 +145,8 @@ class InternalProcessorError :
|
|||
bool isMachineCheckFault() const { return true; }
|
||||
};
|
||||
|
||||
class InstructionInvalidTSBEntry : public SparcFault<InstructionInvalidTSBEntry> {};
|
||||
class InstructionInvalidTSBEntry :
|
||||
public SparcFault<InstructionInvalidTSBEntry> {};
|
||||
|
||||
class DataInvalidTSBEntry : public SparcFault<DataInvalidTSBEntry> {};
|
||||
|
||||
|
@ -257,13 +260,15 @@ class SpillNNormal : public EnumeratedFault<SpillNNormal>
|
|||
class SpillNOther : public EnumeratedFault<SpillNOther>
|
||||
{
|
||||
public:
|
||||
SpillNOther(uint32_t n) : EnumeratedFault<SpillNOther>(n) {;}
|
||||
SpillNOther(uint32_t n) : EnumeratedFault<SpillNOther>(n)
|
||||
{}
|
||||
};
|
||||
|
||||
class FillNNormal : public EnumeratedFault<FillNNormal>
|
||||
{
|
||||
public:
|
||||
FillNNormal(uint32_t n) : EnumeratedFault<FillNNormal>(n) {;}
|
||||
FillNNormal(uint32_t n) : EnumeratedFault<FillNNormal>(n)
|
||||
{}
|
||||
// These need to be handled specially to enable fill traps in SE
|
||||
#if !FULL_SYSTEM
|
||||
void invoke(ThreadContext * tc,
|
||||
|
@ -274,13 +279,15 @@ class FillNNormal : public EnumeratedFault<FillNNormal>
|
|||
class FillNOther : public EnumeratedFault<FillNOther>
|
||||
{
|
||||
public:
|
||||
FillNOther(uint32_t n) : EnumeratedFault<FillNOther>(n) {;}
|
||||
FillNOther(uint32_t n) : EnumeratedFault<FillNOther>(n)
|
||||
{}
|
||||
};
|
||||
|
||||
class TrapInstruction : public EnumeratedFault<TrapInstruction>
|
||||
{
|
||||
public:
|
||||
TrapInstruction(uint32_t n) : EnumeratedFault<TrapInstruction>(n) {;}
|
||||
TrapInstruction(uint32_t n) : EnumeratedFault<TrapInstruction>(n)
|
||||
{}
|
||||
// In SE, trap instructions are requesting services from the OS.
|
||||
#if !FULL_SYSTEM
|
||||
void invoke(ThreadContext * tc,
|
||||
|
@ -288,7 +295,8 @@ class TrapInstruction : public EnumeratedFault<TrapInstruction>
|
|||
#endif
|
||||
};
|
||||
|
||||
static inline Fault genMachineCheckFault()
|
||||
static inline Fault
|
||||
genMachineCheckFault()
|
||||
{
|
||||
return new InternalProcessorError;
|
||||
}
|
||||
|
|
|
@ -181,9 +181,7 @@ class Interrupts : public SimObject
|
|||
|
||||
void
|
||||
updateIntrInfo(ThreadContext *tc)
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
uint64_t
|
||||
get_vec(int int_num)
|
||||
|
|
|
@ -119,7 +119,8 @@ output header {{
|
|||
|
||||
bool passesCondition(uint32_t codes, uint32_t condition);
|
||||
|
||||
inline int64_t sign_ext(uint64_t data, int origWidth)
|
||||
inline int64_t
|
||||
sign_ext(uint64_t data, int origWidth)
|
||||
{
|
||||
int shiftAmount = 64 - origWidth;
|
||||
return (((int64_t)data) << shiftAmount) >> shiftAmount;
|
||||
|
@ -255,8 +256,7 @@ output decoder {{
|
|||
if (num <= 0)
|
||||
return;
|
||||
printReg(os, indexArray[0]);
|
||||
for(int x = 1; x < num; x++)
|
||||
{
|
||||
for (int x = 1; x < num; x++) {
|
||||
os << ", ";
|
||||
printReg(os, indexArray[x]);
|
||||
}
|
||||
|
@ -435,7 +435,8 @@ output decoder {{
|
|||
}
|
||||
}
|
||||
|
||||
std::string SparcStaticInst::generateDisassembly(Addr pc,
|
||||
std::string
|
||||
SparcStaticInst::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
@ -446,19 +447,15 @@ output decoder {{
|
|||
// a third one, it's a read-modify-write dest (Rc),
|
||||
// e.g. for CMOVxx
|
||||
if (_numSrcRegs > 0)
|
||||
{
|
||||
printReg(ss, _srcRegIdx[0]);
|
||||
}
|
||||
if(_numSrcRegs > 1)
|
||||
{
|
||||
if (_numSrcRegs > 1) {
|
||||
ss << ",";
|
||||
printReg(ss, _srcRegIdx[1]);
|
||||
}
|
||||
|
||||
// just print the first dest... if there's a second one,
|
||||
// it's generally implicit
|
||||
if(_numDestRegs > 0)
|
||||
{
|
||||
if (_numDestRegs > 0) {
|
||||
if (_numSrcRegs > 0)
|
||||
ss << ",";
|
||||
printReg(ss, _destRegIdx[0]);
|
||||
|
@ -467,14 +464,14 @@ output decoder {{
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
bool passesFpCondition(uint32_t fcc, uint32_t condition)
|
||||
bool
|
||||
passesFpCondition(uint32_t fcc, uint32_t condition)
|
||||
{
|
||||
bool u = (fcc == 3);
|
||||
bool g = (fcc == 2);
|
||||
bool l = (fcc == 1);
|
||||
bool e = (fcc == 0);
|
||||
switch(condition)
|
||||
{
|
||||
switch (condition) {
|
||||
case FAlways:
|
||||
return 1;
|
||||
case FNever:
|
||||
|
@ -512,7 +509,8 @@ output decoder {{
|
|||
"condition code %d", condition);
|
||||
}
|
||||
|
||||
bool passesCondition(uint32_t codes, uint32_t condition)
|
||||
bool
|
||||
passesCondition(uint32_t codes, uint32_t condition)
|
||||
{
|
||||
CondCodes condCodes;
|
||||
condCodes.bits = 0;
|
||||
|
@ -521,8 +519,7 @@ output decoder {{
|
|||
condCodes.z = codes & 0x4 ? 1 : 0;
|
||||
condCodes.n = codes & 0x8 ? 1 : 0;
|
||||
|
||||
switch(condition)
|
||||
{
|
||||
switch (condition) {
|
||||
case Always:
|
||||
return true;
|
||||
case Never:
|
||||
|
@ -567,17 +564,20 @@ output exec {{
|
|||
/// @retval Full-system mode: NoFault if FP is enabled, FpDisabled
|
||||
/// if not. Non-full-system mode: always returns NoFault.
|
||||
#if FULL_SYSTEM
|
||||
inline Fault checkFpEnableFault(%(CPU_exec_context)s *xc)
|
||||
inline Fault
|
||||
checkFpEnableFault(%(CPU_exec_context)s *xc)
|
||||
{
|
||||
Fault fault = NoFault; // dummy... this ipr access should not fault
|
||||
if (xc->readMiscReg(MISCREG_PSTATE) & PSTATE::pef &&
|
||||
xc->readMiscReg(MISCREG_FPRS) & 0x4)
|
||||
xc->readMiscReg(MISCREG_FPRS) & 0x4) {
|
||||
return NoFault;
|
||||
else
|
||||
} else {
|
||||
return new FpDisabled;
|
||||
}
|
||||
}
|
||||
#else
|
||||
inline Fault checkFpEnableFault(%(CPU_exec_context)s *xc)
|
||||
inline Fault
|
||||
checkFpEnableFault(%(CPU_exec_context)s *xc)
|
||||
{
|
||||
return NoFault;
|
||||
}
|
||||
|
|
|
@ -184,29 +184,34 @@ decode OP default Unknown::unknown()
|
|||
}});
|
||||
0x0C: subc({{Rd.sdw = Rs1.sdw + (~Rs2_or_imm13) + 1 - Ccr<0:0>}});
|
||||
0x0D: udivx({{
|
||||
if(Rs2_or_imm13 == 0) fault = new DivisionByZero;
|
||||
else Rd.udw = Rs1.udw / Rs2_or_imm13;
|
||||
if (Rs2_or_imm13 == 0)
|
||||
fault = new DivisionByZero;
|
||||
else
|
||||
Rd.udw = Rs1.udw / Rs2_or_imm13;
|
||||
}});
|
||||
0x0E: udiv({{
|
||||
if(Rs2_or_imm13 == 0) fault = new DivisionByZero;
|
||||
else
|
||||
{
|
||||
if (Rs2_or_imm13 == 0) {
|
||||
fault = new DivisionByZero;
|
||||
} else {
|
||||
Rd.udw = ((Y << 32) | Rs1.udw<31:0>) / Rs2_or_imm13;
|
||||
if (Rd.udw >> 32 != 0)
|
||||
Rd.udw = 0xFFFFFFFF;
|
||||
}
|
||||
}});
|
||||
0x0F: sdiv({{
|
||||
if(Rs2_or_imm13.sdw == 0)
|
||||
if (Rs2_or_imm13.sdw == 0) {
|
||||
fault = new DivisionByZero;
|
||||
else
|
||||
{
|
||||
Rd.udw = ((int64_t)((Y << 32) | Rs1.sdw<31:0>)) / Rs2_or_imm13.sdw;
|
||||
if((int64_t)Rd.udw >= std::numeric_limits<int32_t>::max())
|
||||
} else {
|
||||
Rd.udw = ((int64_t)((Y << 32) |
|
||||
Rs1.sdw<31:0>)) / Rs2_or_imm13.sdw;
|
||||
if ((int64_t)Rd.udw >=
|
||||
std::numeric_limits<int32_t>::max()) {
|
||||
Rd.udw = 0x7FFFFFFF;
|
||||
else if((int64_t)Rd.udw <= std::numeric_limits<int32_t>::min())
|
||||
} else if ((int64_t)Rd.udw <=
|
||||
std::numeric_limits<int32_t>::min()) {
|
||||
Rd.udw = ULL(0xFFFFFFFF80000000);
|
||||
}
|
||||
}
|
||||
}});
|
||||
}
|
||||
format IntOpCc {
|
||||
|
@ -241,32 +246,38 @@ decode OP default Unknown::unknown()
|
|||
Rd = res = op1 - op2 - Ccr<0:>;
|
||||
}}, sub=True);
|
||||
0x1D: IntOpCcRes::udivxcc({{
|
||||
if(Rs2_or_imm13.udw == 0) fault = new DivisionByZero;
|
||||
else Rd = Rs1.udw / Rs2_or_imm13.udw;}});
|
||||
if (Rs2_or_imm13.udw == 0)
|
||||
fault = new DivisionByZero;
|
||||
else
|
||||
Rd = Rs1.udw / Rs2_or_imm13.udw;}});
|
||||
0x1E: IntOpCcRes::udivcc({{
|
||||
uint64_t resTemp;
|
||||
uint32_t val2 = Rs2_or_imm13.udw;
|
||||
int32_t overflow = 0;
|
||||
if(val2 == 0) fault = new DivisionByZero;
|
||||
else
|
||||
{
|
||||
if (val2 == 0) {
|
||||
fault = new DivisionByZero;
|
||||
} else {
|
||||
resTemp = (uint64_t)((Y << 32) | Rs1.udw<31:0>) / val2;
|
||||
overflow = (resTemp<63:32> != 0);
|
||||
if(overflow) Rd = resTemp = 0xFFFFFFFF;
|
||||
else Rd = resTemp;
|
||||
if (overflow)
|
||||
Rd = resTemp = 0xFFFFFFFF;
|
||||
else
|
||||
Rd = resTemp;
|
||||
}
|
||||
}}, iv={{overflow}});
|
||||
0x1F: IntOpCcRes::sdivcc({{
|
||||
int64_t val2 = Rs2_or_imm13.sdw<31:0>;
|
||||
bool overflow = false, underflow = false;
|
||||
if(val2 == 0) fault = new DivisionByZero;
|
||||
else
|
||||
{
|
||||
if (val2 == 0) {
|
||||
fault = new DivisionByZero;
|
||||
} else {
|
||||
Rd = (int64_t)((Y << 32) | Rs1.sdw<31:0>) / val2;
|
||||
overflow = ((int64_t)Rd >= std::numeric_limits<int32_t>::max());
|
||||
underflow = ((int64_t)Rd <= std::numeric_limits<int32_t>::min());
|
||||
if(overflow) Rd = 0x7FFFFFFF;
|
||||
else if(underflow) Rd = ULL(0xFFFFFFFF80000000);
|
||||
if (overflow)
|
||||
Rd = 0x7FFFFFFF;
|
||||
else if (underflow)
|
||||
Rd = ULL(0xFFFFFFFF80000000);
|
||||
}
|
||||
}}, iv={{overflow || underflow}});
|
||||
0x20: taddcc({{
|
||||
|
@ -288,14 +299,16 @@ decode OP default Unknown::unknown()
|
|||
Rd = res = op1 + op2;
|
||||
bool overflow = (op1 & mask(2)) || (op2 & mask(2)) ||
|
||||
findOverflow(32, res, op1, op2);
|
||||
if(overflow) fault = new TagOverflow;
|
||||
if (overflow)
|
||||
fault = new TagOverflow;
|
||||
}}, iv={{overflow}});
|
||||
0x23: tsubcctv({{
|
||||
int64_t res, op1 = Rs1, op2 = Rs2_or_imm13;
|
||||
Rd = res = op1 - op2;
|
||||
bool overflow = (op1 & mask(2)) || (op2 & mask(2)) ||
|
||||
findOverflow(32, res, op1, ~op2);
|
||||
if(overflow) fault = new TagOverflow;
|
||||
if (overflow)
|
||||
fault = new TagOverflow;
|
||||
}}, iv={{overflow}}, sub=True);
|
||||
0x24: mulscc({{
|
||||
int32_t savedLSB = Rs1<0:>;
|
||||
|
@ -405,8 +418,7 @@ decode OP default Unknown::unknown()
|
|||
// 0x11-0x1F should cause an illegal instruction exception
|
||||
}
|
||||
0x2B: BasicOperate::flushw({{
|
||||
if(NWindows - 2 - Cansave != 0)
|
||||
{
|
||||
if (NWindows - 2 - Cansave != 0) {
|
||||
if (Otherwin)
|
||||
fault = new SpillNOther(4*Wstate<5:3>);
|
||||
else
|
||||
|
@ -459,8 +471,10 @@ decode OP default Unknown::unknown()
|
|||
}
|
||||
}
|
||||
0x2D: sdivx({{
|
||||
if(Rs2_or_imm13.sdw == 0) fault = new DivisionByZero;
|
||||
else Rd.sdw = Rs1.sdw / Rs2_or_imm13.sdw;
|
||||
if (Rs2_or_imm13.sdw == 0)
|
||||
fault = new DivisionByZero;
|
||||
else
|
||||
Rd.sdw = Rs1.sdw / Rs2_or_imm13.sdw;
|
||||
}});
|
||||
0x2E: Trap::popc({{fault = new IllegalInstruction;}});
|
||||
0x2F: decode RCOND3
|
||||
|
@ -907,10 +921,9 @@ decode OP default Unknown::unknown()
|
|||
// because they're the most likely to be used, and
|
||||
// second because otherwise, we end up shifting by
|
||||
// greater than the width of the type being shifted,
|
||||
//namely 64, which produces undefined results according
|
||||
//to the C standard.
|
||||
switch(Gsr<2:0>)
|
||||
{
|
||||
// namely 64, which produces undefined results
|
||||
// according to the C standard.
|
||||
switch (Gsr<2:0>) {
|
||||
case 0:
|
||||
Frd.udw = msbX;
|
||||
break;
|
||||
|
@ -1002,10 +1015,9 @@ decode OP default Unknown::unknown()
|
|||
}
|
||||
0x38: Branch::jmpl({{
|
||||
Addr target = Rs1 + Rs2_or_imm13;
|
||||
if(target & 0x3)
|
||||
if (target & 0x3) {
|
||||
fault = new MemAddressNotAligned;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
SparcISA::PCState pc = PCS;
|
||||
if (Pstate<3:>)
|
||||
Rd = (pc.pc())<31:0>;
|
||||
|
@ -1017,22 +1029,17 @@ decode OP default Unknown::unknown()
|
|||
}});
|
||||
0x39: Branch::return({{
|
||||
Addr target = Rs1 + Rs2_or_imm13;
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
// Check for fills which are higher priority than alignment
|
||||
// faults.
|
||||
if(Canrestore == 0)
|
||||
{
|
||||
if (Canrestore == 0) {
|
||||
if (Otherwin)
|
||||
fault = new FillNOther(4*Wstate<5:3>);
|
||||
else
|
||||
fault = new FillNNormal(4*Wstate<2:0>);
|
||||
}
|
||||
//Check for alignment faults
|
||||
else if(target & 0x3)
|
||||
} else if (target & 0x3) { // Check for alignment faults
|
||||
fault = new MemAddressNotAligned;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
SparcISA::PCState pc = PCS;
|
||||
pc.nnpc(target);
|
||||
PCS = pc;
|
||||
|
@ -1045,16 +1052,14 @@ decode OP default Unknown::unknown()
|
|||
0x3A: decode CC
|
||||
{
|
||||
0x0: Trap::tcci({{
|
||||
if(passesCondition(Ccr<3:0>, COND2))
|
||||
{
|
||||
if (passesCondition(Ccr<3:0>, COND2)) {
|
||||
int lTrapNum = I ? (Rs1 + SW_TRAP) : (Rs1 + Rs2);
|
||||
DPRINTF(Sparc, "The trap number is %d\n", lTrapNum);
|
||||
fault = new TrapInstruction(lTrapNum);
|
||||
}
|
||||
}}, IsSerializeAfter, IsNonSpeculative, IsSyscall);
|
||||
0x2: Trap::tccx({{
|
||||
if(passesCondition(Ccr<7:4>, COND2))
|
||||
{
|
||||
if (passesCondition(Ccr<7:4>, COND2)) {
|
||||
int lTrapNum = I ? (Rs1 + SW_TRAP) : (Rs1 + Rs2);
|
||||
DPRINTF(Sparc, "The trap number is %d\n", lTrapNum);
|
||||
fault = new TrapInstruction(lTrapNum);
|
||||
|
@ -1064,19 +1069,14 @@ decode OP default Unknown::unknown()
|
|||
0x3B: Nop::flush({{/*Instruction memory flush*/}}, IsWriteBarrier,
|
||||
MemWriteOp);
|
||||
0x3C: save({{
|
||||
if(Cansave == 0)
|
||||
{
|
||||
if (Cansave == 0) {
|
||||
if (Otherwin)
|
||||
fault = new SpillNOther(4*Wstate<5:3>);
|
||||
else
|
||||
fault = new SpillNNormal(4*Wstate<2:0>);
|
||||
}
|
||||
else if(Cleanwin - Canrestore == 0)
|
||||
{
|
||||
} else if (Cleanwin - Canrestore == 0) {
|
||||
fault = new CleanWindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Cwp = (Cwp + 1) % NWindows;
|
||||
Rd_next = Rs1 + Rs2_or_imm13;
|
||||
Cansave = Cansave - 1;
|
||||
|
@ -1084,15 +1084,12 @@ decode OP default Unknown::unknown()
|
|||
}
|
||||
}});
|
||||
0x3D: restore({{
|
||||
if(Canrestore == 0)
|
||||
{
|
||||
if (Canrestore == 0) {
|
||||
if (Otherwin)
|
||||
fault = new FillNOther(4*Wstate<5:3>);
|
||||
else
|
||||
fault = new FillNNormal(4*Wstate<2:0>);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Cwp = (Cwp - 1 + NWindows) % NWindows;
|
||||
Rd_prev = Rs1 + Rs2_or_imm13;
|
||||
Cansave = Cansave + 1;
|
||||
|
|
|
@ -35,7 +35,8 @@ def template BasicExecDeclare {{
|
|||
|
||||
// Definitions of execute methods that panic.
|
||||
def template BasicExecPanic {{
|
||||
Fault execute(%(CPU_exec_context)s *, Trace::InstRecord *) const
|
||||
Fault
|
||||
execute(%(CPU_exec_context)s *, Trace::InstRecord *) const
|
||||
{
|
||||
panic("Execute method called when it shouldn't!");
|
||||
M5_DUMMY_RETURN
|
||||
|
@ -91,7 +92,8 @@ def template BasicConstructorWithMnemonic {{
|
|||
|
||||
// Basic instruction class execute method template.
|
||||
def template BasicExecute {{
|
||||
Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
|
||||
Fault
|
||||
%(class_name)s::execute(%(CPU_exec_context)s *xc,
|
||||
Trace::InstRecord *traceData) const
|
||||
{
|
||||
Fault fault = NoFault;
|
||||
|
@ -101,8 +103,7 @@ def template BasicExecute {{
|
|||
%(op_rd)s;
|
||||
%(code)s;
|
||||
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(op_wb)s;
|
||||
}
|
||||
return fault;
|
||||
|
|
|
@ -127,8 +127,8 @@ output decoder {{
|
|||
|
||||
template class BranchNBits<30>;
|
||||
|
||||
std::string Branch::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
std::string
|
||||
Branch::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
||||
|
@ -141,7 +141,8 @@ output decoder {{
|
|||
return response.str();
|
||||
}
|
||||
|
||||
std::string BranchImm13::generateDisassembly(Addr pc,
|
||||
std::string
|
||||
BranchImm13::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
@ -158,7 +159,8 @@ output decoder {{
|
|||
return response.str();
|
||||
}
|
||||
|
||||
std::string BranchDisp::generateDisassembly(Addr pc,
|
||||
std::string
|
||||
BranchDisp::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
@ -170,8 +172,8 @@ output decoder {{
|
|||
printMnemonic(response, mnemonic);
|
||||
ccprintf(response, "0x%x", target);
|
||||
|
||||
if(symtab && symtab->findNearestSymbol(target, symbol, symbolAddr))
|
||||
{
|
||||
if (symtab &&
|
||||
symtab->findNearestSymbol(target, symbol, symbolAddr)) {
|
||||
ccprintf(response, " <%s", symbol);
|
||||
if (symbolAddr != target)
|
||||
ccprintf(response, "+%d>", target - symbolAddr);
|
||||
|
@ -196,8 +198,7 @@ def template JumpExecute {{
|
|||
PCS = PCS;
|
||||
%(code)s;
|
||||
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
// Write the resulting state to the execution context
|
||||
%(op_wb)s;
|
||||
}
|
||||
|
@ -207,7 +208,8 @@ def template JumpExecute {{
|
|||
}};
|
||||
|
||||
def template BranchExecute {{
|
||||
Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
|
||||
Fault
|
||||
%(class_name)s::execute(%(CPU_exec_context)s *xc,
|
||||
Trace::InstRecord *traceData) const
|
||||
{
|
||||
// Attempt to execute the instruction
|
||||
|
@ -222,8 +224,7 @@ def template BranchExecute {{
|
|||
%(fail)s;
|
||||
}
|
||||
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
// Write the resulting state to the execution context
|
||||
%(op_wb)s;
|
||||
}
|
||||
|
|
|
@ -151,11 +151,11 @@ def template SetHiDecode {{
|
|||
|
||||
output decoder {{
|
||||
|
||||
bool IntOp::printPseudoOps(std::ostream &os, Addr pc,
|
||||
bool
|
||||
IntOp::printPseudoOps(std::ostream &os, Addr pc,
|
||||
const SymbolTable *symbab) const
|
||||
{
|
||||
if(!std::strcmp(mnemonic, "or") && _srcRegIdx[0] == 0)
|
||||
{
|
||||
if (!std::strcmp(mnemonic, "or") && _srcRegIdx[0] == 0) {
|
||||
printMnemonic(os, "mov");
|
||||
printSrcReg(os, 1);
|
||||
ccprintf(os, ", ");
|
||||
|
@ -165,25 +165,21 @@ output decoder {{
|
|||
return false;
|
||||
}
|
||||
|
||||
bool IntOpImm::printPseudoOps(std::ostream &os, Addr pc,
|
||||
bool
|
||||
IntOpImm::printPseudoOps(std::ostream &os, Addr pc,
|
||||
const SymbolTable *symbab) const
|
||||
{
|
||||
if(!std::strcmp(mnemonic, "or"))
|
||||
{
|
||||
if(_numSrcRegs > 0 && _srcRegIdx[0] == 0)
|
||||
{
|
||||
if(imm == 0)
|
||||
if (!std::strcmp(mnemonic, "or")) {
|
||||
if (_numSrcRegs > 0 && _srcRegIdx[0] == 0) {
|
||||
if (imm == 0) {
|
||||
printMnemonic(os, "clr");
|
||||
else
|
||||
{
|
||||
} else {
|
||||
printMnemonic(os, "mov");
|
||||
ccprintf(os, " 0x%x, ", imm);
|
||||
}
|
||||
printDestReg(os, 0);
|
||||
return true;
|
||||
}
|
||||
else if(imm == 0)
|
||||
{
|
||||
} else if (imm == 0) {
|
||||
printMnemonic(os, "mov");
|
||||
printSrcReg(os, 0);
|
||||
ccprintf(os, ", ");
|
||||
|
@ -194,8 +190,8 @@ output decoder {{
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string IntOp::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
std::string
|
||||
IntOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
||||
|
@ -209,7 +205,8 @@ output decoder {{
|
|||
return response.str();
|
||||
}
|
||||
|
||||
std::string IntOpImm::generateDisassembly(Addr pc,
|
||||
std::string
|
||||
IntOpImm::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
@ -227,8 +224,8 @@ output decoder {{
|
|||
return response.str();
|
||||
}
|
||||
|
||||
std::string SetHi::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
std::string
|
||||
SetHi::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
||||
|
@ -250,8 +247,7 @@ def template IntOpExecute {{
|
|||
%(code)s;
|
||||
|
||||
// Write the resulting state to the execution context
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(cc_code)s;
|
||||
%(op_wb)s;
|
||||
}
|
||||
|
|
|
@ -100,8 +100,7 @@ output decoder {{
|
|||
bool save = flags[IsStore];
|
||||
|
||||
printMnemonic(response, mnemonic);
|
||||
if(save)
|
||||
{
|
||||
if (save) {
|
||||
printReg(response, _srcRegIdx[0]);
|
||||
ccprintf(response, ", ");
|
||||
}
|
||||
|
@ -110,8 +109,7 @@ output decoder {{
|
|||
ccprintf(response, " + ");
|
||||
printReg(response, _srcRegIdx[!save ? 1 : 2]);
|
||||
ccprintf(response, " ]");
|
||||
if(load)
|
||||
{
|
||||
if (load) {
|
||||
ccprintf(response, ", ");
|
||||
printReg(response, _destRegIdx[0]);
|
||||
}
|
||||
|
@ -127,8 +125,7 @@ output decoder {{
|
|||
bool save = flags[IsStore];
|
||||
|
||||
printMnemonic(response, mnemonic);
|
||||
if(save)
|
||||
{
|
||||
if (save) {
|
||||
printReg(response, _srcRegIdx[1]);
|
||||
ccprintf(response, ", ");
|
||||
}
|
||||
|
@ -138,8 +135,7 @@ output decoder {{
|
|||
ccprintf(response, " + 0x%x ]", imm);
|
||||
else
|
||||
ccprintf(response, " + -0x%x ]", -imm);
|
||||
if(load)
|
||||
{
|
||||
if (load) {
|
||||
ccprintf(response, ", ");
|
||||
printReg(response, _destRegIdx[0]);
|
||||
}
|
||||
|
|
|
@ -45,23 +45,19 @@ def template SwapExecute {{
|
|||
%(ea_code)s;
|
||||
DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
|
||||
%(fault_check)s;
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(code)s;
|
||||
}
|
||||
if(storeCond && fault == NoFault)
|
||||
{
|
||||
if (storeCond && fault == NoFault) {
|
||||
%(EA_trunc)s
|
||||
fault = xc->write((uint%(mem_acc_size)s_t)Mem,
|
||||
EA, %(asi_val)s, &mem_data);
|
||||
}
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
// Handle the swapping
|
||||
%(postacc_code)s;
|
||||
}
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
// Write the resulting state to the execution context
|
||||
%(op_wb)s;
|
||||
}
|
||||
|
@ -86,12 +82,10 @@ def template SwapInitiateAcc {{
|
|||
DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
|
||||
%(fault_check)s;
|
||||
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(code)s;
|
||||
}
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(EA_trunc)s
|
||||
fault = xc->write((uint%(mem_acc_size)s_t)Mem,
|
||||
EA, %(asi_val)s, &mem_data);
|
||||
|
@ -111,13 +105,11 @@ def template SwapCompleteAcc {{
|
|||
|
||||
uint64_t mem_data = pkt->get<uint%(mem_acc_size)s_t>();
|
||||
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
// Handle the swapping
|
||||
%(postacc_code)s;
|
||||
}
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
// Write the resulting state to the execution context
|
||||
%(op_wb)s;
|
||||
}
|
||||
|
|
|
@ -79,21 +79,18 @@ output decoder {{
|
|||
bool store = flags[IsStore];
|
||||
|
||||
printMnemonic(response, mnemonic);
|
||||
if(store)
|
||||
{
|
||||
if (store) {
|
||||
printReg(response, _srcRegIdx[0]);
|
||||
ccprintf(response, ", ");
|
||||
}
|
||||
ccprintf(response, "[");
|
||||
if(_srcRegIdx[!store ? 0 : 1] != 0)
|
||||
{
|
||||
if (_srcRegIdx[!store ? 0 : 1] != 0) {
|
||||
printSrcReg(response, !store ? 0 : 1);
|
||||
ccprintf(response, " + ");
|
||||
}
|
||||
printSrcReg(response, !store ? 1 : 2);
|
||||
ccprintf(response, "]");
|
||||
if(load)
|
||||
{
|
||||
if (load) {
|
||||
ccprintf(response, ", ");
|
||||
printReg(response, _destRegIdx[0]);
|
||||
}
|
||||
|
@ -109,14 +106,12 @@ output decoder {{
|
|||
bool save = flags[IsStore];
|
||||
|
||||
printMnemonic(response, mnemonic);
|
||||
if(save)
|
||||
{
|
||||
if (save) {
|
||||
printReg(response, _srcRegIdx[0]);
|
||||
ccprintf(response, ", ");
|
||||
}
|
||||
ccprintf(response, "[");
|
||||
if(_srcRegIdx[!save ? 0 : 1] != 0)
|
||||
{
|
||||
if (_srcRegIdx[!save ? 0 : 1] != 0) {
|
||||
printReg(response, _srcRegIdx[!save ? 0 : 1]);
|
||||
ccprintf(response, " + ");
|
||||
}
|
||||
|
@ -124,8 +119,7 @@ output decoder {{
|
|||
ccprintf(response, "0x%x]", imm);
|
||||
else
|
||||
ccprintf(response, "-0x%x]", -imm);
|
||||
if(load)
|
||||
{
|
||||
if (load) {
|
||||
ccprintf(response, ", ");
|
||||
printReg(response, _destRegIdx[0]);
|
||||
}
|
||||
|
@ -147,17 +141,14 @@ def template LoadExecute {{
|
|||
%(ea_code)s;
|
||||
DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
|
||||
%(fault_check)s;
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(EA_trunc)s
|
||||
fault = xc->read(EA, (%(mem_acc_type)s%(mem_acc_size)s_t&)Mem, %(asi_val)s);
|
||||
}
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(code)s;
|
||||
}
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
// Write the resulting state to the execution context
|
||||
%(op_wb)s;
|
||||
}
|
||||
|
@ -178,8 +169,7 @@ def template LoadInitiateAcc {{
|
|||
%(ea_code)s;
|
||||
DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
|
||||
%(fault_check)s;
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(EA_trunc)s
|
||||
fault = xc->read(EA, (%(mem_acc_type)s%(mem_acc_size)s_t&)Mem, %(asi_val)s);
|
||||
}
|
||||
|
@ -196,8 +186,7 @@ def template LoadCompleteAcc {{
|
|||
%(op_rd)s;
|
||||
Mem = pkt->get<typeof(Mem)>();
|
||||
%(code)s;
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(op_wb)s;
|
||||
}
|
||||
return fault;
|
||||
|
@ -220,18 +209,15 @@ def template StoreExecute {{
|
|||
%(ea_code)s;
|
||||
DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
|
||||
%(fault_check)s;
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(code)s;
|
||||
}
|
||||
if(storeCond && fault == NoFault)
|
||||
{
|
||||
if (storeCond && fault == NoFault) {
|
||||
%(EA_trunc)s
|
||||
fault = xc->write((%(mem_acc_type)s%(mem_acc_size)s_t)Mem,
|
||||
EA, %(asi_val)s, 0);
|
||||
}
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
// Write the resulting state to the execution context
|
||||
%(op_wb)s;
|
||||
}
|
||||
|
@ -254,12 +240,10 @@ def template StoreInitiateAcc {{
|
|||
%(ea_code)s;
|
||||
DPRINTF(Sparc, "%s: The address is 0x%x\n", mnemonic, EA);
|
||||
%(fault_check)s;
|
||||
if(fault == NoFault)
|
||||
{
|
||||
if (fault == NoFault) {
|
||||
%(code)s;
|
||||
}
|
||||
if(storeCond && fault == NoFault)
|
||||
{
|
||||
if (storeCond && fault == NoFault) {
|
||||
%(EA_trunc)s
|
||||
fault = xc->write((%(mem_acc_type)s%(mem_acc_size)s_t)Mem,
|
||||
EA, %(asi_val)s, 0);
|
||||
|
@ -310,10 +294,10 @@ let {{
|
|||
# those that are only available in hpriv
|
||||
AlternateASIPrivFaultCheck = '''
|
||||
if ((!bits(Pstate,2,2) && !bits(Hpstate,2,2) &&
|
||||
!AsiIsUnPriv((ASI)EXT_ASI)) ||
|
||||
(!bits(Hpstate,2,2) && AsiIsHPriv((ASI)EXT_ASI)))
|
||||
!asiIsUnPriv((ASI)EXT_ASI)) ||
|
||||
(!bits(Hpstate,2,2) && asiIsHPriv((ASI)EXT_ASI)))
|
||||
fault = new PrivilegedAction;
|
||||
else if (AsiIsAsIfUser((ASI)EXT_ASI) && !bits(Pstate,2,2))
|
||||
else if (asiIsAsIfUser((ASI)EXT_ASI) && !bits(Pstate,2,2))
|
||||
fault = new PrivilegedAction;
|
||||
'''
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
|
||||
// This delcares the initiateAcc function in memory operations
|
||||
def template MacroInitiateAcc {{
|
||||
Fault initiateAcc(%(CPU_exec_context)s *, Trace::InstRecord *) const
|
||||
Fault
|
||||
initiateAcc(%(CPU_exec_context)s *, Trace::InstRecord *) const
|
||||
{
|
||||
panic("Tried to execute a macroop directly!\n");
|
||||
return NoFault;
|
||||
|
@ -36,8 +37,8 @@ def template MacroInitiateAcc {{
|
|||
}};
|
||||
|
||||
def template MacroCompleteAcc {{
|
||||
Fault completeAcc(PacketPtr, %(CPU_exec_context)s *,
|
||||
Trace::InstRecord *) const
|
||||
Fault
|
||||
completeAcc(PacketPtr, %(CPU_exec_context)s *, Trace::InstRecord *) const
|
||||
{
|
||||
panic("Tried to execute a macroop directly!\n");
|
||||
return NoFault;
|
||||
|
@ -46,7 +47,8 @@ def template MacroCompleteAcc {{
|
|||
|
||||
// This template provides the execute functions for a store
|
||||
def template MacroExecute {{
|
||||
Fault execute(%(CPU_exec_context)s *, Trace::InstRecord *) const
|
||||
Fault
|
||||
execute(%(CPU_exec_context)s *, Trace::InstRecord *) const
|
||||
{
|
||||
panic("Tried to execute a macroop directly!\n");
|
||||
return NoFault;
|
||||
|
@ -129,7 +131,8 @@ output header {{
|
|||
|
||||
output decoder {{
|
||||
|
||||
std::string SparcMacroInst::generateDisassembly(Addr pc,
|
||||
std::string
|
||||
SparcMacroInst::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
|
|
@ -122,8 +122,8 @@ output header {{
|
|||
}};
|
||||
|
||||
output decoder {{
|
||||
std::string Priv::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
std::string
|
||||
Priv::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
||||
|
@ -132,8 +132,8 @@ output decoder {{
|
|||
return response.str();
|
||||
}
|
||||
|
||||
std::string RdPriv::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
std::string
|
||||
RdPriv::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
||||
|
@ -145,8 +145,8 @@ output decoder {{
|
|||
return response.str();
|
||||
}
|
||||
|
||||
std::string WrPriv::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
std::string
|
||||
WrPriv::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
||||
|
@ -155,8 +155,7 @@ output decoder {{
|
|||
ccprintf(response, " ");
|
||||
// If the first reg is %g0, don't print it.
|
||||
// This improves readability
|
||||
if(_srcRegIdx[0] != 0)
|
||||
{
|
||||
if (_srcRegIdx[0] != 0) {
|
||||
printSrcReg(response, 0);
|
||||
ccprintf(response, ", ");
|
||||
}
|
||||
|
@ -176,8 +175,7 @@ output decoder {{
|
|||
ccprintf(response, " ");
|
||||
// If the first reg is %g0, don't print it.
|
||||
// This improves readability
|
||||
if(_srcRegIdx[0] != 0)
|
||||
{
|
||||
if (_srcRegIdx[0] != 0) {
|
||||
printSrcReg(response, 0);
|
||||
ccprintf(response, ", ");
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ output header {{
|
|||
}};
|
||||
|
||||
output decoder {{
|
||||
std::string Trap::generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
std::string
|
||||
Trap::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
std::stringstream response;
|
||||
|
||||
|
@ -71,7 +71,8 @@ output decoder {{
|
|||
}};
|
||||
|
||||
def template TrapExecute {{
|
||||
Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
|
||||
Fault
|
||||
%(class_name)s::execute(%(CPU_exec_context)s *xc,
|
||||
Trace::InstRecord *traceData) const
|
||||
{
|
||||
Fault fault = NoFault;
|
||||
|
@ -83,7 +84,8 @@ def template TrapExecute {{
|
|||
}};
|
||||
|
||||
def template FpUnimplExecute {{
|
||||
Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
|
||||
Fault
|
||||
%(class_name)s::execute(%(CPU_exec_context)s *xc,
|
||||
Trace::InstRecord *traceData) const
|
||||
{
|
||||
Fault fault = NoFault;
|
||||
|
@ -113,8 +115,8 @@ output header {{
|
|||
{
|
||||
}
|
||||
|
||||
std::string generateDisassembly(Addr pc,
|
||||
const SymbolTable *symtab) const
|
||||
std::string
|
||||
generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
return mnemonic;
|
||||
}
|
||||
|
|
|
@ -48,17 +48,20 @@ output header {{
|
|||
// A function to "decompress" double and quad floating point
|
||||
// register numbers stuffed into 5 bit fields. These have their
|
||||
// MSB put in the LSB position but are otherwise normal.
|
||||
static inline unsigned int dfpr(unsigned int regNum)
|
||||
static inline unsigned int
|
||||
dfpr(unsigned int regNum)
|
||||
{
|
||||
return (regNum & (~1)) | ((regNum & 1) << 5);
|
||||
}
|
||||
|
||||
static inline unsigned int dfprl(unsigned int regNum)
|
||||
static inline unsigned int
|
||||
dfprl(unsigned int regNum)
|
||||
{
|
||||
return dfpr(regNum) & (~0x1);
|
||||
}
|
||||
|
||||
static inline unsigned int dfprh(unsigned int regNum)
|
||||
static inline unsigned int
|
||||
dfprh(unsigned int regNum)
|
||||
{
|
||||
return dfpr(regNum) | 0x1;
|
||||
}
|
||||
|
|
|
@ -67,8 +67,7 @@ Sparc32LinuxProcess::Sparc32LinuxProcess(LiveProcessParams * params,
|
|||
|
||||
void Sparc32LinuxProcess::handleTrap(int trapNum, ThreadContext *tc)
|
||||
{
|
||||
switch(trapNum)
|
||||
{
|
||||
switch (trapNum) {
|
||||
case 0x10: //Linux 32 bit syscall trap
|
||||
tc->syscall(tc->readIntReg(1));
|
||||
break;
|
||||
|
@ -84,8 +83,7 @@ Sparc64LinuxProcess::Sparc64LinuxProcess(LiveProcessParams * params,
|
|||
|
||||
void Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc)
|
||||
{
|
||||
switch(trapNum)
|
||||
{
|
||||
switch (trapNum) {
|
||||
// case 0x10: // Linux 32 bit syscall trap
|
||||
case 0x6d: // Linux 64 bit syscall trap
|
||||
tc->syscall(tc->readIntReg(1));
|
||||
|
|
|
@ -64,7 +64,8 @@ class Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32LiveProcess
|
|||
/// Constructor.
|
||||
Sparc32LinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
SyscallDesc* getDesc(int callnum)
|
||||
SyscallDesc*
|
||||
getDesc(int callnum)
|
||||
{
|
||||
return SparcLinuxProcess::getDesc32(callnum);
|
||||
}
|
||||
|
@ -79,7 +80,8 @@ class Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64LiveProcess
|
|||
/// Constructor.
|
||||
Sparc64LinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
SyscallDesc* getDesc(int callnum)
|
||||
SyscallDesc*
|
||||
getDesc(int callnum)
|
||||
{
|
||||
return SparcLinuxProcess::getDesc(callnum);
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
}
|
||||
|
||||
|
||||
SyscallReturn getresuidFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc)
|
||||
SyscallReturn
|
||||
getresuidFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
{
|
||||
const IntReg id = htog(100);
|
||||
int index = 0;
|
||||
|
@ -66,22 +66,19 @@ SyscallReturn getresuidFunc(SyscallDesc *desc, int num,
|
|||
Addr suid = p->getSyscallArg(tc, index);
|
||||
// Handle the EFAULT case
|
||||
// Set the ruid
|
||||
if(ruid)
|
||||
{
|
||||
if (ruid) {
|
||||
BufferArg ruidBuff(ruid, sizeof(IntReg));
|
||||
memcpy(ruidBuff.bufferPtr(), &id, sizeof(IntReg));
|
||||
ruidBuff.copyOut(tc->getMemPort());
|
||||
}
|
||||
// Set the euid
|
||||
if(euid)
|
||||
{
|
||||
if (euid) {
|
||||
BufferArg euidBuff(euid, sizeof(IntReg));
|
||||
memcpy(euidBuff.bufferPtr(), &id, sizeof(IntReg));
|
||||
euidBuff.copyOut(tc->getMemPort());
|
||||
}
|
||||
// Set the suid
|
||||
if(suid)
|
||||
{
|
||||
if (suid) {
|
||||
BufferArg suidBuff(suid, sizeof(IntReg));
|
||||
memcpy(suidBuff.bufferPtr(), &id, sizeof(IntReg));
|
||||
suidBuff.copyOut(tc->getMemPort());
|
||||
|
|
|
@ -115,7 +115,8 @@ namespace SparcISA
|
|||
MISCREG_NUMMISCREGS
|
||||
};
|
||||
|
||||
struct HPSTATE {
|
||||
struct HPSTATE
|
||||
{
|
||||
const static uint64_t id = 0x800; // this impl. dependent (id) field m
|
||||
const static uint64_t ibe = 0x400;
|
||||
const static uint64_t red = 0x20;
|
||||
|
@ -124,7 +125,8 @@ namespace SparcISA
|
|||
};
|
||||
|
||||
|
||||
struct PSTATE {
|
||||
struct PSTATE
|
||||
{
|
||||
const static int cle = 0x200;
|
||||
const static int tle = 0x100;
|
||||
const static int mm = 0xC0;
|
||||
|
@ -134,7 +136,8 @@ namespace SparcISA
|
|||
const static int ie = 0x2;
|
||||
};
|
||||
|
||||
struct STS {
|
||||
struct STS
|
||||
{
|
||||
const static int st_idle = 0x00;
|
||||
const static int st_wait = 0x01;
|
||||
const static int st_halt = 0x02;
|
||||
|
@ -154,6 +157,7 @@ namespace SparcISA
|
|||
|
||||
const int NumMiscArchRegs = MISCREG_NUMMISCREGS;
|
||||
const int NumMiscRegs = MISCREG_NUMMISCREGS;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
namespace SparcISA
|
||||
{
|
||||
|
||||
inline Tick
|
||||
handleIprRead(ThreadContext *xc, Packet *pkt)
|
||||
{
|
||||
|
@ -55,7 +56,6 @@ handleIprRead(ThreadContext *xc, Packet *pkt)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline Tick
|
||||
handleIprWrite(ThreadContext *xc, Packet *pkt)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
namespace SparcISA
|
||||
{
|
||||
|
||||
void
|
||||
TlbEntry::serialize(std::ostream &os)
|
||||
{
|
||||
|
@ -67,8 +68,8 @@ TlbEntry::unserialize(Checkpoint *cp, const std::string §ion)
|
|||
}
|
||||
|
||||
|
||||
int PageTableEntry::pageSizes[] = {8*1024, 64*1024, 0, 4*1024*1024, 0,
|
||||
256*1024*1024L};
|
||||
int PageTableEntry::pageSizes[] =
|
||||
{ 8 * 1024, 64 * 1024, 0, 4 * 1024 * 1024, 0, 256 * 1024 * 1024L} ;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -86,8 +86,7 @@ class PageTableEntry
|
|||
bool populated;
|
||||
|
||||
public:
|
||||
PageTableEntry()
|
||||
: entry(0), type(invalid), populated(false)
|
||||
PageTableEntry() : entry(0), type(invalid), populated(false)
|
||||
{}
|
||||
|
||||
PageTableEntry(uint64_t e, EntryType t = sun4u)
|
||||
|
@ -96,7 +95,8 @@ class PageTableEntry
|
|||
populate(entry, type);
|
||||
}
|
||||
|
||||
void populate(uint64_t e, EntryType t = sun4u)
|
||||
void
|
||||
populate(uint64_t e, EntryType t = sun4u)
|
||||
{
|
||||
entry = e;
|
||||
type = t;
|
||||
|
@ -131,6 +131,7 @@ class PageTableEntry
|
|||
static int pageSizes[6];
|
||||
|
||||
uint64_t operator()() const { assert(populated); return entry4u; }
|
||||
|
||||
const PageTableEntry &
|
||||
operator=(uint64_t e)
|
||||
{
|
||||
|
@ -261,7 +262,8 @@ struct TlbEntry
|
|||
bool used;
|
||||
bool valid;
|
||||
|
||||
Addr pageStart()
|
||||
Addr
|
||||
pageStart()
|
||||
{
|
||||
return pte.paddr();
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ class ThreadContext;
|
|||
|
||||
namespace SparcISA
|
||||
{
|
||||
|
||||
class Predecoder
|
||||
{
|
||||
protected:
|
||||
|
@ -53,53 +54,56 @@ namespace SparcISA
|
|||
Predecoder(ThreadContext * _tc) : tc(_tc)
|
||||
{}
|
||||
|
||||
ThreadContext * getTC()
|
||||
ThreadContext *
|
||||
getTC()
|
||||
{
|
||||
return tc;
|
||||
}
|
||||
|
||||
void setTC(ThreadContext * _tc)
|
||||
void
|
||||
setTC(ThreadContext * _tc)
|
||||
{
|
||||
tc = _tc;
|
||||
}
|
||||
|
||||
void process()
|
||||
{
|
||||
}
|
||||
|
||||
void reset()
|
||||
{}
|
||||
void process() {}
|
||||
void reset() {}
|
||||
|
||||
// Use this to give data to the predecoder. This should be used
|
||||
// when there is control flow.
|
||||
void moreBytes(const PCState &pc, Addr fetchPC, MachInst inst)
|
||||
void
|
||||
moreBytes(const PCState &pc, Addr fetchPC, MachInst inst)
|
||||
{
|
||||
emi = inst;
|
||||
// The I bit, bit 13, is used to figure out where the ASI
|
||||
// should come from. Use that in the ExtMachInst. This is
|
||||
// slightly redundant, but it removes the need to put a condition
|
||||
// into all the execute functions
|
||||
if(inst & (1 << 13))
|
||||
if (inst & (1 << 13)) {
|
||||
emi |= (static_cast<ExtMachInst>(
|
||||
tc->readMiscRegNoEffect(MISCREG_ASI))
|
||||
<< (sizeof(MachInst) * 8));
|
||||
else
|
||||
} else {
|
||||
emi |= (static_cast<ExtMachInst>(bits(inst, 12, 5))
|
||||
<< (sizeof(MachInst) * 8));
|
||||
}
|
||||
}
|
||||
|
||||
bool needMoreBytes()
|
||||
bool
|
||||
needMoreBytes()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool extMachInstReady()
|
||||
bool
|
||||
extMachInstReady()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// This returns a constant reference to the ExtMachInst to avoid a copy
|
||||
const ExtMachInst & getExtMachInst(PCState &pcState)
|
||||
const ExtMachInst &
|
||||
getExtMachInst(PCState &pcState)
|
||||
{
|
||||
return emi;
|
||||
}
|
||||
|
|
|
@ -67,11 +67,11 @@ SparcLiveProcess::SparcLiveProcess(LiveProcessParams * params,
|
|||
spillStart = 0;
|
||||
}
|
||||
|
||||
void SparcLiveProcess::handleTrap(int trapNum, ThreadContext *tc)
|
||||
void
|
||||
SparcLiveProcess::handleTrap(int trapNum, ThreadContext *tc)
|
||||
{
|
||||
PCState pc = tc->pcState();
|
||||
switch(trapNum)
|
||||
{
|
||||
switch (trapNum) {
|
||||
case 0x01: // Software breakpoint
|
||||
warn("Software breakpoint encountered at pc %#x.\n", pc.pc());
|
||||
break;
|
||||
|
@ -225,8 +225,7 @@ SparcLiveProcess::argsInit(int pageSize)
|
|||
// Setup the auxilliary vectors. These will already have endian conversion.
|
||||
// Auxilliary vectors are loaded only for elf formatted executables.
|
||||
ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile);
|
||||
if(elfObject)
|
||||
{
|
||||
if (elfObject) {
|
||||
// Bits which describe the system hardware capabilities
|
||||
auxv.push_back(auxv_t(M5_AT_HWCAP, hwcap));
|
||||
// The system page size
|
||||
|
@ -363,8 +362,7 @@ SparcLiveProcess::argsInit(int pageSize)
|
|||
initVirtMem->writeString(file_name_base, filename.c_str());
|
||||
|
||||
// Copy the aux stuff
|
||||
for(int x = 0; x < auxv.size(); x++)
|
||||
{
|
||||
for (int x = 0; x < auxv.size(); x++) {
|
||||
initVirtMem->writeBlob(auxv_array_base + x * 2 * intSize,
|
||||
(uint8_t*)&(auxv[x].a_type), intSize);
|
||||
initVirtMem->writeBlob(auxv_array_base + (x * 2 + 1) * intSize,
|
||||
|
@ -440,8 +438,7 @@ void Sparc32LiveProcess::flushWindows(ThreadContext *tc)
|
|||
MiscReg CWP = tc->readMiscReg(MISCREG_CWP);
|
||||
MiscReg origCWP = CWP;
|
||||
CWP = (CWP + Cansave + 2) % NWindows;
|
||||
while(NWindows - 2 - Cansave != 0)
|
||||
{
|
||||
while (NWindows - 2 - Cansave != 0) {
|
||||
if (Otherwin) {
|
||||
panic("Otherwin non-zero.\n");
|
||||
} else {
|
||||
|
@ -467,7 +464,8 @@ void Sparc32LiveProcess::flushWindows(ThreadContext *tc)
|
|||
tc->setMiscReg(MISCREG_CWP, origCWP);
|
||||
}
|
||||
|
||||
void Sparc64LiveProcess::flushWindows(ThreadContext *tc)
|
||||
void
|
||||
Sparc64LiveProcess::flushWindows(ThreadContext *tc)
|
||||
{
|
||||
IntReg Cansave = tc->readIntReg(NumIntArchRegs + 3);
|
||||
IntReg Canrestore = tc->readIntReg(NumIntArchRegs + 4);
|
||||
|
@ -475,8 +473,7 @@ void Sparc64LiveProcess::flushWindows(ThreadContext *tc)
|
|||
MiscReg CWP = tc->readMiscReg(MISCREG_CWP);
|
||||
MiscReg origCWP = CWP;
|
||||
CWP = (CWP + Cansave + 2) % NWindows;
|
||||
while(NWindows - 2 - Cansave != 0)
|
||||
{
|
||||
while (NWindows - 2 - Cansave != 0) {
|
||||
if (Otherwin) {
|
||||
panic("Otherwin non-zero.\n");
|
||||
} else {
|
||||
|
|
|
@ -62,11 +62,8 @@ class SparcLiveProcess : public LiveProcess
|
|||
// Handles traps which request services from the operating system
|
||||
virtual void handleTrap(int trapNum, ThreadContext *tc);
|
||||
|
||||
Addr readFillStart()
|
||||
{ return fillStart; }
|
||||
|
||||
Addr readSpillStart()
|
||||
{ return spillStart; }
|
||||
Addr readFillStart() { return fillStart; }
|
||||
Addr readSpillStart() { return spillStart; }
|
||||
|
||||
virtual void flushWindows(ThreadContext *tc) = 0;
|
||||
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
namespace SparcISA
|
||||
{
|
||||
|
||||
using SparcISAInst::MaxInstSrcRegs;
|
||||
using SparcISAInst::MaxInstDestRegs;
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class PhysicalMemory;
|
|||
|
||||
namespace SparcISA
|
||||
{
|
||||
|
||||
class RemoteGDB : public BaseRemoteGDB
|
||||
{
|
||||
protected:
|
||||
|
@ -72,6 +73,7 @@ namespace SparcISA
|
|||
|
||||
Addr nextBkpt;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* __ARCH_SPARC_REMOTE_GDB_H__ */
|
||||
|
|
|
@ -46,12 +46,10 @@ namespace SparcISA
|
|||
|
||||
// const int NumRegularIntRegs = MaxGL * 8 + NWindows * 16;
|
||||
// const int NumMicroIntRegs = 1;
|
||||
// const int NumIntRegs =
|
||||
// NumRegularIntRegs +
|
||||
// NumMicroIntRegs;
|
||||
// const int NumIntRegs = NumRegularIntRegs + NumMicroIntRegs;
|
||||
const int NumFloatRegs = 64;
|
||||
const int NumFloatArchRegs = NumFloatRegs;
|
||||
// const int NumMiscRegs = 40;
|
||||
}
|
||||
|
||||
#endif // __ARCH_SPARC_ISA_TRAITS_HH__
|
||||
#endif // __ARCH_SPARC_SPARC_TRAITS_HH__
|
||||
|
|
|
@ -39,13 +39,15 @@
|
|||
class ThreadContext;
|
||||
namespace SparcISA
|
||||
{
|
||||
|
||||
class StackTrace
|
||||
{
|
||||
private:
|
||||
std::vector<Addr> stack;
|
||||
|
||||
public:
|
||||
bool trace(ThreadContext *tc, StaticInstPtr inst)
|
||||
bool
|
||||
trace(ThreadContext *tc, StaticInstPtr inst)
|
||||
{
|
||||
panic("StackTrace::trace not implemented for SPARC.\n");
|
||||
return false;
|
||||
|
@ -56,6 +58,7 @@ namespace SparcISA
|
|||
public:
|
||||
void dprintf() {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __ARCH_SPARC_STACKTRACE_HH__
|
||||
|
|
|
@ -111,26 +111,30 @@ class SparcSystem : public System
|
|||
|
||||
/** Add a function-based event to reset binary. */
|
||||
template <class T>
|
||||
T *addResetFuncEvent(const char *lbl)
|
||||
T *
|
||||
addResetFuncEvent(const char *lbl)
|
||||
{
|
||||
return addFuncEvent<T>(resetSymtab, lbl);
|
||||
}
|
||||
|
||||
/** Add a function-based event to the hypervisor. */
|
||||
template <class T>
|
||||
T *addHypervisorFuncEvent(const char *lbl)
|
||||
T *
|
||||
addHypervisorFuncEvent(const char *lbl)
|
||||
{
|
||||
return addFuncEvent<T>(hypervisorSymtab, lbl);
|
||||
}
|
||||
|
||||
/** Add a function-based event to the openboot. */
|
||||
template <class T>
|
||||
T *addOpenbootFuncEvent(const char *lbl)
|
||||
T *
|
||||
addOpenbootFuncEvent(const char *lbl)
|
||||
{
|
||||
return addFuncEvent<T>(openbootSymtab, lbl);
|
||||
}
|
||||
|
||||
virtual Addr fixFuncEventAddr(Addr addr)
|
||||
virtual Addr
|
||||
fixFuncEventAddr(Addr addr)
|
||||
{
|
||||
//XXX This may eventually have to do something useful.
|
||||
return addr;
|
||||
|
|
|
@ -131,21 +131,6 @@ TLB::insert(Addr va, int partition_id, int context_id, bool real,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
i = lookupTable.find(tr);
|
||||
if (i != lookupTable.end()) {
|
||||
i->second->valid = false;
|
||||
if (i->second->used) {
|
||||
i->second->used = false;
|
||||
usedEntries--;
|
||||
}
|
||||
freeList.push_front(i->second);
|
||||
DPRINTF(TLB, "TLB: Found conflicting entry %#X , deleting it\n",
|
||||
i->second);
|
||||
lookupTable.erase(i);
|
||||
}
|
||||
*/
|
||||
|
||||
if (entry != -1) {
|
||||
assert(entry < size && entry >= 0);
|
||||
new_entry = &tlb[entry];
|
||||
|
@ -164,13 +149,6 @@ TLB::insert(Addr va, int partition_id, int context_id, bool real,
|
|||
lastReplaced = x;
|
||||
new_entry = &tlb[x];
|
||||
}
|
||||
/*
|
||||
for (x = 0; x < size; x++) {
|
||||
if (!tlb[x].valid || !tlb[x].used) {
|
||||
new_entry = &tlb[x];
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
insertAllLocked:
|
||||
|
@ -642,24 +620,24 @@ TLB::translateData(RequestPtr req, ThreadContext *tc, bool write)
|
|||
}
|
||||
} else {
|
||||
// We need to check for priv level/asi priv
|
||||
if (!priv && !hpriv && !AsiIsUnPriv(asi)) {
|
||||
if (!priv && !hpriv && !asiIsUnPriv(asi)) {
|
||||
// It appears that context should be Nucleus in these cases?
|
||||
writeSfsr(vaddr, write, Nucleus, false, IllegalAsi, asi);
|
||||
return new PrivilegedAction;
|
||||
}
|
||||
|
||||
if (!hpriv && AsiIsHPriv(asi)) {
|
||||
if (!hpriv && asiIsHPriv(asi)) {
|
||||
writeSfsr(vaddr, write, Nucleus, false, IllegalAsi, asi);
|
||||
return new DataAccessException;
|
||||
}
|
||||
|
||||
if (AsiIsPrimary(asi)) {
|
||||
if (asiIsPrimary(asi)) {
|
||||
context = pri_context;
|
||||
ct = Primary;
|
||||
} else if (AsiIsSecondary(asi)) {
|
||||
} else if (asiIsSecondary(asi)) {
|
||||
context = sec_context;
|
||||
ct = Secondary;
|
||||
} else if (AsiIsNucleus(asi)) {
|
||||
} else if (asiIsNucleus(asi)) {
|
||||
ct = Nucleus;
|
||||
context = 0;
|
||||
} else { // ????
|
||||
|
@ -669,34 +647,34 @@ TLB::translateData(RequestPtr req, ThreadContext *tc, bool write)
|
|||
}
|
||||
|
||||
if (!implicit && asi != ASI_P && asi != ASI_S) {
|
||||
if (AsiIsLittle(asi))
|
||||
if (asiIsLittle(asi))
|
||||
panic("Little Endian ASIs not supported\n");
|
||||
|
||||
//XXX It's unclear from looking at the documentation how a no fault
|
||||
// load differs from a regular one, other than what happens concerning
|
||||
// nfo and e bits in the TTE
|
||||
// if (AsiIsNoFault(asi))
|
||||
// if (asiIsNoFault(asi))
|
||||
// panic("No Fault ASIs not supported\n");
|
||||
|
||||
if (AsiIsPartialStore(asi))
|
||||
if (asiIsPartialStore(asi))
|
||||
panic("Partial Store ASIs not supported\n");
|
||||
|
||||
if (AsiIsCmt(asi))
|
||||
if (asiIsCmt(asi))
|
||||
panic("Cmt ASI registers not implmented\n");
|
||||
|
||||
if (AsiIsInterrupt(asi))
|
||||
if (asiIsInterrupt(asi))
|
||||
goto handleIntRegAccess;
|
||||
if (AsiIsMmu(asi))
|
||||
if (asiIsMmu(asi))
|
||||
goto handleMmuRegAccess;
|
||||
if (AsiIsScratchPad(asi))
|
||||
if (asiIsScratchPad(asi))
|
||||
goto handleScratchRegAccess;
|
||||
if (AsiIsQueue(asi))
|
||||
if (asiIsQueue(asi))
|
||||
goto handleQueueRegAccess;
|
||||
if (AsiIsSparcError(asi))
|
||||
if (asiIsSparcError(asi))
|
||||
goto handleSparcErrorRegAccess;
|
||||
|
||||
if (!AsiIsReal(asi) && !AsiIsNucleus(asi) && !AsiIsAsIfUser(asi) &&
|
||||
!AsiIsTwin(asi) && !AsiIsBlock(asi) && !AsiIsNoFault(asi))
|
||||
if (!asiIsReal(asi) && !asiIsNucleus(asi) && !asiIsAsIfUser(asi) &&
|
||||
!asiIsTwin(asi) && !asiIsBlock(asi) && !asiIsNoFault(asi))
|
||||
panic("Accessing ASI %#X. Should we?\n", asi);
|
||||
}
|
||||
|
||||
|
@ -714,12 +692,12 @@ TLB::translateData(RequestPtr req, ThreadContext *tc, bool write)
|
|||
return new DataAccessException;
|
||||
}
|
||||
|
||||
if ((!lsu_dm && !hpriv && !red) || AsiIsReal(asi)) {
|
||||
if ((!lsu_dm && !hpriv && !red) || asiIsReal(asi)) {
|
||||
real = true;
|
||||
context = 0;
|
||||
}
|
||||
|
||||
if (hpriv && (implicit || (!AsiIsAsIfUser(asi) && !AsiIsReal(asi)))) {
|
||||
if (hpriv && (implicit || (!asiIsAsIfUser(asi) && !asiIsReal(asi)))) {
|
||||
req->setPaddr(vaddr & PAddrImplMask);
|
||||
return NoFault;
|
||||
}
|
||||
|
@ -752,13 +730,13 @@ TLB::translateData(RequestPtr req, ThreadContext *tc, bool write)
|
|||
return new FastDataAccessProtection;
|
||||
}
|
||||
|
||||
if (e->pte.nofault() && !AsiIsNoFault(asi)) {
|
||||
if (e->pte.nofault() && !asiIsNoFault(asi)) {
|
||||
writeTagAccess(vaddr, context);
|
||||
writeSfsr(vaddr, write, ct, e->pte.sideffect(), LoadFromNfo, asi);
|
||||
return new DataAccessException;
|
||||
}
|
||||
|
||||
if (e->pte.sideffect() && AsiIsNoFault(asi)) {
|
||||
if (e->pte.sideffect() && asiIsNoFault(asi)) {
|
||||
writeTagAccess(vaddr, context);
|
||||
writeSfsr(vaddr, write, ct, e->pte.sideffect(), SideEffect, asi);
|
||||
return new DataAccessException;
|
||||
|
|
|
@ -156,7 +156,8 @@ class TLB : public BaseTLB
|
|||
typedef SparcTLBParams Params;
|
||||
TLB(const Params *p);
|
||||
|
||||
void demapPage(Addr vaddr, uint64_t asn)
|
||||
void
|
||||
demapPage(Addr vaddr, uint64_t asn)
|
||||
{
|
||||
panic("demapPage(Addr) is not implemented.\n");
|
||||
}
|
||||
|
|
|
@ -46,7 +46,8 @@ class TlbMap
|
|||
public:
|
||||
typedef RangeMap::iterator iterator;
|
||||
|
||||
iterator find(const TlbRange &r)
|
||||
iterator
|
||||
find(const TlbRange &r)
|
||||
{
|
||||
iterator i;
|
||||
|
||||
|
@ -79,7 +80,8 @@ class TlbMap
|
|||
return tree.end();
|
||||
}
|
||||
|
||||
bool intersect(const TlbRange &r)
|
||||
bool
|
||||
intersect(const TlbRange &r)
|
||||
{
|
||||
iterator i;
|
||||
i = find(r);
|
||||
|
@ -89,7 +91,8 @@ class TlbMap
|
|||
}
|
||||
|
||||
|
||||
iterator insert(TlbRange &r, TlbEntry *d)
|
||||
iterator
|
||||
insert(TlbRange &r, TlbEntry *d)
|
||||
{
|
||||
if (intersect(r))
|
||||
return tree.end();
|
||||
|
@ -97,47 +100,56 @@ class TlbMap
|
|||
return tree.insert(std::make_pair<TlbRange,TlbEntry*>(r, d)).first;
|
||||
}
|
||||
|
||||
size_t erase(TlbRange k)
|
||||
size_t
|
||||
erase(TlbRange k)
|
||||
{
|
||||
return tree.erase(k);
|
||||
}
|
||||
|
||||
void erase(iterator p)
|
||||
void
|
||||
erase(iterator p)
|
||||
{
|
||||
tree.erase(p);
|
||||
}
|
||||
|
||||
void erase(iterator p, iterator q)
|
||||
void
|
||||
erase(iterator p, iterator q)
|
||||
{
|
||||
tree.erase(p,q);
|
||||
}
|
||||
|
||||
void clear()
|
||||
void
|
||||
clear()
|
||||
{
|
||||
tree.erase(tree.begin(), tree.end());
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
iterator
|
||||
begin()
|
||||
{
|
||||
return tree.begin();
|
||||
}
|
||||
|
||||
iterator end()
|
||||
iterator
|
||||
end()
|
||||
{
|
||||
return tree.end();
|
||||
}
|
||||
|
||||
size_t size()
|
||||
size_t
|
||||
size()
|
||||
{
|
||||
return tree.size();
|
||||
}
|
||||
|
||||
bool empty()
|
||||
bool
|
||||
empty()
|
||||
{
|
||||
return tree.empty();
|
||||
}
|
||||
|
||||
void print()
|
||||
void
|
||||
print()
|
||||
{
|
||||
iterator i;
|
||||
i = tree.begin();
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
namespace SparcISA
|
||||
{
|
||||
|
||||
typedef uint32_t MachInst;
|
||||
typedef uint64_t ExtMachInst;
|
||||
|
||||
|
@ -44,9 +45,11 @@ namespace SparcISA
|
|||
|
||||
typedef Twin64_t LargestRead;
|
||||
|
||||
struct CoreSpecific {
|
||||
struct CoreSpecific
|
||||
{
|
||||
int core_type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -334,9 +334,10 @@ ISA::processSTickCompare(ThreadContext *tc)
|
|||
if (!(tc->readMiscRegNoEffect(MISCREG_STICK_CMPR) & (ULL(1) << 63))) {
|
||||
setMiscReg(MISCREG_SOFTINT, softint | (ULL(1) << 16), tc);
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
cpu->schedule(sTickCompare, curTick + ticks * cpu->ticks(1));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ISA::processHSTickCompare(ThreadContext *tc)
|
||||
|
@ -361,7 +362,8 @@ ISA::processHSTickCompare(ThreadContext *tc)
|
|||
setMiscReg(MISCREG_HINTP, 1, tc);
|
||||
}
|
||||
// Need to do something to cause interrupt to happen here !!! @todo
|
||||
} else
|
||||
} else {
|
||||
cpu->schedule(hSTickCompare, curTick + ticks * cpu->ticks(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,15 +72,18 @@ copyMiscRegs(ThreadContext *src, ThreadContext *dest)
|
|||
uint8_t tl = src->readMiscRegNoEffect(MISCREG_TL);
|
||||
|
||||
// Read all the trap level dependent registers and save them off
|
||||
for(int i = 1; i <= MaxTL; i++)
|
||||
{
|
||||
for (int i = 1; i <= MaxTL; i++) {
|
||||
src->setMiscRegNoEffect(MISCREG_TL, i);
|
||||
dest->setMiscRegNoEffect(MISCREG_TL, i);
|
||||
|
||||
dest->setMiscRegNoEffect(MISCREG_TT, src->readMiscRegNoEffect(MISCREG_TT));
|
||||
dest->setMiscRegNoEffect(MISCREG_TPC, src->readMiscRegNoEffect(MISCREG_TPC));
|
||||
dest->setMiscRegNoEffect(MISCREG_TNPC, src->readMiscRegNoEffect(MISCREG_TNPC));
|
||||
dest->setMiscRegNoEffect(MISCREG_TSTATE, src->readMiscRegNoEffect(MISCREG_TSTATE));
|
||||
dest->setMiscRegNoEffect(MISCREG_TT,
|
||||
src->readMiscRegNoEffect(MISCREG_TT));
|
||||
dest->setMiscRegNoEffect(MISCREG_TPC,
|
||||
src->readMiscRegNoEffect(MISCREG_TPC));
|
||||
dest->setMiscRegNoEffect(MISCREG_TNPC,
|
||||
src->readMiscRegNoEffect(MISCREG_TNPC));
|
||||
dest->setMiscRegNoEffect(MISCREG_TSTATE,
|
||||
src->readMiscRegNoEffect(MISCREG_TSTATE));
|
||||
}
|
||||
|
||||
// Save off the traplevel
|
||||
|
@ -89,40 +92,63 @@ copyMiscRegs(ThreadContext *src, ThreadContext *dest)
|
|||
|
||||
|
||||
// ASRs
|
||||
// dest->setMiscRegNoEffect(MISCREG_Y, src->readMiscRegNoEffect(MISCREG_Y));
|
||||
// dest->setMiscRegNoEffect(MISCREG_CCR, src->readMiscRegNoEffect(MISCREG_CCR));
|
||||
dest->setMiscRegNoEffect(MISCREG_ASI, src->readMiscRegNoEffect(MISCREG_ASI));
|
||||
dest->setMiscRegNoEffect(MISCREG_TICK, src->readMiscRegNoEffect(MISCREG_TICK));
|
||||
dest->setMiscRegNoEffect(MISCREG_FPRS, src->readMiscRegNoEffect(MISCREG_FPRS));
|
||||
dest->setMiscRegNoEffect(MISCREG_SOFTINT, src->readMiscRegNoEffect(MISCREG_SOFTINT));
|
||||
dest->setMiscRegNoEffect(MISCREG_TICK_CMPR, src->readMiscRegNoEffect(MISCREG_TICK_CMPR));
|
||||
dest->setMiscRegNoEffect(MISCREG_STICK, src->readMiscRegNoEffect(MISCREG_STICK));
|
||||
dest->setMiscRegNoEffect(MISCREG_STICK_CMPR, src->readMiscRegNoEffect(MISCREG_STICK_CMPR));
|
||||
// dest->setMiscRegNoEffect(MISCREG_Y,
|
||||
// src->readMiscRegNoEffect(MISCREG_Y));
|
||||
// dest->setMiscRegNoEffect(MISCREG_CCR,
|
||||
// src->readMiscRegNoEffect(MISCREG_CCR));
|
||||
dest->setMiscRegNoEffect(MISCREG_ASI,
|
||||
src->readMiscRegNoEffect(MISCREG_ASI));
|
||||
dest->setMiscRegNoEffect(MISCREG_TICK,
|
||||
src->readMiscRegNoEffect(MISCREG_TICK));
|
||||
dest->setMiscRegNoEffect(MISCREG_FPRS,
|
||||
src->readMiscRegNoEffect(MISCREG_FPRS));
|
||||
dest->setMiscRegNoEffect(MISCREG_SOFTINT,
|
||||
src->readMiscRegNoEffect(MISCREG_SOFTINT));
|
||||
dest->setMiscRegNoEffect(MISCREG_TICK_CMPR,
|
||||
src->readMiscRegNoEffect(MISCREG_TICK_CMPR));
|
||||
dest->setMiscRegNoEffect(MISCREG_STICK,
|
||||
src->readMiscRegNoEffect(MISCREG_STICK));
|
||||
dest->setMiscRegNoEffect(MISCREG_STICK_CMPR,
|
||||
src->readMiscRegNoEffect(MISCREG_STICK_CMPR));
|
||||
|
||||
// Priv Registers
|
||||
dest->setMiscRegNoEffect(MISCREG_TICK, src->readMiscRegNoEffect(MISCREG_TICK));
|
||||
dest->setMiscRegNoEffect(MISCREG_TBA, src->readMiscRegNoEffect(MISCREG_TBA));
|
||||
dest->setMiscRegNoEffect(MISCREG_PSTATE, src->readMiscRegNoEffect(MISCREG_PSTATE));
|
||||
dest->setMiscRegNoEffect(MISCREG_PIL, src->readMiscRegNoEffect(MISCREG_PIL));
|
||||
dest->setMiscReg(MISCREG_CWP, src->readMiscRegNoEffect(MISCREG_CWP));
|
||||
// dest->setMiscRegNoEffect(MISCREG_CANSAVE, src->readMiscRegNoEffect(MISCREG_CANSAVE));
|
||||
// dest->setMiscRegNoEffect(MISCREG_CANRESTORE, src->readMiscRegNoEffect(MISCREG_CANRESTORE));
|
||||
// dest->setMiscRegNoEffect(MISCREG_OTHERWIN, src->readMiscRegNoEffect(MISCREG_OTHERWIN));
|
||||
// dest->setMiscRegNoEffect(MISCREG_CLEANWIN, src->readMiscRegNoEffect(MISCREG_CLEANWIN));
|
||||
// dest->setMiscRegNoEffect(MISCREG_WSTATE, src->readMiscRegNoEffect(MISCREG_WSTATE));
|
||||
dest->setMiscRegNoEffect(MISCREG_TICK,
|
||||
src->readMiscRegNoEffect(MISCREG_TICK));
|
||||
dest->setMiscRegNoEffect(MISCREG_TBA,
|
||||
src->readMiscRegNoEffect(MISCREG_TBA));
|
||||
dest->setMiscRegNoEffect(MISCREG_PSTATE,
|
||||
src->readMiscRegNoEffect(MISCREG_PSTATE));
|
||||
dest->setMiscRegNoEffect(MISCREG_PIL,
|
||||
src->readMiscRegNoEffect(MISCREG_PIL));
|
||||
dest->setMiscReg(MISCREG_CWP,
|
||||
src->readMiscRegNoEffect(MISCREG_CWP));
|
||||
// dest->setMiscRegNoEffect(MISCREG_CANSAVE,
|
||||
// src->readMiscRegNoEffect(MISCREG_CANSAVE));
|
||||
// dest->setMiscRegNoEffect(MISCREG_CANRESTORE,
|
||||
// src->readMiscRegNoEffect(MISCREG_CANRESTORE));
|
||||
// dest->setMiscRegNoEffect(MISCREG_OTHERWIN,
|
||||
// src->readMiscRegNoEffect(MISCREG_OTHERWIN));
|
||||
// dest->setMiscRegNoEffect(MISCREG_CLEANWIN,
|
||||
// src->readMiscRegNoEffect(MISCREG_CLEANWIN));
|
||||
// dest->setMiscRegNoEffect(MISCREG_WSTATE,
|
||||
// src->readMiscRegNoEffect(MISCREG_WSTATE));
|
||||
dest->setMiscReg(MISCREG_GL, src->readMiscRegNoEffect(MISCREG_GL));
|
||||
|
||||
// Hyperprivilged registers
|
||||
dest->setMiscRegNoEffect(MISCREG_HPSTATE, src->readMiscRegNoEffect(MISCREG_HPSTATE));
|
||||
dest->setMiscRegNoEffect(MISCREG_HINTP, src->readMiscRegNoEffect(MISCREG_HINTP));
|
||||
dest->setMiscRegNoEffect(MISCREG_HTBA, src->readMiscRegNoEffect(MISCREG_HTBA));
|
||||
dest->setMiscRegNoEffect(MISCREG_HPSTATE,
|
||||
src->readMiscRegNoEffect(MISCREG_HPSTATE));
|
||||
dest->setMiscRegNoEffect(MISCREG_HINTP,
|
||||
src->readMiscRegNoEffect(MISCREG_HINTP));
|
||||
dest->setMiscRegNoEffect(MISCREG_HTBA,
|
||||
src->readMiscRegNoEffect(MISCREG_HTBA));
|
||||
dest->setMiscRegNoEffect(MISCREG_STRAND_STS_REG,
|
||||
src->readMiscRegNoEffect(MISCREG_STRAND_STS_REG));
|
||||
dest->setMiscRegNoEffect(MISCREG_HSTICK_CMPR,
|
||||
src->readMiscRegNoEffect(MISCREG_HSTICK_CMPR));
|
||||
|
||||
// FSR
|
||||
dest->setMiscRegNoEffect(MISCREG_FSR, src->readMiscRegNoEffect(MISCREG_FSR));
|
||||
dest->setMiscRegNoEffect(MISCREG_FSR,
|
||||
src->readMiscRegNoEffect(MISCREG_FSR));
|
||||
|
||||
// Strand Status Register
|
||||
dest->setMiscRegNoEffect(MISCREG_STRAND_STS_REG,
|
||||
|
|
|
@ -52,8 +52,7 @@ namespace SparcISA
|
|||
return ret;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp);
|
||||
uint64_t getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp);
|
||||
|
||||
static inline bool
|
||||
inUserMode(ThreadContext *tc)
|
||||
|
|
Loading…
Reference in a new issue