}
}
+Fault
+TableWalker::generateLongDescFault(ArmFault::FaultSource src)
+{
+ if (currState->isFetch) {
+ return std::make_shared<PrefetchAbort>(
+ currState->vaddr_tainted,
+ src + currState->longDesc.lookupLevel,
+ isStage2,
+ ArmFault::LpaeTran);
+ } else {
+ return std::make_shared<DataAbort>(
+ currState->vaddr_tainted,
+ TlbEntry::DomainType::NoAccess,
+ currState->isWrite,
+ src + currState->longDesc.lookupLevel,
+ isStage2,
+ ArmFault::LpaeTran);
+ }
+}
+
void
TableWalker::doLongDescriptor()
{
DPRINTF(TLB, "L%d descriptor Invalid, causing fault type %d\n",
currState->longDesc.lookupLevel,
ArmFault::TranslationLL + currState->longDesc.lookupLevel);
- if (currState->isFetch)
- currState->fault = std::make_shared<PrefetchAbort>(
- currState->vaddr_tainted,
- ArmFault::TranslationLL + currState->longDesc.lookupLevel,
- isStage2,
- ArmFault::LpaeTran);
- else
- currState->fault = std::make_shared<DataAbort>(
- currState->vaddr_tainted,
- TlbEntry::DomainType::NoAccess,
- currState->isWrite,
- ArmFault::TranslationLL + currState->longDesc.lookupLevel,
- isStage2,
- ArmFault::LpaeTran);
+
+ currState->fault = generateLongDescFault(ArmFault::TranslationLL);
return;
+
case LongDescriptor::Block:
case LongDescriptor::Page:
{
- bool fault = false;
- bool aff = false;
+ auto fault_source = ArmFault::FaultSourceInvalid;
// Check for address size fault
if (checkAddrSizeFaultAArch64(
mbits(currState->longDesc.data, MaxPhysAddrRange - 1,
currState->longDesc.offsetBits()),
currState->physAddrRange)) {
- fault = true;
+
DPRINTF(TLB, "L%d descriptor causing Address Size Fault\n",
currState->longDesc.lookupLevel);
+ fault_source = ArmFault::AddressSizeLL;
+
// Check for access fault
} else if (currState->longDesc.af() == 0) {
- fault = true;
+
DPRINTF(TLB, "L%d descriptor causing Access Fault\n",
currState->longDesc.lookupLevel);
- aff = true;
+ fault_source = ArmFault::AccessFlagLL;
}
- if (fault) {
- if (currState->isFetch)
- currState->fault = std::make_shared<PrefetchAbort>(
- currState->vaddr_tainted,
- (aff ? ArmFault::AccessFlagLL : ArmFault::AddressSizeLL) +
- currState->longDesc.lookupLevel,
- isStage2,
- ArmFault::LpaeTran);
- else
- currState->fault = std::make_shared<DataAbort>(
- currState->vaddr_tainted,
- TlbEntry::DomainType::NoAccess, currState->isWrite,
- (aff ? ArmFault::AccessFlagLL : ArmFault::AddressSizeLL) +
- currState->longDesc.lookupLevel,
- isStage2,
- ArmFault::LpaeTran);
+
+ if (fault_source != ArmFault::FaultSourceInvalid) {
+ currState->fault = generateLongDescFault(fault_source);
} else {
insertTableEntry(currState->longDesc, true);
}
next_desc_addr, currState->physAddrRange)) {
DPRINTF(TLB, "L%d descriptor causing Address Size Fault\n",
currState->longDesc.lookupLevel);
- if (currState->isFetch)
- currState->fault = std::make_shared<PrefetchAbort>(
- currState->vaddr_tainted,
- ArmFault::AddressSizeLL
- + currState->longDesc.lookupLevel,
- isStage2,
- ArmFault::LpaeTran);
- else
- currState->fault = std::make_shared<DataAbort>(
- currState->vaddr_tainted,
- TlbEntry::DomainType::NoAccess, currState->isWrite,
- ArmFault::AddressSizeLL
- + currState->longDesc.lookupLevel,
- isStage2,
- ArmFault::LpaeTran);
+
+ currState->fault = generateLongDescFault(
+ ArmFault::AddressSizeLL);
return;
}