-
Notifications
You must be signed in to change notification settings - Fork 188
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
PTEs are invalid if reserved bits are non-zero #677
Open
Timmmm
wants to merge
2
commits into
riscv:master
Choose a base branch
from
Timmmm:user/timh/priv_unpriv_spec_versions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+22
−7
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,18 +77,22 @@ function clause extensionEnabled(Ext_Svpbmt) = false | |
function pte_is_invalid(pte_flags : PTE_Flags, pte_ext : PTE_Ext) -> bool = | ||
pte_flags[V] == 0b0 | ||
| (pte_flags[W] == 0b1 & pte_flags[R] == 0b0) | ||
// Note, the following requirements depend on the privileged spec version. | ||
// Early versions do not require this check. This will need to be behind | ||
// a flag when the Sail model allows specifying the spec version. | ||
| (pte_ext[N] != 0b0 & not(extensionEnabled(Ext_Svnapot))) | ||
| (pte_ext[PBMT] != zeros() & not(extensionEnabled(Ext_Svpbmt))) | ||
| pte_ext[reserved] != zeros() | ||
// Since spec commit 31bc179b214fc0374075ea9284aa939b8341b843, reserved bits must be zero. | ||
| configPrivVersion >= 20211101 & ( | ||
// All bits are currently reserved for non-leaf PTEs. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a fix btw; the current code is missing it. |
||
pte_is_ptr(pte_flags) & pte_ext.bits != zeros() | ||
// N/PBMT are reserved if not implemented. | ||
| pte_ext[N] != zeros() & not(extensionEnabled(Ext_Svnapot)) | ||
| pte_ext[PBMT] != zeros() & not(extensionEnabled(Ext_Svpbmt)) | ||
// Other bits are reserved even for leaf PTEs. | ||
| pte_ext[reserved] != zeros() | ||
) | ||
|
||
// ---------------- | ||
// Check access permissions in PTE | ||
|
||
// For (non-standard) extensions: this function gets the extension-available bits | ||
// of the PTE in extPte, and the accumulated information of the page-table-walk | ||
// of the PTE in PTE_Ext, and the accumulated information of the page-table-walk | ||
// in ext_ptw. It should return the updated ext_ptw in both success and failure cases. | ||
|
||
union PTE_Check = { | ||
|
Oops, something went wrong.
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.
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.
Maybe the easiest approach here to allow using relational operators would be to add variables such as
Priv_1_12 = 20211203
and use those in the comparisons?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.
And a comment above with a commit hash and a link to the release on github?