-
-
Notifications
You must be signed in to change notification settings - Fork 171
Add uefi::boot module #1255
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
Add uefi::boot module #1255
Conversation
d986905
to
172b40d
Compare
uefi/src/boot.rs
Outdated
ty: AllocateType, | ||
mem_ty: MemoryType, | ||
count: usize, | ||
) -> Result<PhysicalAddress> { |
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.
Seems like an API inconsistency with allocate_pool
, which returns Result<NonNull<u8>>
.
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.
That's true. This inconsistency is present in our BootServices
methods and in the UEFI spec; AllocatePool
produces a void*
pointer, while AllocatePages
produces a EFI_PHYSICAL_ADDRESS
. Notably, EFI_PHYSICAL_ADDRESS
is always a UINT64
rather than being pointer sized, so there is a real difference in behavior. The docstring notes this in the context of ia32 PAE (I copied it from the BootServices
method, the text was originally added in this commit).
That said, I think in almost all cases the first thing a caller is going to do with the EFI_PHYSICAL_ADDRESS
is cast it to a pointer, and I can't currently think of any real-world counter example. So, while I don't feel very strongly in either direction, I don't mind converting this to return NonNull<u8>
instead of PhysicalAddress
.
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.
Updated. For full consistency, I also changed both free functions to use NonNull<u8>
as well.
172b40d
to
f6a2dbd
Compare
The initial version contains allocate_pages/allocate_pool and the corresponding `free` functions. Unlike the `BootServices` methods, these functions all use `NonNull<u8>` for consistency.
f6a2dbd
to
f1c9f28
Compare
The initial version contains
allocate_pages/allocate_pool
and the correspondingfree
functions.Checklist