-
-
Notifications
You must be signed in to change notification settings - Fork 170
doc: improved documentation for boot allocation functions #1665
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
base: main
Are you sure you want to change the base?
Conversation
/// | ||
/// UEFI OS loaders should allocate memory of the type `LoaderData`. | ||
/// The caller is responsible to free the memory using [`free_pages`]. |
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.
/// The caller is responsible to free the memory using [`free_pages`]. | |
/// The caller is responsible for freeing the memory using [`free_pages`]. |
/// - `memory_type`: The [`MemoryType`] used to persist the allocation in the | ||
/// UEFI memory map. Typically, UEFI OS loaders should allocate memory of | ||
/// type [`MemoryType::LOADER_DATA`]. | ||
///- `size`: Amount of bytes to allocate. |
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.
///- `size`: Amount of bytes to allocate. | |
///- `count: Number of pages to allocate. |
///- `size`: Amount of bytes to allocate. | ||
/// | ||
/// # Safety | ||
/// Using this function is safe but reading on initialized memory is not. |
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.
/// Using this function is safe but reading on initialized memory is not. | |
/// Using this function is safe, but it returns a raw pointer to uninitialized memory. The memory must be initialized before creating a reference to it. |
(Reference: https://doc.rust-lang.org/nomicon/unchecked-uninit.html "It is illegal to construct a reference to uninitialized data")
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.
Yikes, typos/weird wording from my side.
Thanks
/// - `memory_type`: The [`MemoryType`] used to persist the allocation in the | ||
/// UEFI memory map. Typically, UEFI OS loaders should allocate memory of | ||
/// type [`MemoryType::LOADER_DATA`]. | ||
///- `size`: Amount of bytes to allocate. |
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.
///- `size`: Amount of bytes to allocate. | |
///- `size`: Number of bytes to allocate. |
(This is a nitpicky grammar thing, "number" should be used for countable things)
Leftover from #1606
Checklist