This is an automated email from Gerrit.

Matthias Welwarsky (matth...@welwarsky.de) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/4480

-- gerrit

commit 4004e0d2478666471f58e4c0992cdfd6371fa729
Author: Matthias Welwarsky <matthias.welwar...@sysgo.com>
Date:   Fri Jul 15 14:23:25 2016 +0200

    cortex_a: fix virt2phys when mmu is disabled
    
    When the MMU is not enabled on debug state entry, virt2phys cannot
    perform a translation since it is unknown whether a valid MMU
    configuration existed before. In this case, return the virtual
    address as physical address.
    
    Change-Id: I6f85a7a5dbc200be1a4b5badf10a1a717f1c79c0
    Signed-off-by: Matthias Welwarsky <matthias.welwar...@sysgo.com>

diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c
index bf3325f..cf16b78 100644
--- a/src/target/cortex_a.c
+++ b/src/target/cortex_a.c
@@ -3227,6 +3227,20 @@ static int cortex_a_virt2phys(struct target *target,
        struct armv7a_common *armv7a = target_to_armv7a(target);
        struct adiv5_dap *swjdp = armv7a->arm.dap;
        uint8_t apsel = swjdp->apsel;
+       int mmu_enabled;
+
+       /*
+        * If the MMU was not enabled at debug entry, there is no
+        * way of knowing if there was ever a valid configuration
+        * for it and thus it's not safe to enable it. In this case,
+        * just return the virtual address as physical.
+        */
+       cortex_a_mmu(target, &mmu_enabled);
+       if (!mmu_enabled) {
+               *phys = virt;
+               return ERROR_OK;
+       }
+
        if (armv7a->memory_ap_available && (apsel == 
armv7a->memory_ap->ap_num)) {
                uint32_t ret;
                retval = armv7a_mmu_translate_va(target,

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to