-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
target/riscv: Fix memory access when MMU is enabled and address couldn't be translated #945
target/riscv: Fix memory access when MMU is enabled and address couldn't be translated #945
Conversation
9687679
to
3122c69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Please return result where that is now easily possible.
src/target/riscv/riscv.c
Outdated
LOG_TARGET_ERROR(target, "Failed to read vsatp register."); | ||
int result = riscv_get_register(target, &vsatp, GDB_REGNO_VSATP); | ||
if (result != ERROR_OK) { | ||
LOG_TARGET_ERROR(target, "Failed to read vsatp register. Error: %d", result); | ||
return ERROR_FAIL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ERROR_FAIL; | |
return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After internal discussion we decided not to print/return error code here, because it looks like useless for users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is fine.
src/target/riscv/riscv.c
Outdated
LOG_TARGET_ERROR(target, "Failed to read hgatp register."); | ||
result = riscv_get_register(target, &hgatp, GDB_REGNO_HGATP); | ||
if (result != ERROR_OK) { | ||
LOG_TARGET_ERROR(target, "Failed to read hgatp register. Error: %d", result); | ||
return ERROR_FAIL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ERROR_FAIL; | |
return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
3122c69
to
24de36b
Compare
…n't be translated Now: 1) If mmu is disabled, virt2phys succeeded and returns physical address 2) If mmu is enbaled, but translation fails, read/write_memory fails Change-Id: I312309c660239014b3278cb77cadc5618de8e4de Signed-off-by: Kirill Radkin <[email protected]>
24de36b
to
57c3f0d
Compare
Now:
Change-Id: I312309c660239014b3278cb77cadc5618de8e4de