Skip to content
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

VirtAddr improvements #370

Merged
merged 4 commits into from
Mar 31, 2022
Merged

VirtAddr improvements #370

merged 4 commits into from
Mar 31, 2022

Conversation

josephlr
Copy link
Contributor

The first commit removes our *const T -> VirtAddr conversion on 32-bit platforms. Per the comment, it's "only here for backwards compatibility". Should we go even further and remove the conversions on all non-x86_64 platforms?

The second commit makes it so new and try_new fail on non-canonical addresses. Fixes #299

The third commit make new and try_new const. Other VirtAddr/PhysAddr methods are made const in #369 (which will be pulled back into this branch when its merged).

@josephlr josephlr mentioned this pull request Mar 31, 2022
13 tasks
Copy link
Member

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me overall!

We should also update the docs of new_truncate because it still mentions new and try_new as alternative methods with similar behavior, but these methods don't do any sign extension anymore. So maybe remove that last sentence, or change it to "If you want to check whether an address is canonical ...".

src/addr.rs Outdated Show resolved Hide resolved
Co-authored-by: Philipp Oppermann <[email protected]>
Signed-off-by: Joe Richey <[email protected]>
@josephlr
Copy link
Contributor Author

We should also update the docs of new_truncate because it still mentions new and try_new as alternative methods with similar behavior, but these methods don't do any sign extension anymore. So maybe remove that last sentence, or change it to "If you want to check whether an address is canonical ...".

I updated the docs for new and try_new to make it clear that they don't sign extend anything (they just check if addresses are canonical). I also made your recommended changes to new_truncate, added some cross links, and fixed some typos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants