-
Notifications
You must be signed in to change notification settings - Fork 133
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
GDT: Add load_unchecked
, from_raw_slice
, and as_raw_slice
.
#210
Conversation
load_unchecked
, from_raw_parts
, and into_raw_parts
.load_unchecked
, from_raw_parts
, and into_raw_parts
.
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.
Thanks for the pull request! I have a few suggestions, but otherwise I agree that these methods would be useful.
CI builds for stable are failing for |
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.
Thanks for the updates! A few nits, then this should be ready for merging.
Co-authored-by: Philipp Oppermann <[email protected]>
Thanks a lot! |
load_unchecked
, from_raw_parts
, and into_raw_parts
.load_unchecked
, from_raw_slice
, and as_raw_slice
.
Currently the API for
structures::GlobalDescriptorTable
feels like it requires you to either:static mut
to store your GDT (which is a bad idea)That's because there's no way to actually form your GDT entries without using
add_entry
which takes&mut self
... which seems contradictory thatload
requires the GDT to be&'static self
!you can get around this using a lazy_static of course but what if I want to use once_cell instead? there's no nice way of going about this... that's why this PR inroduces
load_unchecked
which is the same asload
without the'static
requirement and markedunsafe
(of course.)Also I noticed that sometimes you just know ahead of time what you want your GDT to be initialized with which lead me to add the const unsafe
from_raw_parts
constructor andinto_raw_parts
.