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 adds support for the page attribute table MSR, and allows level 1 page table entries to have the
HUGE_PAGE
bit set. TheHUGE_PAGE
bit is used as thePAT
bit to index the table for 4KiB pages.This commit is based on #529. Following this PR, it was brought up that that PR was a breaking change because some users rely on FrameError::HugeFrame. This PR is still a breaking change, but it tries to make migrating easier for users that use this error variant.
I decided to go with Philipp's suggestion to add a is_level_1_entry parameter. I'll concede that this doesn't feel particularly clean, however callers usually already know the level of the page table entry (at least the was the case for all the callers in this crate) and having this function saves quite a lot of boilerplate (see #529 for how calling code needs to be changed without this function detecting huge pages). I tried looking through some projects on GitHub and it looks like most of them don't have support for huge pages and just panic if they encounter an error from this function. I think this is also another good reason to keep the FrameError::HugeFrame variant around because if a project ever starts to adopt huge pages, it will be very obvious where code is failing opposed to frame() silently returning a frame of the wrong size.
Cc @adavis628
Cc @ChocolateLoverRaj
Closes #538