summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorGiacomo Travaglini <giacomo.travaglini@arm.com>2019-07-17 17:00:13 +0100
committerGiacomo Travaglini <giacomo.travaglini@arm.com>2019-07-19 15:44:07 +0000
commit373698140d9ee9a24fbee93e8abc55e2809441e3 (patch)
tree1040d76db5bb0a1e9a3f1a34b8226fe1b0f3b070 /src/arch
parentab6001488f7501fdf3e28879fd0dc6711bc62071 (diff)
downloadgem5-373698140d9ee9a24fbee93e8abc55e2809441e3.tar.xz
arch-arm: Clean Fault generation when processing Long Descriptor
A new shared method has been introduced: generateLongDescFault Change-Id: I7eb6fa1347a6c2cf9cb11fd9f2137d983c4f7a40 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Ciro Santilli <ciro.santilli@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19608 Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/arm/table_walker.cc85
-rw-r--r--src/arch/arm/table_walker.hh3
2 files changed, 38 insertions, 50 deletions
diff --git a/src/arch/arm/table_walker.cc b/src/arch/arm/table_walker.cc
index 3feffa928..d8f297162 100644
--- a/src/arch/arm/table_walker.cc
+++ b/src/arch/arm/table_walker.cc
@@ -1536,6 +1536,26 @@ TableWalker::doL1Descriptor()
}
}
+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()
{
@@ -1581,57 +1601,34 @@ 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);
}
@@ -1666,21 +1663,9 @@ TableWalker::doLongDescriptor()
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;
}
diff --git a/src/arch/arm/table_walker.hh b/src/arch/arm/table_walker.hh
index dacde641a..3b6014366 100644
--- a/src/arch/arm/table_walker.hh
+++ b/src/arch/arm/table_walker.hh
@@ -43,6 +43,7 @@
#include <list>
+#include "arch/arm/faults.hh"
#include "arch/arm/miscregs.hh"
#include "arch/arm/system.hh"
#include "arch/arm/tlb.hh"
@@ -945,6 +946,8 @@ class TableWalker : public ClockedObject
Request::Flags flags, int queueIndex, Event *event,
void (TableWalker::*doDescriptor)());
+ Fault generateLongDescFault(ArmFault::FaultSource src);
+
void insertTableEntry(DescriptorBase &descriptor, bool longDescriptor);
Fault processWalk();