Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: 996e740cc83aa499d91b3ab3ae857dab7578e05c
      
https://github.com/tianocore/edk2/commit/996e740cc83aa499d91b3ab3ae857dab7578e05c
  Author: Jeremy Compostella <jeremy.composte...@intel.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M MdeModulePkg/Core/Pei/Memory/MemoryServices.c

  Log Message:
  -----------
  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.composte...@intel.com>


  Commit: 866abb233817eb349fa5fe2b32283e990a8e5056
      
https://github.com/tianocore/edk2/commit/866abb233817eb349fa5fe2b32283e990a8e5056
  Author: Jeremy Compostella <jeremy.composte...@intel.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M MdeModulePkg/Core/Pei/Memory/MemoryServices.c

  Log Message:
  -----------
  MdeModulePkg: Replace right bit shift operator with RShiftU64

Instead of using bit shift operations, it is preferable to use BaseLib
bit shift functions to prevent compilers from inserting intrinsics.

Signed-off-by: Jeremy Compostella <jeremy.composte...@intel.com>


Compare: https://github.com/tianocore/edk2/compare/1b70dcd37576...866abb233817

To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to