You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The out parameter of BootServices->AllocatePages() is an EFI_PHYSICAL_ADDRESS, not a pointer.
The uefi-rs wrapper boot::allocate_pages() converts this into a NonNull<u8> and panics if that fails.
However there is nothing in the standard that says physical address 0 is not a valid result, and X86 has a tendency of mapping physical memory at address 0. This can cause valid programs to panic on allocation.
Most UEFI implementations allocate from top-down, so this only really happens in practice just before running out memory, but there is nothing in the spec that says they need to. Code assuming AllocatePages() always returns non-0 addresses can panic on random allocations.
Some other UEFI apps (e.g. GRUB) do have checks to retry allocation if address 0 was yielded.