arch-arm: Move generateTrap from MiscRegOp to ArmStaticInst
System(Misc) register accesses are not the only trappable instructions. We move the exception generation logic (generateTrap) from the MiscRegOp64 to the base ArmStaticInst Change-Id: Ie2ba0c39790f50e3e8d504d153025d402283ec95 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
@@ -128,22 +128,6 @@ MiscRegOp64::generateTrap(ExceptionLevel el) const
|
||||
return generateTrap(el, ExceptionClass::TRAPPED_MSR_MRS_64, iss());
|
||||
}
|
||||
|
||||
Fault
|
||||
MiscRegOp64::generateTrap(ExceptionLevel el, ExceptionClass ec,
|
||||
uint32_t iss) const
|
||||
{
|
||||
switch (el) {
|
||||
case EL1:
|
||||
return std::make_shared<SupervisorTrap>(getEMI(), iss, ec);
|
||||
case EL2:
|
||||
return std::make_shared<HypervisorTrap>(getEMI(), iss, ec);
|
||||
case EL3:
|
||||
return std::make_shared<SecureMonitorTrap>(getEMI(), iss, ec);
|
||||
default:
|
||||
panic("Invalid EL: %d\n", el);
|
||||
}
|
||||
}
|
||||
|
||||
RegVal
|
||||
MiscRegImmOp64::miscRegImm() const
|
||||
{
|
||||
|
||||
@@ -174,9 +174,8 @@ class MiscRegOp64 : public ArmISA::ArmStaticInst
|
||||
|
||||
bool miscRead() const { return _miscRead; }
|
||||
|
||||
using ArmISA::ArmStaticInst::generateTrap;
|
||||
Fault generateTrap(ArmISA::ExceptionLevel el) const;
|
||||
Fault generateTrap(ArmISA::ExceptionLevel el,
|
||||
ArmISA::ExceptionClass ec, uint32_t iss) const;
|
||||
};
|
||||
|
||||
class MiscRegImmOp64 : public MiscRegOp64
|
||||
|
||||
@@ -1367,6 +1367,21 @@ ArmStaticInst::getCurSmeVecLenInBits(ThreadContext *tc)
|
||||
return isa->getCurSmeVecLenInBits();
|
||||
}
|
||||
|
||||
Fault
|
||||
ArmStaticInst::generateTrap(ExceptionLevel el, ExceptionClass ec,
|
||||
uint32_t iss) const
|
||||
{
|
||||
switch (el) {
|
||||
case EL1:
|
||||
return std::make_shared<SupervisorTrap>(getEMI(), iss, ec);
|
||||
case EL2:
|
||||
return std::make_shared<HypervisorTrap>(getEMI(), iss, ec);
|
||||
case EL3:
|
||||
return std::make_shared<SecureMonitorTrap>(getEMI(), iss, ec);
|
||||
default:
|
||||
panic("Invalid EL: %d\n", el);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ArmISA
|
||||
} // namespace gem5
|
||||
|
||||
@@ -633,6 +633,10 @@ class ArmStaticInst : public StaticInst
|
||||
return std::make_shared<UndefinedInstruction>(
|
||||
machInst, false, mnemonic, disabled);
|
||||
}
|
||||
|
||||
Fault
|
||||
generateTrap(ArmISA::ExceptionLevel el,
|
||||
ArmISA::ExceptionClass ec, uint32_t iss) const;
|
||||
};
|
||||
|
||||
} // namespace ArmISA
|
||||
|
||||
Reference in New Issue
Block a user