changeset 9684637f3339 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=9684637f3339
description:
        arm: Blame the right instruction address on a Prefetch Abort

        CPU models (e.g., O3CPU) issue instruction fetches for the whole cache
        block rather than a specific instruction. Consequently the TLB lookups
        translate the cache block virtual address. When the TLB lookup fails,
        however, the Prefetch Abort must be raised for the PC of the
        instruction that caused the fault rather than for the address of the
        block.

        This change fixes the way we instantiate the PrefetchAbort faults to
        use the PC of the request rather the address of the instruction fetch
        request.

        Change-Id: I8e45549da1c3be55ad204a060029c95ce822a851
        Reviewed-by: Curtis Dunham <curtis.dun...@arm.com>
        Reviewed-by: Rekai Gonzalez Alberquilla 
<rekai.gonzalezalberqui...@arm.com>
        Signed-off-by: Andreas Sandberg <andreas.sandb...@arm.com>

diffstat:

 src/arch/arm/tlb.cc |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r 67dee11badea -r 9684637f3339 src/arch/arm/tlb.cc
--- a/src/arch/arm/tlb.cc       Sun Feb 19 05:30:32 2017 -0500
+++ b/src/arch/arm/tlb.cc       Tue Feb 21 14:14:44 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2013, 2016 ARM Limited
+ * Copyright (c) 2010-2013, 2016-2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -642,12 +642,15 @@
             DPRINTF(TLB, "TLB Fault: Data abort on domain. DACR: %#x"
                     " domain: %#x write:%d\n", dacr,
                     static_cast<uint8_t>(te->domain), is_write);
-            if (is_fetch)
+            if (is_fetch) {
+                // Use PC value instead of vaddr because vaddr might
+                // be aligned to cache line and should not be the
+                // address reported in FAR
                 return std::make_shared<PrefetchAbort>(
-                    vaddr,
+                    req->getPC(),
                     ArmFault::DomainLL + te->lookupLevel,
                     isStage2, tranMethod);
-            else
+            } else
                 return std::make_shared<DataAbort>(
                     vaddr, te->domain, is_write,
                     ArmFault::DomainLL + te->lookupLevel,
@@ -735,8 +738,10 @@
         DPRINTF(TLB, "TLB Fault: Prefetch abort on permission check. AP:%d "
                      "priv:%d write:%d ns:%d sif:%d sctlr.afe: %d \n",
                      ap, is_priv, is_write, te->ns, scr.sif,sctlr.afe);
+        // Use PC value instead of vaddr because vaddr might be aligned to
+        // cache line and should not be the address reported in FAR
         return std::make_shared<PrefetchAbort>(
-            vaddr,
+            req->getPC(),
             ArmFault::PermissionLL + te->lookupLevel,
             isStage2, tranMethod);
     } else if (abt | hapAbt) {
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to