Fix RISCV and CHERI soft-tlb non page-aligned #214
+76
−68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The QEMU softtlb only caches (target) page sized ranges. In the case another size is probed, the TLB is filled in but marked as invalid.
CHERI tag setting needs to acknowledge this case.
RISCV also had a completely broken implementation that worked out if the PMP covered an entire page. It tried to mask with a number that was not a power of two, and masking was not appropriate in the first place even had the number been a power of two.
It also ignored priority rules on PMP entry matching, and rules concerning PMP entry matching in M-Mode, and matching rules in non M-Mode where there are no PMP entries.
A lot of these changes could go away if we merged with upstream. They fix the PMP issues, and offer a new probe that returns the struct that tagmem needs without the current ugly hack.