Skip to content

Commit 494eca1

Browse files
author
wangyanwen
committed
src/target/riscv:fix virt2phys
Change-Id: I6b92fcd3a6764b98c9e4f8c19a197bb253d6471a Signed-off-by: wangyanwen <[email protected]>
1 parent c7ad945 commit 494eca1

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/target/riscv/riscv.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,11 +2987,8 @@ static int riscv_address_translate(struct target *target,
29872987
LOG_TARGET_DEBUG(target, "i=%d; PTE @0x%" TARGET_PRIxADDR " = 0x%" PRIx64, i,
29882988
pte_address, pte);
29892989

2990-
if (!(pte & PTE_V) || (!(pte & PTE_R) && (pte & PTE_W))) {
2991-
LOG_TARGET_ERROR(target, "invalid PTE @0x%" TARGET_PRIxADDR ": 0x%" PRIx64
2992-
"; mode=%s; i=%d", pte_address, pte, info->name, i);
2990+
if (!(pte & PTE_V) || (!(pte & PTE_R) && (pte & PTE_W)))
29932991
return ERROR_FAIL;
2994-
}
29952992

29962993
if ((pte & PTE_R) || (pte & PTE_W) || (pte & PTE_X)) /* Found leaf PTE. */
29972994
break;
@@ -3301,11 +3298,8 @@ static int riscv_rw_memory(struct target *target, const riscv_mem_access_args_t
33013298
while (current_count < args.count) {
33023299
target_addr_t physical_addr;
33033300
result = target->type->virt2phys(target, current_address, &physical_addr);
3304-
if (result != ERROR_OK) {
3305-
LOG_TARGET_ERROR(target, "Address translation failed.");
3301+
if (result != ERROR_OK)
33063302
physical_addr = current_address;
3307-
//return result;
3308-
}
33093303

33103304
/* TODO: For simplicity, this algorithm assumes the worst case - the smallest possible page size,
33113305
* which is 4 KiB. The algorithm can be improved to detect the real page size, and allow to use larger

0 commit comments

Comments
 (0)