Skip to content

[WIP][RISC-V] Workaround to avoid crashes due to PMP protected memory. #106

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

neiling
Copy link

@neiling neiling commented Oct 27, 2022

As described in issue 105 the LiME module crashes under RISC-V when it
encounters a protected memory area through PMP (Physical Memory Protection).

In my workaround, I first test if the memory address is readable by
dereferencing it in a temporary-register. If an exception occurs during this test,
the error value is returned from the scause register. If the exception is a
"load access fault", zero bytes are written to the dump for the memory
page. This prevents the LiME module from crashing and as a small side effect
it is also possible to detect protected memory areas by PMP in S-Mode, since
the corresponding registers pmpaddr{0..n} can only be accessed in M-Mode.

@kd8bny
Copy link
Collaborator

kd8bny commented Dec 9, 2022

Setting up a risc v env

@kd8bny kd8bny self-assigned this Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants