X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Fcortex_a.c;h=b15dcb414f4a6f424dbca7e3fb31ff86eded13a3;hb=refs%2Fchanges%2F80%2F4480%2F6;hp=21ce4fae83ee9bc8e7c444a891bffcfc3e2df566;hpb=42097baf19d4459a57f5224506e59a8347740f19;p=openocd.git diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index 21ce4fae83..b15dcb414f 100644 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -3229,6 +3229,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,