[debug] enhance set_pmp_deny to support alignment checks #637
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.
This PR sets the NAPOT range size considering the minimum PMP granularity supported by the hart.
This PR is separate from #632 as suggested by @en-sc .
The issue this PR solves.
set_pmp_deny()is called by two tests,MemTestReadInvalid()andEtriggerTest(), with the argumentbad_address.sizeforset_pmp_deny()is 4 KB.MemTestReadInvalid()requires 4 bytes andEtriggerTest()requires 1 byte forsize, but they use the default value (4 KB).debug/targets/RISC-V/spike32.pyanddebug/targets/RISC-V/spike64.py:testlib.pyL1496pmpaddr0is set to0x100f_ffff >> 2(1MB NAPOT range starting 0x1000_0000).How this PR works
sizeofset_pmp_deny()now has no default value. The caller sets it to the value required by the test.sizeargument and the minimum supported PMP granularity.set_pmp_deny()raises aTestNotApplicableerror if the value of the argumentaddressis inconsistent with the calculated size. This error allows users to setbad_addressto a proper value.