diff options
author | Jeremy Compostella <jeremy.compostella@intel.com> | 2024-10-08 16:55:51 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-10-17 13:32:42 +0000 |
commit | 996e740cc83aa499d91b3ab3ae857dab7578e05c (patch) | |
tree | 85d685e012b1c6f903b9b3aa4b5ef22578d6219d /BaseTools/Bin | |
parent | 1b70dcd375765d293f57fe546710b98525e6a46d (diff) | |
download | edk2-996e740cc83aa499d91b3ab3ae857dab7578e05c.tar.gz |
MdeModulePkg: Fix PeiAllocatePages() corner case
I recently ran into an AllocatePages() hang. It turns out that
AllocatePages() does not account for the Memory Allocation HOB when it
makes the decision of allocating out of free memory.
Here is the scenario:
FreeMemoryTop - 0x71C03000
FreeMemoryBottom - 0x71BDBFD8
=> We have 159,784 bytes left => ~39.0098 pages left.
We attempt to allocate 39 pages. There are enough pages left but
allocating those pages requires to allocate a Memory Allocation HOB
which needs an extra 48 bytes. But once the pages are allocated,
there are only 40 bytes left.
In addition to taking into account the Memory Allocation HOB size,
this commit reverses the condition to keep it simple.
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Diffstat (limited to 'BaseTools/Bin')
0 files changed, 0 insertions, 0 deletions