diff --git a/src/target/armv7a_mmu.c b/src/target/armv7a_mmu.c index 6118417fc..aa3dc16d8 100644 --- a/src/target/armv7a_mmu.c +++ b/src/target/armv7a_mmu.c @@ -36,12 +36,12 @@ /* V7 method VA TO PA */ int armv7a_mmu_translate_va_pa(struct target *target, uint32_t va, - uint32_t *val, int meminfo) + target_addr_t *val, int meminfo) { int retval = ERROR_FAIL; struct armv7a_common *armv7a = target_to_armv7a(target); struct arm_dpm *dpm = armv7a->arm.dpm; - uint32_t virt = va & ~0xfff; + uint32_t virt = va & ~0xfff, value; uint32_t NOS, NS, INNER, OUTER; *val = 0xdeadbeef; retval = dpm->prepare(dpm); @@ -56,9 +56,10 @@ int armv7a_mmu_translate_va_pa(struct target *target, uint32_t va, goto done; retval = dpm->instr_read_data_r0(dpm, ARMV4_5_MRC(15, 0, 0, 7, 4, 0), - val); + &value); if (retval != ERROR_OK) goto done; + *val = value; /* decode memory attribute */ NOS = (*val >> 10) & 1; /* Not Outer shareable */ NS = (*val >> 9) & 1; /* Non secure */ @@ -67,7 +68,7 @@ int armv7a_mmu_translate_va_pa(struct target *target, uint32_t va, *val = (*val & ~0xfff) + (va & 0xfff); if (meminfo) { - LOG_INFO("%" PRIx32 " : %" PRIx32 " %s outer shareable %s secured", + LOG_INFO("%" PRIx32 " : %" TARGET_PRIxADDR " %s outer shareable %s secured", va, *val, NOS == 1 ? "not" : " ", NS == 1 ? "not" : ""); diff --git a/src/target/armv7a_mmu.h b/src/target/armv7a_mmu.h index 513e56704..36cd9d19e 100644 --- a/src/target/armv7a_mmu.h +++ b/src/target/armv7a_mmu.h @@ -20,7 +20,7 @@ #define OPENOCD_TARGET_ARMV7A_MMU_H extern int armv7a_mmu_translate_va_pa(struct target *target, uint32_t va, - uint32_t *val, int meminfo); + target_addr_t *val, int meminfo); extern const struct command_registration armv7a_mmu_command_handlers[]; diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index 9fc265288..158de0b24 100644 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -2922,7 +2922,7 @@ static int cortex_a_virt2phys(struct target *target, if (retval != ERROR_OK) return retval; return armv7a_mmu_translate_va_pa(target, (uint32_t)virt, - (uint32_t *)phys, 1); + phys, 1); } COMMAND_HANDLER(cortex_a_handle_cache_info_command)